From a843cfb44d84066aaceec3445b03d47e24881926 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Tue, 10 Oct 2000 23:10:27 +0200
Subject: [PATCH] Added locking to run config.status serially. This should
 remedy the problem that Makefile's in the module directories are created
 crippled when an old build tree is reused (typical symptom: "No rule to make
 target `/global.h'").

Rev: src/Makefile.in:1.211
---
 src/Makefile.in | 47 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 41 insertions(+), 6 deletions(-)

diff --git a/src/Makefile.in b/src/Makefile.in
index 1dacaebed0..e965908796 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.in,v 1.210 2000/10/10 00:02:50 hubbe Exp $
+# $Id: Makefile.in,v 1.211 2000/10/10 21:10:27 mast Exp $
 #
 
 # This line is needed on some machines.
@@ -634,19 +634,47 @@ config.status: $(SRCDIR)/configure
 	./config.status --recheck
 
 modules/static_module_makefile: $(SRCDIR)/modules/static_module_makefile.in config.status
-	CONFIG_FILES=modules/static_module_makefile CONFIG_HEADERS="" ./config.status
+	-@(echo foo > cfl.static_module_makefile; \
+	  while test "`echo cfl.*`" != cfl.static_module_makefile; do \
+	    echo "Waiting to run config.status serially:" cfl.*; \
+	    sleep 1; \
+	  done;)
+	CONFIG_FILES=modules/static_module_makefile CONFIG_HEADERS="" ./config.status || \
+	  (EXITCODE=$$?; rm cfl.static_module_makefile; exit $$EXITCODE)
+	-@rm cfl.static_module_makefile
 
 modules/dynamic_module_makefile: $(SRCDIR)/@dmmsrc@ config.status
-	CONFIG_FILES=modules/dynamic_module_makefile:@dmmsrc@ CONFIG_HEADERS="" ./config.status
+	-@(echo foo > cfl.dynamic_module_makefile; \
+	  while test "`echo cfl.*`" != cfl.dynamic_module_makefile; do \
+	    echo "Waiting to run config.status serially:" cfl.*; \
+	    sleep 1; \
+	  done;)
+	CONFIG_FILES=modules/dynamic_module_makefile:@dmmsrc@ CONFIG_HEADERS="" ./config.status || \
+	  (EXITCODE=$$?; rm cfl.dynamic_module_makefile; exit $$EXITCODE)
+	-@rm cfl.dynamic_module_makefile
 
 Makefile: $(SRCDIR)/Makefile.in $(SRCDIR)/dependencies config.status
-	CONFIG_FILES=Makefile CONFIG_HEADERS="" ./config.status
+	-@(echo foo > cfl.$@; \
+	  while test "`echo cfl.*`" != cfl.$@; do \
+	    echo "Waiting to run config.status serially:" cfl.*; \
+	    sleep 1; \
+	  done;)
+	CONFIG_FILES=Makefile CONFIG_HEADERS="" ./config.status || \
+	  (EXITCODE=$$?; rm cfl.$@; exit $$EXITCODE)
+	-@rm cfl.$@
 	touch remake
 	@echo "Run make again"
 	@exit 1
 
 precompile.sh: $(SRCDIR)/precompile.sh.in ./config.status
-	CONFIG_FILES=precompile.sh CONFIG_HEADERS="" ./config.status
+	-@(echo foo > cfl.$@; \
+	  while test "`echo cfl.*`" != cfl.$@; do \
+	    echo "Waiting to run config.status serially:" cfl.*; \
+	    sleep 1; \
+	  done;)
+	CONFIG_FILES=precompile.sh CONFIG_HEADERS="" ./config.status || \
+	  (EXITCODE=$$?; rm cfl.$@; exit $$EXITCODE)
+	-@rm cfl.$@
 
 $(SRCDIR)/machine.h.in: $(SRCDIR)/stamp-h.in
 	@if test -f $(SRCDIR)/machine.h.in; then :; else \
@@ -663,7 +691,14 @@ machine.h: stamp-h
 	fi
 
 stamp-h: $(SRCDIR)/stamp-h.in $(SRCDIR)/machine.h.in config.status
-	CONFIG_FILES="" CONFIG_HEADERS=machine.h ./config.status
+	-@(echo foo > cfl.$@; \
+	  while test "`echo cfl.*`" != cfl.$@; do \
+	    echo "Waiting to run config.status serially:" cfl.*; \
+	    sleep 1; \
+	  done;)
+	CONFIG_FILES="" CONFIG_HEADERS=machine.h ./config.status || \
+	  (EXITCODE=$$?; rm cfl.$@; exit $$EXITCODE)
+	-@rm cfl.$@
 
 testsuite: $(SRCDIR)/testsuite.in
 	$(TMP_BINDIR)/mktestsuite $(SRCDIR)/testsuite.in >testsuite -DSRCDIR="$(SRCDIR)"
-- 
GitLab