#	Makefile /jam -88
#
#	pse check if patch is because of differences btw yacc and bison or
#	a bug (i.e. handling YYSTYPE), mail to jam@hutcs.hut.fi
#
#	Do the scanner by saying
#	make [ SYSTEM=(SYS5|BSD) ] [ ERRORS=(FIRST|ALL) ]

# SYSTEM= BSD
SYSTEM= SYS5

# First means that checking stops at the first error encountered.
# ERRORS=FIRST
# All means that checking is performed up to the end of file.
ERRORS= ALL

BINDIR=/usr/local/lbin

all:	system errors comp

comp:	ada.y ada.l yyerror.c
	bison -d ada.y
	mv ada.tab.h y.tab.h
	cat patch >>y.tab.h
	lex ada.l
	cc -D$(ERRORS) -c yyerror.c
	cc -D$(SYSTEM) -c lex.yy.c
	cc -c ada.tab.c
	cc -O yyerror.o lex.yy.o ada.tab.o -ly -ll -o adascan

lex:    system
	lex -v ada.l
	cc -D$(SYSTEM) -c lex.yy.c
	cc -O yyerror.o lex.yy.o ada.tab.o -ly -ll -o adascan

system:
	expr	"$(SYSTEM)" = SYS5 \| \
		"$(SYSTEM)" = BSD

errors:
	expr	"$(ERRORS)" = FIRST \| \
		"$(ERRORS)" = ALL

test:
	adascan <test.a >/dev/null

clean:
	rm -f a.out core *.o ada.tab.c y.tab.h lex.yy.c

tar:
	tar cf adascan.tar adalalr.orig Makefile README ada.note patch \
	 yyerror.c ada.y ada.l test.a
	compress adascan.tar
