# cparser
#		AUIS parser

#  To configure for your system, specify the installation tree:
DESTDIR = /usr/local

CPPFLAGS = -DYYDEBUG -I.

# Memcopy.  
# The code uses bcopy().  If your system instead supplies memcpy,
# you need to remove the # from the next line.
#CFLAGS = -DUSEMEMCPY  -Dvoid=int  -DYYDEBUG  -I.


libcparser.a: cparser.o
	ar r libcparser.a cparser.o
	ranlib libcparser.a


INSTALLFILES =  ${DESTDIR}/bin/mkparser ${DESTDIR}/include/cparser.h ${DESTDIR}/lib/libcparser.a ${DESTDIR}/doc/parser.doc

install:  ${INSTALLFILES}

${DESTDIR}/bin/mkparser: mkparser
	install -m 755 -o root -g root $< $@

${DESTDIR}/include/cparser.h: cparser.h
	install -m 755 -o root -g root $< $@

${DESTDIR}/lib/libcparser.a: libcparser.a
	install -m 755 -o root -g root $< $@
	ranlib $@

${DESTDIR}/doc/parser.doc: parser.doc
	rm -f $@
	cp  $? $@
	chmod 644 $@


TESTOBJS =  foo.o testparse.o cparser.o
foo.h foo.c: foo.y
	bison -k foo.y
	./mkparser foo
testparse: foo.h ${TESTOBJS}
	cc $(CFLAGS) -o testparse ${TESTOBJS}


clean: 
	rm -f \#* ,* *~ *.CKP *.BAK *.bas errs core
	rm -f *.ln *.o *.dog tags TAGS make.log
	rm -f *.do *.eh *.ih *.a *.fwm *.snf *.pcf *.rtx *.fb
	rm -f install.time install.doc
	rm -f testparse
	rm -f foo.c foo.h foo.act foo.tab.c
