| 1 |
From: Chuan-kai Lin <[email protected]> |
| 2 |
Date: Sun, 10 May 2020 21:07:00 -0700 |
| 3 |
Subject: Hack explicit dependencies on parse.h |
| 4 |
|
| 5 |
The target lexcalc-scan.o needs parse.h to build. Without explicit |
| 6 |
dependencies, make might attempt to build that target before a different |
| 7 |
rule finishes generating parse.h, leading to FTBFS. But the Makefile.in |
| 8 |
generated by automake generates parse.h through a .y.c suffix rule |
| 9 |
(without indicating that invoking bison also generates a .h output), so |
| 10 |
explicit dependencies on parse.h also do not work. |
| 11 |
|
| 12 |
This patch implements a hack that makes lexcalc-scan.o depend on |
| 13 |
parse.c. Since parse.c is generated by the same rule as parse.h, these |
| 14 |
bogus dependencies ensure that make attempts to build the .o file only |
| 15 |
after parse.h becomes available. |
| 16 |
--- |
| 17 |
examples/c/lexcalc/local.mk | 3 +++ |
| 18 |
1 file changed, 3 insertions(+) |
| 19 |
|
| 20 |
diff --git a/examples/c/lexcalc/local.mk b/examples/c/lexcalc/local.mk |
| 21 |
index 636275c..c1bad98 100644 |
| 22 |
--- a/examples/c/lexcalc/local.mk |
| 23 |
+++ b/examples/c/lexcalc/local.mk |
| 24 |
@@ -29,6 +29,9 @@ if FLEX_WORKS |
| 25 |
# %C%_lexcalc_CFLAGS = $(TEST_CFLAGS) |
| 26 |
endif FLEX_WORKS |
| 27 |
|
| 28 |
+%D%/lexcalc$(DASH)scan.o: %D%/parse.c |
| 29 |
+%D%/examples_c_lexcalc_lexcalc$(DASH)scan.o: %D%/parse.c |
| 30 |
+ |
| 31 |
%D%/parse.c: $(dependencies) |
| 32 |
|
| 33 |
# Tell Make scan.o depends on parse.h, except that Make sees only |