Implemented experimental parallel building support for tools and libraries

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@27823 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2009-02-09 11:23:24 +00:00
parent e8116c0433
commit 17d81326f5
7 changed files with 145 additions and 4 deletions

View file

@ -1,3 +1,24 @@
2009-02-09 Nicola Pero <nicola.pero@meta-innovation.com>
Added experimental support for parallel building of libraries and
tools. We can extend it to more project types once the concept is
proven to work.
* configure.ac (--enable-parallel-building): New experimental
option, disabled by default.
* configure: Regenerated.
* config-noarch.make.in (GNUSTEP_MAKE_PARALLEL_BUILDING): New
variable.
* rules.make (.NOTPARALLEL): Do not create this rule when parallel
building is enabled, and we are doing the final compile sub-make
invocation that is expected to build in parallel.
* Instance/library.make (internal-library-all_): When doing a
parallel build, delegate the building of the final object file to
a sub-make 'compile' invocation that can safely build in parallel.
(internal-library-compile): New target executed in the parallel
invocation.
* Instance/tool.make (internal-tool-all_): Same.
(internal-tool-compile): Same.
2009-02-08 Nicola Pero <nicola.pero@meta-innovation.com>
* gnustep-make-help: Use _MAKE_ instead of make when referring to

View file

@ -253,8 +253,25 @@ endif
#
# Compilation targets
#
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Standard building
internal-library-all_:: $(GNUSTEP_OBJ_DIR) \
$(GNUSTEP_OBJ_DIR)/$(VERSION_LIBRARY_FILE)
else
# Parallel building. The actual compilation is delegated to a
# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
# That sub-make invocation will compile files in parallel.
internal-library-all_:: $(GNUSTEP_OBJ_DIR)
$(ECHO_NOTHING)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
internal-library-compile \
GNUSTEP_TYPE=$(GNUSTEP_TYPE) \
GNUSTEP_INSTANCE=$(GNUSTEP_INSTANCE) \
GNUSTEP_OPERATION=$(GNUSTEP_OPERATION) \
GNUSTEP_BUILD_DIR="$(GNUSTEP_BUILD_DIR)" \
_GNUSTEP_MAKE_PARALLEL=yes$(END_ECHO)
internal-library-compile: $(GNUSTEP_OBJ_DIR)/$(VERSION_LIBRARY_FILE)
endif
$(GNUSTEP_OBJ_DIR)/$(VERSION_LIBRARY_FILE): $(OBJ_FILES_TO_LINK)
$(ECHO_LINKING)$(LIB_LINK_CMD)$(END_ECHO)

View file

@ -60,8 +60,25 @@ endif
#
# Compilation targets
#
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Standard building
internal-tool-all_:: $(GNUSTEP_OBJ_DIR) \
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
else
# Parallel building. The actual compilation is delegated to a
# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
# That sub-make invocation will compile files in parallel.
internal-tool-all_:: $(GNUSTEP_OBJ_DIR)
$(ECHO_NOTHING)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
internal-tool-compile \
GNUSTEP_TYPE=$(GNUSTEP_TYPE) \
GNUSTEP_INSTANCE=$(GNUSTEP_INSTANCE) \
GNUSTEP_OPERATION=$(GNUSTEP_OPERATION) \
GNUSTEP_BUILD_DIR="$(GNUSTEP_BUILD_DIR)" \
_GNUSTEP_MAKE_PARALLEL=yes$(END_ECHO)
internal-tool-compile: $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
endif
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_FILES_TO_LINK)
$(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) $(CC_LDFLAGS) -o $(LDOUT)$@ \

View file

@ -152,3 +152,13 @@ ifeq ("@GNUSTEP_MULTI_PLATFORM@","")
GNUSTEP_HOST_VENDOR = @clean_target_vendor@
GNUSTEP_HOST_OS = @clean_target_os@
endif
# Enables of disables parallel building support. When parallel
# building support is disabled, the target .NOTPARALLEL: is used in
# all make invocations of gnustep-make to make sure a traditional non
# parallel build is always performed. When parallel building support
# is enabled, all make invocations are still .NOTPARALLEL except for
# an additional make invocation which is performed when compiling an
# executable or library; that invocation does not use .NOTPARALLEL and
# will compile all the files of the executable or library in parallel.
GNUSTEP_MAKE_PARALLEL_BUILDING = @GNUSTEP_MAKE_PARALLEL_BUILDING@

41
configure vendored
View file

