automatically set PARALLEL_JOBS when BR2_JLEVEL is 0
authorNathan Lynch <ntl@pobox.com>
Sat, 16 Jun 2012 09:37:17 +0000 (09:37 +0000)
committerPeter Korsgaard <jacmet@sunsite.dk>
Sun, 24 Jun 2012 09:11:07 +0000 (11:11 +0200)
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>
Config.in
package/Makefile.in

index 83f64bb67898827c4dd5ff16a6d744a0d0dd97b3..925c2474cb8b1cf10f3441121049a7cd93448b01 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -178,10 +178,12 @@ config BR2_DEBIAN_MIRROR
 endmenu
 
 config BR2_JLEVEL
-       int "Number of jobs to run simultaneously"
-       default "2"
+       int "Number of jobs to run simultaneously (0 for auto)"
+       default "0"
        help
-         Number of jobs to run simultaneously
+         Number of jobs to run simultaneously.  If 0, determine
+         automatically according to number of CPUs on the host
+         system.
 
 config BR2_CCACHE
        bool "Enable compiler cache"
index be83ada1c321dabac9ed32a6b5253e3a81a9c9b2..1d43aef5c2e06fe1dc9088f0b17459f15a191079 100644 (file)
@@ -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)