From 94e4c04561f7b9c2a3e7ef498fbfe7ce5b20ed40 Mon Sep 17 00:00:00 2001 From: zoulasc Date: Tue, 18 Feb 2020 14:20:27 -0500 Subject: argument parsing cleanups, dynamic program file allocation, fpe error enhancement. (#72) * - enhance fpe handler to print the error type - cleanup argument parsing - dynamically allocate program filename array * bison uses enums now, not #define's, make it work with that. * We need to use either the enums or the defines but not both. This is because bison -y will create both enums and #defines, while bison without -y produces only the enums, and byacc produces just #defines. * fix indentation * Set the tokentype when we have a match in the scan, and reset it later when we decide that the match was bad. Fixes nbyacc. * - don't use pattern rules for portability - try to move both flavors of generated names for portability * Amend tests for the new error messages --- makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index 735436c..6ed210f 100644 --- a/makefile +++ b/makefile @@ -35,7 +35,7 @@ CC = $(HOSTCC) # change this is cross-compiling. # yacc options. pick one; this varies a lot by system. #YFLAGS = -d -S -YACC = bison -d -y +YACC = bison -d #YACC = yacc -d # -S uses sprintf in yacc parser instead of sprint @@ -55,15 +55,15 @@ a.out: ytab.o $(OFILES) $(OFILES): awk.h ytab.h proto.h -#Clear dependency for parallel build: (make -j) -#YACC generated y.tab.c and y.tab.h at the same time -#this needs to be a static pattern rules otherwise multiple target -#are mapped onto multiple executions of yacc, which overwrite -#each others outputs. -y%.c y%.h: awk.h proto.h awkgram.y +# Clear dependency for parallel build: (make -j) +# Depending if we used yacc or bison we can be generating different names +# ({awkgram,y}.tab.{c,h}) so try to move both. We could be using -p to +# specify the output prefix, but older yacc's don't support it. +ytab.c ytab.h: awk.h proto.h awkgram.y $(YACC) $(YFLAGS) awkgram.y - mv y.$*.c y$*.c - mv y.$*.h y$*.h + -@for i in c h; do for j in awkgram y; do \ + if [ -f "$$j.tab.$$i" ]; then mv $$j.tab.$$i ytab.$$i; fi; \ + done; done ytab.h: ytab.c -- cgit v1.2.3