From 9d2b8ece7ba160d3ee9ed7b97df705211ec555ba Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Wed, 24 Oct 2007 21:21:54 +0000 Subject: [PATCH] Changes for GNU make -j option (multiple jobs). --- Makefile | 2 ++ configure/CONFIG_COMMON | 4 ++-- configure/RULES.Db | 2 +- configure/RULES_ARCHS | 18 ++++++++++++++++++ configure/RULES_DIRS | 8 ++++++++ configure/tools/makeMakefileInclude.pl | 10 +++++----- documentation/RELEASE_NOTES.html | 25 +++++++++++++++++++++++++ src/Makefile | 23 +++++++++++++++++++++++ src/bpt/Makefile | 2 +- src/cas/Makefile | 2 ++ src/libCom/Makefile | 6 +++++- src/makeBaseApp/top/Makefile | 6 ++++++ src/toolsComm/Makefile | 2 ++ 13 files changed, 100 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 711bf6824..30e227ec8 100644 --- a/Makefile +++ b/Makefile @@ -19,5 +19,7 @@ DIRS += config endif DIRS += configure src +src_DEPEND_DIRS = configure + include $(TOP)/configure/RULES_TOP diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON index 994bbee44..e0e14351f 100644 --- a/configure/CONFIG_COMMON +++ b/configure/CONFIG_COMMON @@ -136,7 +136,7 @@ ALL_SRC_DIRS = $(OS_SRC_DIRS) $(GENERIC_SRC_DIRS) INSTALL_INCLUDES += \ -I$(INSTALL_INCLUDE)/os/$(OS_CLASS) \ -I$(INSTALL_INCLUDE) -GENERIC_SRC_INCLUDES = $(addprefix -I, $(GENERIC_SRC_DIRS)) +SRC_INCLUDES = -I$(COMMON_DIR) $(addprefix -I, $(wildcard $(ALL_SRC_DIRS))) #-------------------------------------------------- # Target filename definitions @@ -260,7 +260,7 @@ OP_SYS_LDFLAGS += $(LDFLAGS_$(COMMANDLINE_LIBRARY)) #-------------------------------------------------- # Flags -INCLUDES = -I. $(GENERIC_SRC_INCLUDES) $(INSTALL_INCLUDES) $(RELEASE_INCLUDES)\ +INCLUDES = -I. $(SRC_INCLUDES) $(INSTALL_INCLUDES) $(RELEASE_INCLUDES)\ $(TARGET_INCLUDES) $(USR_INCLUDES) $(OP_SYS_INCLUDES) $($(BUILD_CLASS)_INCLUDES) CFLAGS = $(CONFORM_CFLAGS) $($(BUILD_CLASS)_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\ diff --git a/configure/RULES.Db b/configure/RULES.Db index bf46dd5cb..6269c4e19 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -23,7 +23,7 @@ vpath bpt%.data $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR) # dbExpand INSTALL_DBDFLAGS += -I $(INSTALL_LOCATION)/dbd DBDFLAGS = $(USR_DBDFLAGS) -I . -I .. $(INSTALL_DBDFLAGS) $(RELEASE_DBDFLAGS) -DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) -I. $(GENERIC_SRC_INCLUDES) +DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) -I. $(SRC_INCLUDES) DBFLAGS += -I$(COMMON_DIR) ##################################################### Targets diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index e18034c38..e3fcd5d31 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -34,6 +34,24 @@ cleanArchTargets = $(foreach arch,$(BUILD_ARCHS), clean$(DIVIDER)$(arch)) buildDirs = $(addprefix O.,$(BUILD_ARCHS)) +#************************************************************************* +# Create epics_host_arch dependancies for GNU make -j option +# Only works with GNU make 3.80 or later (uses eval function) +# Needed in dirs where EPICS_HOST_ARCH build creates a tool used in +# cross arch builds + +CROSS_ARCHS += $(CROSS1) $(CROSS2) + +define DEP_template +$(2): $$(EPICS_HOST_ARCH) +$(1)$$(DIVIDER)$(2): $(1)$$(DIVIDER)$$(EPICS_HOST_ARCH) +endef + +$(foreach action, $(ACTIONS), $(foreach arch, $(CROSS_ARCHS), \ + $(eval $(call DEP_template,$(action),$(arch))))) + +#************************************************************************* + $(actionArchTargets) : $(buildDirs) O.Common $(MAKE) -C O.$(archPart) -f ../Makefile TOP=$(TOP)/.. T_A=$(archPart) $(actionPart) diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index f597a5c83..f516aa4e0 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -36,6 +36,14 @@ all : install rebuild : clean install +# Create directory dependancies lines for GNU make -j option +# Only works with GNU make 3.80 or later (uses eval function) +define DEP_template +$(1): $$($(1)_DEPEND_DIRS) +$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2),$$(ddir))) +endef +$(foreach action, $(ACTIONS), $(foreach dir, $(DIRS),$(eval $(call DEP_template,$(dir),$(action))))) + $(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets) : $(MAKE) -C $(dirPart) $(actionArchPart) diff --git a/configure/tools/makeMakefileInclude.pl b/configure/tools/makeMakefileInclude.pl index f0125c030..7fd879948 100755 --- a/configure/tools/makeMakefileInclude.pl +++ b/configure/tools/makeMakefileInclude.pl @@ -109,7 +109,7 @@ foreach $name ( @nameList ) { print OUT " \$(firstword \$(wildcard \$(addsuffix /\$(LIB_PREFIX)\$(lib).\*,\\\n"; print OUT " \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))\\\n"; print OUT " \$(addsuffix /\$(LIB_PREFIX)\$(lib)\$(LIB_SUFFIX),\\\n"; - print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS))\/)))\n"; + print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))))\n"; print OUT "${name}\$(EXE): \$(${name}_OBJSNAME) \$(${name}_RESS) \$(${name}_DEPLIBS)\n"; print OUT "endif\n"; print OUT "\n"; @@ -124,12 +124,12 @@ foreach $name ( @nameList ) { print OUT " \$(firstword \$(wildcard \$(addsuffix /\$(LIB_PREFIX)\$(lib).\*,\\\n"; print OUT " \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))\\\n"; print OUT " \$(addsuffix /\$(LIB_PREFIX)\$(lib)\$(LIB_SUFFIX),\\\n"; - print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS))\/)))\n"; + print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))))\n"; print OUT "${name}_DLL_DEPLIBS=\$(foreach lib, \$(${name}_DLL_LIBS),\\\n"; print OUT " \$(firstword \$(wildcard \$(addsuffix /\$(LIB_PREFIX)\$(lib).\*,\\\n"; print OUT " \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))\\\n"; print OUT " \$(addsuffix /\$(LIB_PREFIX)\$(lib)\$(LIB_SUFFIX),\\\n"; - print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS))\/)))\n"; + print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))))\n"; print OUT "\$(LIB_PREFIX)${name}\$(LIB_SUFFIX):\$(${name}_OBJSNAME) \$(${name}_RESS)\n"; print OUT "\$(LIB_PREFIX)${name}\$(LIB_SUFFIX):\$(${name}_DEPLIBS)\n"; print OUT "\$(LIB_PREFIX)${name}\$(SHRLIB_SUFFIX):\$(${name}_OBJSNAME) \$(${name}_RESS)\n"; @@ -147,12 +147,12 @@ foreach $name ( @nameList ) { print OUT " \$(firstword \$(wildcard \$(addsuffix /\$(LIB_PREFIX)\$(lib).\*,\\\n"; print OUT " \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))\\\n"; print OUT " \$(addsuffix /\$(LIB_PREFIX)\$(lib)\$(LIB_SUFFIX),\\\n"; - print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS))\/)))\n"; + print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))))\n"; print OUT "${name}_DLL_DEPLIBS=\$(foreach lib, \$(${name}_DLL_LIBS),\\\n"; print OUT " \$(firstword \$(wildcard \$(addsuffix /\$(LIB_PREFIX)\$(lib).\*,\\\n"; print OUT " \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))\\\n"; print OUT " \$(addsuffix /\$(LIB_PREFIX)\$(lib)\$(LIB_SUFFIX),\\\n"; - print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS))\/)))\n"; + print OUT " \$(firstword \$(\$(lib)_DIR) \$(SHRLIB_SEARCH_DIRS)))))\n"; print OUT "\$(LOADABLE_SHRLIB_PREFIX)${name}\$(LOADABLE_SHRLIB_SUFFIX):\$(${name}_OBJSNAME) \$(${name}_RESS)\n"; print OUT "\$(LOADABLE_SHRLIB_PREFIX)${name}\$(LOADABLE_SHRLIB_SUFFIX):\$(${name}_DEPLIBS)\n"; print OUT "\$(LOADABLE_SHRLIB_PREFIX)${name}\$(LOADABLE_SHRLIB_SUFFIX):\$(${name}_DLL_DEPLIBS)\n"; diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 8aef08242..b32e93e21 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,31 @@ +

