aboutsummaryrefslogtreecommitdiffstats
path: root/include/package.mk
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-09-15 10:21:24 +0000
committerFelix Fietkau <nbd@openwrt.org>2012-09-15 10:21:24 +0000
commitbe6f4376498d15b3465027bd78de3a878a862023 (patch)
tree1d3d8209907a82535a97acb7ae0efbc75b870112 /include/package.mk
parented14ffc7da8f2e544c3af0c943e651510cf8341d (diff)
downloadupstream-be6f4376498d15b3465027bd78de3a878a862023.tar.gz
upstream-be6f4376498d15b3465027bd78de3a878a862023.tar.bz2
upstream-be6f4376498d15b3465027bd78de3a878a862023.zip
build: add a config option for passing the top-level make jobserver to packages that have parallel build enabled, significantly improves parallelization and gets rid of CPU overcommit during intra-package parallel builds
SVN-Revision: 33414
Diffstat (limited to 'include/package.mk')
-rw-r--r--include/package.mk8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/package.mk b/include/package.mk
index 64973b0510..6b3617f776 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -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