From cc966e1590332779e66d067c12ef79291dceafae Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 22 Mar 2021 06:44:28 -0700 Subject: 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. --- Makefile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f0426802..37eb677d 100644 --- a/Makefile +++ b/Makefile @@ -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) -- cgit v1.2.3