summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2019-09-08 01:41:55 -0400
committerBradley Sepos <[email protected]>2019-09-23 04:18:07 -0400
commit92a56fc25413ed4fc3905ada4b4712367ee43500 (patch)
tree580d864395781840cb9b75d86062cbbd4375cfda
parent6e2747006c6103d370bddd3093c2b9cb0a6dc3ae (diff)
build: make: macosx: Make xcodebuild use number of jobs passed to make.
Fixes #1648. Previously, it was always using the number of jobs in the makefile created by configure.py, either specified by --launch-jobs or the number of active CPU cores.
-rw-r--r--macosx/module.defs4
-rw-r--r--macosx/module.xcodebuild8
-rw-r--r--make/include/tool.defs1
3 files changed, 11 insertions, 2 deletions
diff --git a/macosx/module.defs b/macosx/module.defs
index 20daeef5a..cbf537a4c 100644
--- a/macosx/module.defs
+++ b/macosx/module.defs
@@ -62,7 +62,7 @@ MACOSX.XCODE = $(strip \
EXTERNAL_CONF_ARGS='$(CONF.args)' \
EXTERNAL_DRIVER='$(XCODE.driver)' \
EXTERNAL_GOALS='$(3)' \
- EXTERNAL_JOBS='$(BUILD.jobs)' \
+ EXTERNAL_JOBS='$(MACOSX.JOBS)' \
EXTERNAL_VARS='$(-*-command-variables-*-)' \
\
$(MACOSX.extra_cflags) \
@@ -87,7 +87,7 @@ MACOSX.XCODE_ARCHIVE = $(strip \
EXTERNAL_CONF_ARGS='$(CONF.args)' \
EXTERNAL_DRIVER='$(XCODE.driver)' \
EXTERNAL_GOALS='$(3)' \
- EXTERNAL_JOBS='$(BUILD.jobs)' \
+ EXTERNAL_JOBS='$(MACOSX.JOBS)' \
EXTERNAL_VARS='$(-*-command-variables-*-)' \
\
$(MACOSX.extra_cflags) \
diff --git a/macosx/module.xcodebuild b/macosx/module.xcodebuild
index 960e64562..cb66479d7 100644
--- a/macosx/module.xcodebuild
+++ b/macosx/module.xcodebuild
@@ -52,3 +52,11 @@ $(MACOSX.goals): __goals__
__goals__:
$(call MACOSX.XCODE,external,build,$(MACOSX.goals))
+
+###############################################################################
+
+MACOSX.JOBS := $(shell ps T | $(GREP.exe) "^\s*$(shell echo $$PPID).*$(MAKE)" | $(GREP.exe) -o "\(\-j\|\-\-jobs\)[= ]*[^\s]*" | $(GREP.exe) -o "[0-9][0-9]*")
+ifeq "${MACOSX.JOBS}" ""
+ # fall back to number of jobs specified in makefile created by configure
+ MACOSX.JOBS := $(BUILD.jobs)
+endif
diff --git a/make/include/tool.defs b/make/include/tool.defs
index 6b3995fd0..0e5cfcc05 100644
--- a/make/include/tool.defs
+++ b/make/include/tool.defs
@@ -14,3 +14,4 @@ LN.exe = ln
GIT.exe = git
SED.exe = sed
PKGCONFIG.exe = pkg-config
+GREP.exe = grep