CFLAGS =  -Wall -ggdb -O $(OPTIONS)

SOURCES= chgdate.c getdate.c getmisc.c jul_greg.c jul_greg.h \
	getyacc.y getlex.l getyacc.h

OBJECTS = chgdate.o getdate.o getmisc.o jul_greg.o getyacc.o getlex.o 

BINDIR = $$HOME/bin
MANDIR = $$HOME/man

chgdate:	$(OBJECTS) 
	cc $(OBJECTS) -o chgdate

getdate.o getmisc.o jul_greg.o:	jul_greg.h

getyacc.c y.tab.h: 	getyacc.y jul_greg.h
	bison -y -v -d getyacc.y
# -y,yacc output files; -[vd],info files generated
	mv y.tab.c getyacc.c

getlex.c: 	getlex.l jul_greg.h y.tab.h
	flex -l getlex.l
# -i,ignore case; -l,max att compat, -d,debug
	mv lex.yy.c getlex.c

print:
	pr $(SOURCES) | lp
	nroff -man *.[13] |lp

clean:
#	rm chgdate $(OBJECTS) a.out core  getyacc.c getlex.c lex.yy.c y.* 
	rm $(OBJECTS) a.out core  #chgdate getyacc.c getlex.c lex.yy.c y.* 

deep-clean:	clean
	rm chgdate getyacc.c getlex.c lex.yy.c y.*

install: chgdate
#	strip chgdate
	cp -p chgdate $(BINDIR)
	cp -p chgdate.1 $(MANDIR)/man1
	cp -p getdate.3 $(MANDIR)/man3
