aboutsummaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorGravatar Nathan Lynch <ntl@pobox.com>2012-06-16 09:37:17 +0000
committerGravatar Peter Korsgaard <jacmet@sunsite.dk>2012-06-24 11:11:07 +0200
commit5016aa02fb51dbd73461f65ed8c7d9b52539a988 (patch)
tree4ac7062feff600396b5867885e126d09db4e4c41 /package
parentf6b26ea4251c7bcec36a26e7059832789a3f5938 (diff)
downloadbuildroot-5016aa02fb51dbd73461f65ed8c7d9b52539a988.tar.gz
buildroot-5016aa02fb51dbd73461f65ed8c7d9b52539a988.tar.bz2
automatically set PARALLEL_JOBS when BR2_JLEVEL is 0
When BR2_JLEVEL is 0, set PARALLEL_JOBS to double the number of CPUs detected. This allows one to more or less fully utilize the host system without manually tuning the configuration. Also make 0 the default value for BR2_JLEVEL. Signed-off-by: Nathan Lynch <ntl@pobox.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package')
-rw-r--r--package/Makefile.in8
1 files changed, 8 insertions, 0 deletions
diff --git a/package/Makefile.in b/package/Makefile.in
index be83ada1c3..1d43aef5c2 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -6,7 +6,15 @@ HOSTMAKE=$(MAKE)
endif
HOSTMAKE :=$(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make)
+# If BR2_LEVEL is 0, scale the maximum concurrency with the number of
+# CPUs. A coefficient of 2 is used in order to keep processors busy
+# while waiting on I/O.
+ifeq ($(BR2_JLEVEL),0)
+PARALLEL_JOBS:=$(shell echo \
+ $$((2 * `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
+else
PARALLEL_JOBS:=$(BR2_JLEVEL)
+endif
MAKE1:=$(HOSTMAKE) -j1
MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)