build: add a config option for passing the top-level make jobserver to packages that...
authorFelix Fietkau <nbd@openwrt.org>
Sat, 15 Sep 2012 10:21:24 +0000 (10:21 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 15 Sep 2012 10:21:24 +0000 (10:21 +0000)
SVN-Revision: 33414

Config.in
include/package.mk
include/toplevel.mk

index 403597804f09089ae01a51f27f6ff9159d2b7d79..36ca48881f5573e966167f544c1bf952cc67f839 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -311,12 +311,21 @@ menu "Global build settings"
 
                  If you are unsure, select N.
 
+       config PKG_BUILD_USE_JOBSERVER
+               bool
+               prompt "Use top-level make jobserver for packages"
+               depends on PKG_BUILD_PARALLEL
+               default y
+               help
+                 This passes the main make process jobserver fds to package builds,
+                 enabling full parallelization across different packages
+
        config PKG_BUILD_JOBS
                int
                prompt "Number of package submake jobs (2-512)"
                range 2 512
                default 2
-               depends on PKG_BUILD_PARALLEL
+               depends on PKG_BUILD_PARALLEL && !PKG_BUILD_USE_JOBSERVER
                help
                  The number of jobs (-jX) to pass to packages submake.
 
index 64973b051066803e5bdc5690fa33ec4e352d0cc2..6b3617f7768e347372fd5ee728488dae315ea131 100644 (file)
@@ -15,11 +15,17 @@ PKG_MD5SUM ?= unknown
 PKG_BUILD_PARALLEL ?=
 PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
 
+ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
+  MAKE_J:=$(MAKE_JOBSERVER)
+else
+  MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
+endif
+
 ifeq ($(strip $(PKG_BUILD_PARALLEL)),0)
 PKG_JOBS?=-j1
 else
 PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\
-       $(if $(CONFIG_PKG_BUILD_PARALLEL),-j$(CONFIG_PKG_BUILD_JOBS),-j1),-j1)
+       $(if $(CONFIG_PKG_BUILD_PARALLEL),$(MAKE_J),-j1),-j1)
 endif
 
 include $(INCLUDE_DIR)/prereq.mk
index d37ddb9171d1a9b4c5390f411fabc1e68be0e0e9..ba5af9c1557bd64b0520e6e96ee2f0ea912a83e8 100644 (file)
@@ -148,7 +148,7 @@ prereq:: prepare-tmpinfo .config
                        echo "WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!"; \
                fi \
        )
-       @+$(SUBMAKE) -r $@
+       @+$(SUBMAKE) -r $@ MAKE_JOBSERVER="$(filter --jobserver% -j,$(MAKEFLAGS))"
 
 help:
        cat README