Changes for GNU make -j option (multiple jobs).

This commit is contained in:
Janet B. Anderson
2007-10-24 21:21:54 +00:00
parent e659918bcf
commit 9d2b8ece7b
13 changed files with 100 additions and 10 deletions

View File

@@ -19,5 +19,7 @@ DIRS += config
endif
DIRS += configure src
src_DEPEND_DIRS = configure
include $(TOP)/configure/RULES_TOP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,6 +13,31 @@
<!-- Insert new items below here ... -->
<h4>GNU make multiple jobs now supported</h4>
<p>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:
<blockquote>
<pre>
DIRS = configure src
src_DEPEND_DIRS = configure
</pre>
</blockquote>
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.
<h4>Breakpoint tables</h4>
<p>Some sites may be using breakpoint tables that are not monotonic in one

View File

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

View File

@@ -26,5 +26,5 @@ makeBpt_SRCS=makeBpt
include $(TOP)/configure/RULES
$(COMMON_DBDS): $(INSTALL_PROD)
$(COMMON_DBDS): $(MAKEBPT)

View File

@@ -14,6 +14,8 @@ include $(TOP)/configure/CONFIG
DIRS = build example
example_DEPEND_DIRS = build
include $(TOP)/configure/RULES_DIRS

View File

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

View File

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

View File

@@ -14,5 +14,7 @@ include $(TOP)/configure/CONFIG
DIRS = antelope flex
flex_DEPEND_DIRS += antelope
include $(TOP)/configure/RULES_DIRS