PROG =	wdvi

SRCS =	dvi-draw.c \
	dvi-init.c \
	events.c \
	filefind.c \
	font-open.c \
	ft.c \
	http.c \
	pk.c \
	popups.c \
	special.c \
	util.c \
	vf.c \
	xdvi.c

PKGS = freetype2 openssl xaw7
PKGS_CFLAGS !=	pkg-config --cflags ${PKGS}
PKGS_LDFLAGS !=	pkg-config --libs ${PKGS}

CPPFLAGS +=	-MD ${PKGS_CFLAGS}
#CFLAGS +=	-Wmissing-prototypes -Wno-uninitialized -Wstrict-prototypes
#CFLAGS +=	-Wunused-parameter -Wshadow
CFLAGS +=	-Wall -g
LDFLAGS +=	-Xlinker --allow-multiple-definition -lm

${PROG}: ${SRCS:.c=.o}
	${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} ${PKGS_LDFLAGS}

default.h: wdvi.1
	-roff2dvi wdvi.1 > default.dvi && xxd -i default.dvi $@

install:
	@echo "Not yet."

clean:
	rm -f ${PROG} ${PROG}.core *.o *.o.tmp *.d

tags: ${SRCS}
	ctags -d *.c *.h

analysis:
	make clean
	scan-build make

# BSD make does not like variable substitution in the -include
DEPENDS = ${SRCS:.c=.d}

-include ${DEPENDS}
