aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorzoulasc <zoulasc@users.noreply.github.com>2020-02-18 14:20:27 -0500
committerGitHub <noreply@github.com>2020-02-18 21:20:27 +0200
commit94e4c04561f7b9c2a3e7ef498fbfe7ce5b20ed40 (patch)
treeaf2394d4c104d9639d40a3c103c024737624594f /makefile
parente9c99065fd31253a4db4a6bce673decd143f7a3e (diff)
downloadone-true-awk-94e4c04561f7b9c2a3e7ef498fbfe7ce5b20ed40.tar.gz
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
Diffstat (limited to 'makefile')
-rw-r--r--makefile18
1 files changed, 9 insertions, 9 deletions
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