From 2905b5bb72449727c192c101d877ea17b87b9e4c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 14 Nov 2011 18:28:26 -0600 Subject: [PATCH 1/2] Parallel build rule fixes --- configure/CONFIG_COMMON | 19 ++--- configure/RULES.Db | 77 +++++++++++-------- configure/RULES_BUILD | 13 +++- configure/os/CONFIG.Common.RTEMS | 5 +- .../os/CONFIG.solarisCommon.solarisCommon | 9 +-- documentation/RELEASE_NOTES.html | 30 ++++++++ src/libCom/as/RULES | 2 +- 7 files changed, 100 insertions(+), 55 deletions(-) diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON index f98f76ec3..0f4897bc1 100644 --- a/configure/CONFIG_COMMON +++ b/configure/CONFIG_COMMON @@ -272,11 +272,11 @@ INCLUDES = -I. $(SRC_INCLUDES) $(INSTALL_INCLUDES) $(RELEASE_INCLUDES)\ CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\ $(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS)\ - $(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS) + $(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS) CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS) $(DEBUG_CXXFLAGS)\ $(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS) $(ARCH_DEP_CXXFLAGS)\ - $(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS) + $(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS) LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \ $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS) $($(BUILD_CLASS)_LDFLAGS)\ @@ -326,15 +326,16 @@ HDEPENDS_METHOD = CMD HDEPENDS_INCLUDES = $(subst -I,,$(INCLUDES)) HDEPENDSFLAGS = -m $*$(DEP) $(HDEPENDS_INCLUDES) $@ $< -HDEPENDSCMD = -$(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDSFLAGS) HDEPENDS_CMD_NO = $(ECHO) "" -HDEPENDS_CMD_YES = $(if $(filter CMD,$(HDEPENDS_METHOD)),$(HDEPENDSCMD),$(HDEPENDS_CMD_NO)) -HDEPENDS_CMD = $(HDEPENDS_CMD_$(HDEPENDS)) +HDEPENDS_CMD_YES = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDSFLAGS) -HDEPENDSCFLAGS = -MMD -HDEPENDS_CFLAGS_YES = $(if $(filter CFLAGS,$(HDEPENDS_METHOD)),$(HDEPENDSCFLAGS)) -HDEPENDS_CFLAGS = $(HDEPENDS_CFLAGS_$(HDEPENDS)) +HDEPENDSCFLAGS = -MM > $*$(DEP) +HDEPSUFFIX = $(if $(filter .c,$(suffix $<)),.c,.cpp) +HDEPENDS_CFLAGS_NO = $(ECHO) "" +HDEPENDS_CFLAGS_YES = $(COMPILE$(HDEPSUFFIX)) $(HDEPENDSCFLAGS) $< + +HDEPENDS_CMD = $(HDEPENDS_$(HDEPENDS_METHOD)_$(HDEPENDS)) #-------------------------------------------------- # depends definition @@ -342,7 +343,7 @@ HDEPENDS_CFLAGS = $(HDEPENDS_CFLAGS_$(HDEPENDS)) TARGET_SRCS = $(foreach name, $(TESTPROD) $(PROD) $(TESTLIBRARY) $(LIBRARY) $(LOADABLE_LIBRARY), $($(name)_SRCS)) SRC_FILES = $(LIB_SRCS) $(LIBSRCS) $(SRCS) $(USR_SRCS) $(PROD_SRCS) $(TARGET_SRCS) HDEPENDS_FILES_YES = $(addsuffix $(DEP),$(notdir $(basename $(SRC_FILES)))) -HDEPENDS_FILES = $(if $(filter NO,$(HDEPENDS)),,$(HDEPENDS_FILES_YES)) +HDEPENDS_FILES = $(HDEPENDS_FILES_$(HDEPENDS)) #--------------------------------------------------------------- # Names of installed items diff --git a/configure/RULES.Db b/configure/RULES.Db index d05dfb340..200e65fa0 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -100,7 +100,7 @@ ACF_CPPFLAGS = $(ACF_CPPFLAGS_$(GNU)) ACF_INCLUDES = -I. $(TARGET_INCLUDES) $(USR_INCLUDES)\ $(SRC_INCLUDES) -I$(INSTALL_DB) -ACFDEPENDS_CMD = -$(MKMF) -m $(notdir $@)$(DEP) $(subst -I,,$(ACF_INCLUDES)) $@ $< +ACFDEPENDS_CMD = $(MKMF) -m $@ $(subst -I,,$(ACF_INCLUDES)) $(COMMON_DIR)/$(basename $@) $< ACF_CMD = $(CPP) $(ACF_CPPFLAGS) $(ACF_INCLUDES) $< > $@ ##################################################### dependancies @@ -110,10 +110,11 @@ COMMON_DBDINC += $(addprefix $(COMMON_DIR)/,$(HINC)) DBDDEPENDS_FILES += $(addsuffix $(DEP),$(HINC) \ $(patsubst $(COMMON_DIR)/%,%,$(COMMON_DBS)) \ - $(patsubst $(COMMON_DIR)/%,%,$(COMMON_DBDS))) + $(patsubst $(COMMON_DIR)/%,%, \ + $(filter-out $(COMMON_DIR)/bpt%.dbd,$(COMMON_DBDS)))) DBDDEPENDS_FLAGS = $(subst -I,,$(filter-out -S%,$(DBDFLAGS))) -DBDDEPENDS_CMD = -$(MKMF) -m $(notdir $@)$(DEP) $(DBDDEPENDS_FLAGS) $@ $< +DBDDEPENDS_CMD = $(MKMF) -m $@ $(DBDDEPENDS_FLAGS) $(COMMON_DIR)/$(basename $@) $< MAKEDBDEPENDS = $(PERL) $(TOOLS)/makeDbDepends.pl @@ -162,8 +163,6 @@ ifneq (,$(strip $(DBDDEPENDS_FILES))) -include $(DBDDEPENDS_FILES) endif -$(DBDDEPENDS_FILES): - ##################################################### build dependancies, clean rule inc : $(COMMON_INC) $(INSTALL_INC) @@ -184,6 +183,45 @@ db_clean : realclean: clean +##################################################### Dependency files + +%Record.h$(DEP): $(COMMON_DIR)/%Record.dbd + @$(RM) $@ + @$(DBDDEPENDS_CMD) + +%Record.h$(DEP): %Record.dbd + @$(RM) $@ + @$(DBDDEPENDS_CMD) + +menu%.h$(DEP): $(COMMON_DIR)/menu%.dbd + @$(RM) $@ + @$(DBDDEPENDS_CMD) + +menu%.h$(DEP): menu%.dbd + @$(RM) $@ + @$(DBDDEPENDS_CMD) + +%.dbd$(DEP): $(COMMON_DIR)/%Include.dbd + @$(RM) $@ + @$(DBDDEPENDS_CMD) + +%.dbd$(DEP): %Include.dbd + @$(RM) $@ + @$(DBDDEPENDS_CMD) + +%.db$(RAW)$(DEP): %.substitutions + @$(RM) $@ + @$(MAKEDBDEPENDS) $(COMMON_DIR)/$(basename $@) $< $(TEMPLATE_FILENAME) > $@ + @echo "$(COMMON_DIR)/$(basename $@): $(TEMPLATE_FILENAME)" >> $@ + +%.db$(RAW)$(DEP): %.template + @$(RM) $@ + @$(MAKEDBDEPENDS) $(COMMON_DIR)/$(basename $@) $^ > $@ + +%.acf$(DEP): %.acs + @$(RM) $@ + @$(ACFDEPENDS_CMD) + ##################################################### CapFast filter $(COMMON_DIR)/%.edf: ../%.sch $(DEPSCHS) @@ -225,33 +263,21 @@ $(INSTALL_DB)/%.template: %.template ##################################################### INC files $(COMMON_DIR)/%Record.h: $(COMMON_DIR)/%Record.dbd - @$(RM) $(notdir $@)$(DEP) - @$(DBDDEPENDS_CMD) - 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) $(notdir $@) $(DBTORECORDTYPEH) $(DBDFLAGS) $< $(notdir $@) @$(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: $(COMMON_DIR)/menu%.dbd - @$(RM) $(notdir $@)$(DEP) - @$(DBDDEPENDS_CMD) - 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) $(notdir $@) $(DBTOMENUH) $(DBDFLAGS) $< $(notdir $@) @$(MV) $(notdir $@) $@ @@ -261,22 +287,17 @@ $(COMMON_DIR)/menu%.h: menu%.dbd ##################################################### DBD files $(COMMON_DIR)/bpt%.dbd: bpt%.data + @$(RM) $(notdir $@) $(MAKEBPT) $< $(notdir $@) @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: $(COMMON_DIR)/%Include.dbd - @$(RM) $(notdir $@)$(DEP) - @$(DBDDEPENDS_CMD) - echo "$< : ../Makefile" >> $(notdir $@)$(DEP) $(ECHO) "Expanding dbd" @$(RM) $(notdir $@) - @$(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< + $(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: %Include.dbd - @$(RM) $(notdir $@)$(DEP) - @$(DBDDEPENDS_CMD) - echo "$< : ../Makefile" >> $(notdir $@)$(DEP) $(ECHO) "Expanding dbd" @$(RM) $(notdir $@) $(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< @@ -312,25 +333,18 @@ $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf @$(RM) $*.VAR $(COMMON_DIR)/%.db$(RAW): %.substitutions - @$(RM) $(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 $(MV) $*.tmp $@ $(COMMON_DIR)/%.db$(RAW): %.template - @$(RM) $(notdir $@)$(DEP) - @$(MAKEDBDEPENDS) $@ $^ >> $(notdir $@)$(DEP) $(ECHO) "Inflating database from $<" @$(RM) $@ $*.tmp $(MSI) $(DBFLAGS) $< > $*.tmp $(MV) $*.tmp $@ $(COMMON_DIR)/%.acf: %.acs - @$(RM) $(notdir $@)$(DEP) - @$(ACFDEPENDS_CMD) $(ECHO) "Creating acf file $@" @$(RM) $@ $(ACF_CMD) @@ -388,6 +402,5 @@ IOC_INST_TOP := $(firstword $(IOCS_APPL_TOP) \ $(MV) $*.tmp $@ .PRECIOUS: %_registerRecordDeviceDriver.cpp -.PRECIOUS: %$(DEP) ##################################################### END OF FILE diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 665a68510..9c7518720 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -76,6 +76,7 @@ all: install -include $(CONFIG)/RULES_JAVA ifneq (,$(strip $(HDEPENDS_FILES))) +$(filter-out $(wildcard *.d), $(HDEPENDS_FILES)): $(COMMON_INC) -include $(HDEPENDS_FILES) endif @@ -196,18 +197,24 @@ $(OBJLIBNAME):%$(OBJ): @$(RM) $@ $(COMPILE.ctdt) $< -%$(OBJ): %.c +%$(DEP):%.c @$(HDEPENDS_CMD) + +%$(DEP):%.cc + @$(HDEPENDS_CMD) + +%$(DEP):%.cpp + @$(HDEPENDS_CMD) + +%$(OBJ): %.c @$(RM) $@ $(COMPILE.c) $(call PATH_FILTER,$<) $(COMPILE_FILTER.c) %$(OBJ): %.cc - @$(HDEPENDS_CMD) @$(RM) $@ $(COMPILE.cpp) $(call PATH_FILTER,$<) $(COMPILE_FILTER.cpp) %$(OBJ): %.cpp - @$(HDEPENDS_CMD) @$(RM) $@ $(COMPILE.cpp) $(call PATH_FILTER,$<) $(COMPILE_FILTER.cpp) diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS index faf2bd23c..10aaba80a 100644 --- a/configure/os/CONFIG.Common.RTEMS +++ b/configure/os/CONFIG.Common.RTEMS @@ -53,13 +53,12 @@ VALID_BUILDS = Ioc # through the following contortions to get the EPICS flags back. CFLAGS = $(CROSS_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\ $(WARN_CFLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS)\ - $(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS)\ - $(HDEPENDS_CFLAGS) + $(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS) CXXFLAGS = $(CROSS_CXXFLAGS) $(OPT_CXXFLAGS)\ $(DEBUG_CXXFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS)\ $(ARCH_DEP_CXXFLAGS) $(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS)\ - $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS) + $(LIBRARY_SRC_CFLAGS) LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) \ $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS) $(CROSS_LDFLAGS)\ diff --git a/configure/os/CONFIG.solarisCommon.solarisCommon b/configure/os/CONFIG.solarisCommon.solarisCommon index 117957575..e1b944b39 100644 --- a/configure/os/CONFIG.solarisCommon.solarisCommon +++ b/configure/os/CONFIG.solarisCommon.solarisCommon @@ -55,14 +55,9 @@ LOADABLE_SHRLIB_LDFLAGS = -G -h $@ -z text OP_SYS_LDFLAGS += -z ignore -z combreloc -z lazyload -# Filter for getting rid of "invalid white space character in directive" compiler warnings -# when including headers created during win32 build. -#COMPILE_FILTER.c = 2>&1 | $(EPICS_BASE)/configure/tools/filterWarnings.pl -#COMPILE_FILTER.cpp = $(COMPILE_FILTER.c) - # Header dependency file generation command -HDEPENDS_METHOD=CMD -HDEPENDSCMD = $(if $(filter .c,$(suffix $<)),$(COMPILE.c),$(COMPILE.cpp)) -xM1 $< >$*$(DEP) +HDEPENDS_METHOD = CFLAGS +HDEPENDSCFLAGS = -xM1 > $*$(DEP) #-------------------------------------------------- # Allow site overrides diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 9cd899604..c8eb58188 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -15,6 +15,36 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.

