make it possible to build without the obnoxious forced -j to make

Rework --with-parallelism to not add any extra -j to make if 0
or --without is used. This requires explicit -j usage, which
- builds even compilerplugins in parallel
- builds 'make -C sw/' in parallel (since you don't forget the -j)
- avoids jobserver disabling if -j is explicitly passed to the toplevel make

IMO this is just a relic of the old build system and the option should
be dumped altogether, but I don't feel like arguing right now.

Change-Id: I71479391bcfc84aa5e9fd9696880702da496d45c
This commit is contained in:
Luboš Luňák 2014-03-23 15:58:00 +01:00
parent f7859e5282
commit f605cfc73d
2 changed files with 16 additions and 13 deletions

View file

@ -55,6 +55,8 @@ include $(BUILDDIR)/config_$(gb_Side).mk
export GMAKE_OPTIONS?=-r$(if $(verbose)$(VERBOSE),,s)$(value $(MAKEFLAGS))
PARALLELISM_OPTION := $(if $(filter-out 0,$(PARALLELISM)),-j $(PARALLELISM),)
#
# Partial Build
#
@ -62,13 +64,13 @@ define gb_Top_GbuildModuleRules
.PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(1).subsequentcheck
$(1): bootstrap fetch
cd $(SRCDIR)/$(2) && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
cd $(SRCDIR)/$(2) && $(GNUMAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS)
$(1).build $(1).check $(1).clean $(1).showdeliverables $(1).subsequentcheck:
cd $(SRCDIR)/$(2) && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
cd $(SRCDIR)/$(2) && $(GNUMAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
$(1).all: bootstrap fetch
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) $(if $(CROSS_COMPILING),,$(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1))
$(GNUMAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) $(if $(CROSS_COMPILING),,$(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1))
endef
@ -121,7 +123,7 @@ gbuild_TARGETS := AllLangHelp \
# build a generic gbuild target
$(foreach target,$(gbuild_TARGETS),$(target)_% $(foreach module,$(gbuild_modules),$(target)_$(module)/%)):
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
$(GNUMAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
#
# Clean
@ -221,15 +223,15 @@ build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset)
ifneq ($(filter-out WNT MACOSX IOS ANDROID,$(OS)),)
mkdir -p $(INSTDIR) && install-gdb-printers -a $(INSTDIR) -c
endif
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
$(GNUMAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
ifeq ($(OS),IOS)
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) ios
$(GNUMAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios
endif
build-non-l10n-only build-l10n-only build-nocheck check debugrun help slowcheck translations unitcheck subsequentcheck packageinfo: build
cross-toolset: bootstrap fetch
$(GNUMAKE) gb_Side=build -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools
$(GNUMAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools
#

View file

@ -12373,7 +12373,7 @@ AC_MSG_CHECKING([for number of processors to use])
# plain --with-parallelism is just the default
if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
if test "$with_parallelism" = "no"; then
PARALLELISM=1
PARALLELISM=0
else
PARALLELISM=$with_parallelism
fi
@ -12397,10 +12397,7 @@ else
esac
# If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
# unexpected format, 'wc -l' will have returned 0.
if test "$PARALLELISM" -eq 0; then
PARALLELISM=1
fi
# unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
fi
fi
@ -12414,7 +12411,11 @@ if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
fi
fi
AC_MSG_RESULT([$PARALLELISM])
if test $PARALLELISM -eq 0; then
AC_MSG_RESULT([explicit make -j option needed])
else
AC_MSG_RESULT([$PARALLELISM])
fi
AC_SUBST(PARALLELISM)
#