From 0dfbd460e1ca63ec77a767233cc54171d3f5d3b6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 8 Nov 2011 13:23:25 -0600 Subject: [PATCH] configure: Fix potential parallel build issue When creating files in ../O.Common it is eesential to use atomic file replacement rather than deleting the old file and creating a new one in its place, because two or three architectures could be being built in parallel which might interfere. This commit also ensures that .dbd.d files are constructed properly when using 'make -s'; $(ECHO) does nothing then. --- configure/RULES.Db | 57 ++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/configure/RULES.Db b/configure/RULES.Db index 556218303..96d51ec7f 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -121,7 +121,7 @@ MAKEDBDEPENDS = $(PERL) $(TOOLS)/makeDbDepends.pl ifndef T_A -ECHO := $(if $(findstring s,$(MAKEFLAGS)),\#,@echo) +ECHO := $(if $(findstring s,$(MAKEFLAGS)),$(COMMENT),@echo) COMMON_DIR = . INSTALL_DBDS = INSTALL_DBS = @@ -223,58 +223,65 @@ $(INSTALL_DB)/%.template: %.template $(COMMON_DIR)/%Record.h: $(COMMON_DIR)/%Record.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTORECORDTYPEH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTORECORDTYPEH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%Record.h: %Record.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTORECORDTYPEH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTORECORDTYPEH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: $(COMMON_DIR)/menu%.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTOMENUH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTOMENUH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: menu%.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTOMENUH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTOMENUH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ .PRECIOUS: $(COMMON_DIR)/%.h ##################################################### DBD files $(COMMON_DIR)/bpt%.dbd: bpt%.data - @$(RM) $@ - $(MAKEBPT) $< $@ + $(MAKEBPT) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: $(COMMON_DIR)/%Include.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) $(ECHO) "Expanding dbd" - @$(RM) $@ - @$(DBEXPAND) $(DBDFLAGS) -o $@ $< + @$(RM) $(notdir $@) + @$(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: %Include.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) $(ECHO) "Expanding dbd" - @$(RM) $@ - $(DBEXPAND) $(DBDFLAGS) -o $@ $< + @$(RM) $(notdir $@) + $(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%Include.dbd: - @$(RM) $@ - $(PERL) $(TOOLS)/makeIncludeDbd.pl $($*_DBD) $@ + @$(RM) $(notdir $@) + $(PERL) $(TOOLS)/makeIncludeDbd.pl $($*_DBD) $(notdir $@) + @$(MV) $(notdir $@) $@ $(INSTALL_DBD)/%: $(COMMON_DIR)/% $(ECHO) "Installing created dbd file $@" @@ -302,8 +309,8 @@ $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf $(COMMON_DIR)/%.db$(RAW): %.substitutions @$(RM) $(notdir $@)$(DEP) - $(MAKEDBDEPENDS) $@ $< $(TEMPLATE_FILENAME) >> $(notdir $@)$(DEP) - $(ECHO) "$@:$(TEMPLATE_FILENAME)" >> $(notdir $@)$(DEP) + @$(MAKEDBDEPENDS) $@ $< $(TEMPLATE_FILENAME) >> $(notdir $@)$(DEP) + echo "$@ : $(TEMPLATE_FILENAME)" >> $(notdir $@)$(DEP) $(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)" @$(RM) $@ $*.tmp $(MSI) $(DBFLAGS) -S$< $(TEMPLATE_FILENAME) > $*.tmp