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.
This commit is contained in:
Andrew Johnson
2011-11-08 13:23:25 -06:00
parent b36b07db9e
commit 0dfbd460e1

View File

@@ -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