Message ID | 20210925151035.850310-7-jeremy@azazel.net |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
Series | [conntrack-tools,1/6] build: remove commented-out macros from configure.ac | expand |
On Saturday 2021-09-25 17:10, Jeremy Sowden wrote: >List it as a built source in order to force make to create it before >compilation. Otherwise, a parallel make can end up attempting to >compile the output of lex before yacc has finished generating its own >output: > >--- a/src/Makefile.am >+++ b/src/Makefile.am >@@ -6,6 +6,7 @@ endif > > AM_YFLAGS = -d > >+BUILT_SOURCES = read_config_yy.h > MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c I have a strong reason to believe that you could just write read_config_yy.h: read_config_yy.y (detail https://lists.gnu.org/archive/html/automake/2021-09/msg00011.html )
On 2021-09-25, at 17:49:27 +0200, Jan Engelhardt wrote: > On Saturday 2021-09-25 17:10, Jeremy Sowden wrote: > > List it as a built source in order to force make to create it before > > compilation. Otherwise, a parallel make can end up attempting to > > compile the output of lex before yacc has finished generating its > > own output: > > > > --- a/src/Makefile.am > > +++ b/src/Makefile.am > > @@ -6,6 +6,7 @@ endif > > > > AM_YFLAGS = -d > > > > +BUILT_SOURCES = read_config_yy.h > > MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c > > I have a strong reason to believe that you could just write > > read_config_yy.h: read_config_yy.y > > (detail https://lists.gnu.org/archive/html/automake/2021-09/msg00011.html ) Automake complains: src/Makefile.am:65: warning: user target 'read_config_yy.h' defined here ... automake: ... overrides Automake target 'read_config_yy.h' defined here From the documentation (https://www.gnu.org/software/automake/manual/automake.html#Extending): Note that Automake does not make any distinction between rules with commands and rules that only specify dependencies. So it is not possible to append new dependencies to an automake-defined target without redefining the entire rule. In this case, adding the rule you suggest to Makefile.am suppresses the rule that automake would normally generate: read_config_yy.h: read_config_yy.c @if test ! -f $@; then rm -f read_config_yy.c; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) read_config_yy.c; else :; fi J.
diff --git a/src/Makefile.am b/src/Makefile.am index 85ea18888e97..1f234749d35d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,6 +6,7 @@ endif AM_YFLAGS = -d +BUILT_SOURCES = read_config_yy.h MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c sbin_PROGRAMS = conntrack conntrackd nfct
List it as a built source in order to force make to create it before compilation. Otherwise, a parallel make can end up attempting to compile the output of lex before yacc has finished generating its own output: $ make -j17 [...] YACC read_config_yy.c LEX read_config_lex.c CC stack.o CC resync.o CC cthelper.o CC helpers.o CC utils.o CC expect.o CC systemd.o CC nfct.o CC nfct-extensions/helper.o CC nfct-extensions/timeout.o CC read_config_lex.o read_config_lex.l:25:10: fatal error: read_config_yy.h: No such file or directory 25 | #include "read_config_yy.h" | ^~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:701: read_config_lex.o] Error 1 make[2]: *** Waiting for unfinished jobs.... updating read_config_yy.h make[2]: Leaving directory '/space/azazel/work/git/netfilter/conntrack-tools/src' make[1]: *** [Makefile:743: all-recursive] Error 1 make[1]: Leaving directory '/space/azazel/work/git/netfilter/conntrack-tools/src' make: *** [Makefile:541: all-recursive] Error 1 Signed-off-by: Jeremy Sowden <jeremy@azazel.net> --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+)