Changes between 3.14.x and 3.15.0.x

+ +

Parallel Builds

+ +

+As EPICS sites get computers with more CPUs they report additional bugs in our +parallel build rules. Various issues have been fixed by separating out the build +rules that generate dependency (.d) files, ensuring that they are constructed at +the appropriate time in the build.

+ +

+These rule changes can cause additional warning messages to appear when building +support modules. Where an application provides its own Makefile rules it may now +have to add rules to construct an associated dependency file. In many cases +though the change needed is just to replace a dependency for a +target$(OBJ) with the target$(DEP) so this

+ +
+    myLib$(OBJ): myLib_lex.c
+ +

+becomes

+ +
+    myLib$(DEP): myLib_lex.c
+ +

+To debug build issues assocated with dependency files, use the command make +--debug=m which tells GNUmake to display information about what it is doing +during the first pass when it updates its makefiles.

+

Changes to epicsVersion.h

diff --git a/src/libCom/as/RULES b/src/libCom/as/RULES index c2f2d8a4f..3ec90b630 100644 --- a/src/libCom/as/RULES +++ b/src/libCom/as/RULES @@ -12,7 +12,7 @@ # This is a Makefile fragment, see src/libCom/Makefile. # Extra rule since asLib_lex.c is included by asLib.c -asLib$(OBJ): asLib_lex.c +asLib$(DEP): asLib_lex.c # Ensure that lexer and parser are built before they are needed asLib.c: $(call PATH_FILTER, $(TOOLS)/antelope$(HOSTEXE)) From c4c23c9775d9733fe438da6f0b5e9b9aa9c561e1 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 22 Nov 2011 18:01:55 -0600 Subject: [PATCH 2/2] libCom: One more essential dependency --- src/libCom/as/RULES | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libCom/as/RULES b/src/libCom/as/RULES index 3ec90b630..5ed3edd97 100644 --- a/src/libCom/as/RULES +++ b/src/libCom/as/RULES @@ -17,3 +17,4 @@ asLib$(DEP): asLib_lex.c # Ensure that lexer and parser are built before they are needed asLib.c: $(call PATH_FILTER, $(TOOLS)/antelope$(HOSTEXE)) asLib_lex.c: $(call PATH_FILTER, $(TOOLS)/e_flex$(HOSTEXE)) +asLib_lex.c: $(INSTALL_INCLUDE)/flex.skel.static