From 541943ee04ee22101bbbde2386272b1cad635132 Mon Sep 17 00:00:00 2001
From: Akim Demaille <akim.demaille@gmail.com>
Date: Sun, 6 Sep 2020 10:08:22 +0200
Subject: [PATCH] build: fix a concurrent build issue in examples

Reported by Thomas Deutschmann <whissi@gentoo.org>.
https://lists.gnu.org/r/bug-bison/2020-09/msg00010.html

* examples/c/lexcalc/local.mk: scan.o depends on parse.[ch].
---
 examples/c/lexcalc/local.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/examples/c/lexcalc/local.mk b/examples/c/lexcalc/local.mk
index b73887e..636275c 100644
--- a/examples/c/lexcalc/local.mk
+++ b/examples/c/lexcalc/local.mk
@@ -31,6 +31,13 @@ endif FLEX_WORKS
 
 %D%/parse.c: $(dependencies)
 
+# Tell Make scan.o depends on parse.h, except that Make sees only
+# parse.c, not parse.h.  We can't use BUILT_SOURCES to this end, since
+# we use the built bison.
+%D%/lexcalc$(DASH)scan.o: %D%/parse.c
+# Likewise, but for Automake before 1.16.
+%D%/examples_c_lexcalc_lexcalc$(DASH)scan.o: %D%/parse.c
+
 EXTRA_DIST += %D%/lexcalc.test
 dist_lexcalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
 CLEANFILES += %D%/parse.[ch] %D%/scan.c %D%/parse.output
-- 
1.8.3.1

