summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2015-05-17 15:01:22 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2015-05-26 07:24:47 +0200
commitd21021686b1085d820f912d7dfb5f4a33fa31da6 (patch)
tree93a2680b3ff7bad4af17c2959369d85eac522be6 /bin
parentf8cc0c8ee433acbfb8dbed2f03d21652a8f1ac77 (diff)
downloadptxdist-d21021686b1085d820f912d7dfb5f4a33fa31da6.tar.gz
ptxdist-d21021686b1085d820f912d7dfb5f4a33fa31da6.tar.xz
ptxdist: add option for global parallel building
With this option enabled the make jobserver is shared between outer and inner 'make' to optimize parallel building. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ptxdist36
1 files changed, 28 insertions, 8 deletions
diff --git a/bin/ptxdist b/bin/ptxdist
index 137d76824..638827ea7 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1304,6 +1304,12 @@ parse_first()
-je*)
PTXDIST_PARALLELMFLAGS_EXTERN="-j${arg#*e}"
;;
+ -j)
+ PTXDIST_PARALLELMFLAGS="auto"
+ ;;
+ -j[1-9]*)
+ PTXDIST_PARALLELMFLAGS="-j${arg#*j}"
+ ;;
-l*)
PTXDIST_LOADMFLAGS="-l${arg#*l}"
;;
@@ -2243,8 +2249,6 @@ setup_libs_early() {
#
# out: PTXCONF_* user preferences
# PTXDIST_SRCDIR
-# PTXDIST_PARALLELMFLAGS_INTERN
-# PTXDIST_PARALLELMFLAGS_EXTERN
# PTXDIST_PTXRC
#
setup_config() {
@@ -2304,13 +2308,19 @@ setup_config() {
if [ -n "${PTXCONF_SETUP_NO_PROXY}" ]; then
export no_proxy="${PTXCONF_SETUP_NO_PROXY}"
fi
+}
- #
- # setup PARALLELMFLAGS
- #
-
+#
+# setup parallel building
+#
+# out: PTXDIST_PARALLELMFLAGS
+# PTXDIST_PARALLELMFLAGS_INTERN
+# PTXDIST_PARALLELMFLAGS_EXTERN
+#
+setup_parallel() {
# default no parallel for now
- local pmf_extern="-j1"
+ local pmf_extern=""
+ local pmf_intern=""
local cpus
# this one is for Linux
@@ -2323,7 +2333,14 @@ setup_config() {
elif ! cpus="$(sysctl -n hw.ncpu)" 2> /dev/null; then
cpus=1
fi
- local pmf_intern="-j$(( ${cpus} * 2 ))"
+ local pmf_cpus="-j$(( ${cpus} * 2 ))"
+
+ if [ -z "${PTXDIST_PARALLELMFLAGS}" ]; then
+ pmf_intern="${pmf_cpus}"
+ pmf_extern="-j1"
+ elif [ "${PTXDIST_PARALLELMFLAGS}" == "auto" ]; then
+ PTXDIST_PARALLELMFLAGS="${pmf_cpus}"
+ fi
#
# user may override these, via cmdline
@@ -2609,6 +2626,7 @@ setup_export() {
PTXDIST_PLATFORMSUFFIX \
PTXDIST_PLATFORMCONFIGDIR \
\
+ PTXDIST_PARALLELMFLAGS \
PTXDIST_PARALLELMFLAGS_INTERN \
PTXDIST_LOADMFLAGS \
\
@@ -2642,6 +2660,8 @@ main() {
parse_first &&
# --- vars to config files are setup ---
+ setup_parallel &&
+
setup_auto_version &&
setup_platform &&