@ -726,6 +726,7 @@ OBJCFLAGS
GNUMAKE
MAKE_WITH_INFO_FUNCTION
GNUSTEP_STRIP_MAKEFILES
GNUSTEP_MAKE_PARALLEL_BUILDING
GNUSTEP_MAKE_VERSION
GNUSTEP_MAKE_MAJOR_VERSION
GNUSTEP_MAKE_MINOR_VERSION
@ -1429,6 +1430,16 @@ Optional Features:
gain is quite small, so you probably don't want to strip makefiles.
--enable-parallel-building
Enable experimental support for parallel building. You can request
parallel building of a project by using the '-j N' flag for make
(where N is a number, eg, '-j 4'). This is normally ignored by
gnustep-make which by default does not support parallel building.
If you enable support for parallel building here, gnustep-make
will parallelize the compilation step. This feature is
experimental. Please only use it for testing it.
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
@ -6256,6 +6267,33 @@ echo "${ECHO_T}no" >&6; };
fi
#-------------------------------------------------
# Determine if we should enable parallel building
#-------------------------------------------------
{ echo "$as_me:$LINENO: checking if we should enable support for parallel building" >&5
echo $ECHO_N "checking if we should enable support for parallel building... $ECHO_C" >&6; }
# Check whether --enable-parallel-building was given.
if test "${enable_parallel_building+set}" = set; then
enableval=$enable_parallel_building; ac_cv_parallel_building=$enableval
else
ac_cv_parallel_building="no"
fi
if test "$ac_cv_parallel_building" = "yes"; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; };
GNUSTEP_MAKE_PARALLEL_BUILDING="yes"
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; };
GNUSTEP_MAKE_PARALLEL_BUILDING="no"
fi
#--------------------------------------------------------------------
# Record the version
#--------------------------------------------------------------------
@ -7183,6 +7221,7 @@ OBJCFLAGS!$OBJCFLAGS$ac_delim
GNUMAKE!$GNUMAKE$ac_delim
MAKE_WITH_INFO_FUNCTION!$MAKE_WITH_INFO_FUNCTION$ac_delim
GNUSTEP_STRIP_MAKEFILES!$GNUSTEP_STRIP_MAKEFILES$ac_delim
GNUSTEP_MAKE_PARALLEL_BUILDING!$GNUSTEP_MAKE_PARALLEL_BUILDING$ac_delim
GNUSTEP_MAKE_VERSION!$GNUSTEP_MAKE_VERSION$ac_delim
GNUSTEP_MAKE_MAJOR_VERSION!$GNUSTEP_MAKE_MAJOR_VERSION$ac_delim
GNUSTEP_MAKE_MINOR_VERSION!$GNUSTEP_MAKE_MINOR_VERSION$ac_delim
@ -7195,7 +7234,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 61; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 62; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View file

@ -1525,6 +1525,35 @@ else
fi
AC_SUBST(GNUSTEP_STRIP_MAKEFILES)
#-------------------------------------------------
# Determine if we should enable parallel building
#-------------------------------------------------
AC_MSG_CHECKING([if we should enable support for parallel building])
AC_ARG_ENABLE(parallel-building, [
--enable-parallel-building
Enable experimental support for parallel building. You can request
parallel building of a project by using the '-j N' flag for make
(where N is a number, eg, '-j 4'). This is normally ignored by
gnustep-make which by default does not support parallel building.
If you enable support for parallel building here, gnustep-make
will parallelize the compilation step. This feature is
experimental. Please only use it for testing it.
],
ac_cv_parallel_building=$enableval,
ac_cv_parallel_building="no")
if test "$ac_cv_parallel_building" = "yes"; then
AC_MSG_RESULT(yes);
GNUSTEP_MAKE_PARALLEL_BUILDING="yes"
else
AC_MSG_RESULT(no);
GNUSTEP_MAKE_PARALLEL_BUILDING="no"
fi
AC_SUBST(GNUSTEP_MAKE_PARALLEL_BUILDING)
#--------------------------------------------------------------------
# Record the version
#--------------------------------------------------------------------

View file

@ -346,7 +346,7 @@ ALL_CPLISTFLAGS += $(ADDITIONAL_CPLISTFLAGS) $(AUXILIARY_CPLISTFLAGS)
# can not be automatically imported and you might want to declare them
# specially. For those symbols, this define is handy.
#
ifeq ($(BUILD_DLL),yes)
ifeq ($(BUILD_DLL), yes)
ALL_CPPFLAGS += -DGNUSTEP_WITH_DLL
endif
@ -362,9 +362,17 @@ VPATH = .
# gnustep-make supports inherently sequential targets such as
# 'before-install' and 'after-install' which make it really difficult
# to support parallel building. At the moment, parallel building is
# not supported, so make sure to disable it.
# to support parallel building. At the moment, by default parallel
# building is not supported. We only enable it when
# GNUSTEP_MAKE_PARALLEL_BUILDING = yes and even then only in specific
# sub-invocations of make tagged with _GNUSTEP_MAKE_PARALLEL = yes.
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
.NOTPARALLEL:
else
ifneq ($(_GNUSTEP_MAKE_PARALLEL), yes)
.NOTPARALLEL:
endif
endif
# Disable all built-in suffixes for performance.
.SUFFIXES: