[PATCH] build-system: apply Gentoo patch for parallel build

Richard Maw richard.maw at codethink.co.uk
Fri Jan 18 12:14:29 GMT 2013

We had build failures stemming from the use of recursive make, and
multiple instances attempting to build pathnames.h at once.

This managed to go un-noticed for a year, possibly the introduction of
ccache made compilation quick enough to trigger this behaviour.

 Makefile.in |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 9f9276d..297ae66 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -579,16 +579,17 @@ buildversion.o: version.h conftypes.h patchlevel.h $(srcdir)/version.c
 # old rules
 GRAM_H = parser-built
-y.tab.o: y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h
+y.tab.o: y.tab.h y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h
 ${GRAM_H}:	y.tab.h
 	@-if test -f y.tab.h ; then \
 		cmp -s $@ y.tab.h 2>/dev/null || cp -p y.tab.h $@; \
-y.tab.c y.tab.h: parse.y
+y.tab.c: parse.y
 #	-if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
 	$(YACC) -d $(srcdir)/parse.y
 	touch parser-built
 #	-if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; else cp -p y.tab.h ${GRAM_H}; fi
+y.tab.h: y.tab.c ; @true
 # experimental new rules - work with GNU make but not BSD (or OSF) make
 #y.tab.o: y.tab.c y.tab.h
@@ -597,6 +598,11 @@ y.tab.c y.tab.h: parse.y
 #	$(YACC) -d $(srcdir)/parse.y
 #	-if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi
+# Subdirs will often times want version.h, so they'll change back up to
+# the top level and try to create it.  This causes parallel build issues
+# so just force top level sanity before we descend.
+$(LIBDEP): .build
 	@echo making $@ in ${RL_LIBDIR}
 	@( { test "${RL_LIBDIR}" = "${libdir}" && exit 0; } || \
@@ -668,7 +674,7 @@ syntax.c:	mksyntax${EXEEXT} $(srcdir)/syntax.h
 	$(RM) $@
 	./mksyntax$(EXEEXT) -o $@
-$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h version.h
+$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h ${DEFDIR}/builtext.h version.h
 	@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} libbuiltins.a ) || exit 1
 # these require special rules to circumvent make builtin rules

More information about the baserock-dev mailing list