diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-03-22 06:44:28 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-03-22 06:44:28 -0700 |
commit | cc966e1590332779e66d067c12ef79291dceafae (patch) | |
tree | 74f63bcaf808a1cf8bb3da88c81786916d7a7787 /Makefile | |
parent | ebbc7fb10c1763d81fadb6328e9f9f4b9f833b28 (diff) | |
download | txr-cc966e1590332779e66d067c12ef79291dceafae.tar.gz txr-cc966e1590332779e66d067c12ef79291dceafae.tar.bz2 txr-cc966e1590332779e66d067c12ef79291dceafae.zip |
build: use yacc pattern rule with "y" as stem.
Thanks to a recent discussion in the GNU Make mailing list
about some issue related to grouped patterns, I hit upon the
realization that the rule y.tab.h y.tab.c: parser.y has
a common stem, y, which can be exploited to write a pattern
rule. This is only active in maintainer mode; in user mode,
the y.tab.h and y.tab.c are separately produced from .shipped
files.
* Makefile (y.tab.h): Eliminate rule which detects a removed
y.tab.h.
(y.tab.c): Delete rule, replacing with new rule.
(%.tab.c %.tab.h): New pattern rule, which groups the targets
together.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 10 |
1 files changed, 1 insertions, 9 deletions
@@ -274,15 +274,7 @@ lex.yy.c: $(top_srcdir)parser.l fi) $(call SH,chmod a-w $@) -y.tab.h: y.tab.c - $(call SH, \ - if ! [ -e y.tab.h ] ; then \ - echo "Someone removed y.tab.h but left y.tab.c" ; \ - echo "Remove y.tab.c and re-run make" ; \ - exit 1 ; \ - fi) - -y.tab.c: $(top_srcdir)parser.y +%.tab.c %.tab.h: $(top_srcdir)parser.% $(call ABBREV,YACC) $(call SH, \ if [ -e y.tab.h ]; then mv y.tab.h y.tab.h.old ; fi) |