#	Makefile -- for vdeck

#	SCCSID	@(#)Makefile	2.6

PRODUCT =vdeck

HEADERS = ${PRODUCT}.h vextern.h ../ged/machine.h ../h/vmath.h ../h/db.h 
CFILES	= ${PRODUCT}.c cgarbs.c match.c parsarg.c vproc.c vglobal.c \
	vsort.c getopt.c
OBJS	= ${PRODUCT}.o cgarbs.o match.o parsarg.o vproc.o vglobal.o \
	vsort.o getopt.o

LIBES	= -lm
CFLAGS	= -DBSD42
LDFLAGS = -n# -m 6 # NEED -m flag on GOULDS.

INSTDIR	= /usr/brl/bin
INCDIR	= .
MANDIR	= /usr/man/man1

.c.o:
	$(CC) -I${INCDIR} $(CFLAGS) -c $<

.c~.o:
	get $(GFLAGS) -p $< > $*.c
	$(CC) $(CFLAGS) -c -I${INCDIR} $<
	-rm -f $*.c

all:		${PRODUCT} ${PRODUCT}.1

${PRODUCT}:	${OBJS}
	$(CC) -o $@ ${LDFLAGS} ${OBJS} ${LIBES} 
	size $@
	touch $@

${OBJS}:	${HEADERS}

print:		${PRODUCT}.1 Makefile ${HEADERS} ${CFILES}
	( nroff -Tlp -man ${PRODUCT}.1 ; \
	  pr Makefile ${HEADERS} ${CFILES} \
				${PRODUCT}.1 ) | lpr

lint:		${HEADERS} ${CFILES}
	lint -I${INCDIR} ${CFILES} ${LIBES} > ${PRODUCT}.lint

flow:		${HEADERS} ${CFILES}
	cflow ${CFILES} > ${PRODUCT}.flow

xref:		${HEADERS} ${CFILES}
	cxref -c -s -w132 ${CFILES} > ${PRODUCT}.xref

compare:	all
	cmp ${INSTDIR}/${PRODUCT} ${PRODUCT}
	cmp ${MANDIR}/${PRODUCT}.1 ${PRODUCT}.1

install:	all
	cp ${PRODUCT} ${INSTDIR}
	chmod 755 ${INSTDIR}/${PRODUCT}
	cp ${PRODUCT}.1 ${MANDIR}/${PRODUCT}.1
	chmod 664 ${MANDIR}/${PRODUCT}.1
	cp Makefile *.h *.c ../dist/vdeck/.

clean:
	-rm -f ${OBJS} ${PRODUCT}.lint \
		${PRODUCT}.flow ${PRODUCT}.xref \
		${PRODUCT}.out ${PRODUCT}.err

clobber:	clean
	-rm -f ${PRODUCT}