GNU make multiple jobs now supported

+ +

The "-j jobs" option is now supported for users of GNU make version 3.80 +or later. The configure changes for this option use the eval function which +does not exist in earlier versions of GNU make. The -j option should speed +up builds by allowing multiple jobs (commands) to run simultanaously. Builds +will still work as usual when the -j option is NOT present, but builds with +earlier versions of GNU make will fail if -j is used. The -j option has been +tested on this version of EPICS base but may not work for extensions or ioc +applications unless dependancies are specified correctly. New DIRS directory +dependancy specifications to determine directory build order are required +for -j. For example, if we have 2 DIRS directories, src and configure, in +a Makefile and the configure directory must build before the src directory, +the Makefile should contain: +

+
+ DIRS = configure src
+ src_DEPEND_DIRS = configure
+
+
+ +The directory dependancy specifications are only needed when -j is used. If +-j is not used, the order of directories in the DIRS definition will determine +the build order. +

Breakpoint tables

Some sites may be using breakpoint tables that are not monotonic in one diff --git a/src/Makefile b/src/Makefile index c4491223c..46f3d5448 100644 --- a/src/Makefile +++ b/src/Makefile @@ -39,5 +39,28 @@ DIRS += makeBaseApp DIRS += excas DIRS += makeBaseExt +ca_DEPEND_DIRS = libCom +RTEMS_DEPEND_DIRS = libCom +libCom/test_DEPEND_DIRS = libCom RTEMS +toolsComm_DEPEND_DIRS = libCom +dbStatic_DEPEND_DIRS = toolsComm +registry_DEPEND_DIRS = dbStatic +bpt_DEPEND_DIRS = dbStatic +db_DEPEND_DIRS = bpt ca +db/test_DEPEND_DIRS = db +as_DEPEND_DIRS = db +util_DEPEND_DIRS = ca +dbtools_DEPEND_DIRS = db +catools_DEPEND_DIRS = ca +rsrv_DEPEND_DIRS = as +rec_DEPEND_DIRS = as registry +dev_DEPEND_DIRS = rec +misc_DEPEND_DIRS = rsrv rec +vxWorks_DEPEND_DIRS = ca +softIoc_DEPEND_DIRS = dev misc dbtools +gdd_DEPEND_DIRS = libCom +cas_DEPEND_DIRS = ca gdd +excas_DEPEND_DIRS = cas as registry + include $(TOP)/configure/RULES_DIRS diff --git a/src/bpt/Makefile b/src/bpt/Makefile index 389ca73a7..28915d8c1 100644 --- a/src/bpt/Makefile +++ b/src/bpt/Makefile @@ -26,5 +26,5 @@ makeBpt_SRCS=makeBpt include $(TOP)/configure/RULES -$(COMMON_DBDS): $(INSTALL_PROD) +$(COMMON_DBDS): $(MAKEBPT) diff --git a/src/cas/Makefile b/src/cas/Makefile index 662b12400..7206ff531 100644 --- a/src/cas/Makefile +++ b/src/cas/Makefile @@ -14,6 +14,8 @@ include $(TOP)/configure/CONFIG DIRS = build example +example_DEPEND_DIRS = build + include $(TOP)/configure/RULES_DIRS diff --git a/src/libCom/Makefile b/src/libCom/Makefile index 722ef2252..207085cb3 100644 --- a/src/libCom/Makefile +++ b/src/libCom/Makefile @@ -303,6 +303,11 @@ ERR_S_FILES += $(TOP)/src/gdd/gddAppFuncTable.h include $(TOP)/configure/RULES +osdAssert$(OBJ): $(COMMON_DIR)/epicsVersion.h +epicsTime$(OBJ): $(COMMON_DIR)/epicsVersion.h +osdNetIntf$(OBJ): $(COMMON_DIR)/epicsVersion.h +osdSock$(OBJ): $(COMMON_DIR)/epicsVersion.h + envData.c: $(LIBCOM)/env/envDefs.h $(LIBCOM)/env/bldEnvData.pl \ $(CONFIG)/CONFIG_ENV $(CONFIG)/CONFIG_SITE_ENV $(PERL) $(LIBCOM)/env/bldEnvData.pl $(CONFIG) @@ -316,4 +321,3 @@ $(COMMON_DIR)/epicsVersion.h: $(CONFIG)/CONFIG_BASE_VERSION $(CONFIG)/CONFIG_SIT clean:: @$(RM) errSymTbl.c envData.c -inc depends: $(INSTALL_LIBS) diff --git a/src/makeBaseApp/top/Makefile b/src/makeBaseApp/top/Makefile index bb27ec020..f5cae7c7c 100644 --- a/src/makeBaseApp/top/Makefile +++ b/src/makeBaseApp/top/Makefile @@ -6,4 +6,10 @@ DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *App)) DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *app)) DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard iocBoot)) DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard iocboot)) + +define DIR_template + $(1)_DEPEND_DIRS = configure +endef +$(foreach dir, $(filter-out configure,$(DIRS)),$(eval $(call DIR_template,$(dir)))) + include $(TOP)/configure/RULES_TOP diff --git a/src/toolsComm/Makefile b/src/toolsComm/Makefile index 2fbad7b00..ef3e0c0ce 100644 --- a/src/toolsComm/Makefile +++ b/src/toolsComm/Makefile @@ -14,5 +14,7 @@ include $(TOP)/configure/CONFIG DIRS = antelope flex +flex_DEPEND_DIRS += antelope + include $(TOP)/configure/RULES_DIRS