#
# $Id: //devel/tools/main/datemath/Makefile#2 $
#
# written by:   Stephen J. Friedl
#               Software Consultant
#               Tustin, California USA
#               steve@unixwiz.net
#
#		http://www.unixwiz.net/tools/datemath.html
#
#	This is the makefile for datemath, and it's not nearly so
#	portable as most of our other code. It was written many
#	moons ago with lex and yacc, but it's been revised to deal
#	with flex and bison: it's likely that this was not a complete
#	solution.
#

YACC	= bison
LEX	= flex

CC	= gcc
CFLAGS	= -W -Wall -pedantic

OBJS	= datemath.o gram.o lex.o util.o jdate.o
SOURCE	= datemath.c gram.y lex.l util.c jdate.c defs.h Makefile

CLEAN	= ${OBJS} y.tab.h gram.c lex.c y.tab.c gram.tab.c gram.h
CLOBBER	= datemath install

datemath : ${OBJS}
	$(strip ${CC} -o $@ ${CFLAGS} ${OBJS} ${LIBS})

gram.c : gram.y
	$(strip $(YACC) --defines --output=gram.c gram.y)

lex.o : lex.l gram.o		# insure that y.tab.h is built

$(OBJS) : defs.h

clean :
	/bin/rm -f ${CLEAN}

clobber : clean
	/bin/rm -f ${CLOBBER}

tarball : datemath.tgz

datemath.tgz : $(SOURCE)
	gtar -czvf $@ $(SOURCE)
