Port
bug 815219 - Default to building with all available cores. rs=build system peer port,a=Standard8
--- a/client.mk
+++ b/client.mk
@@ -118,16 +118,23 @@ MOZCONFIG_CONTENT := $(subst ||,$(CR),$(
# lines themselves. It can thus safely be used to replaces normal spaces,
# to then replace newlines with normal spaces. This allows to get a list
# of mozconfig output lines.
MOZCONFIG_OUT_LINES := $(subst $(CR), ,$(subst $(NULL) $(NULL),||,$(MOZCONFIG_CONTENT)))
# Filter-out comments from those lines.
START_COMMENT = \#
MOZCONFIG_OUT_FILTERED := $(filter-out $(START_COMMENT)%,$(MOZCONFIG_OUT_LINES))
+# Automatically add -jN to make flags if not defined. N defaults to number of cores.
+ifeq (,$(findstring -j,$(MOZ_MAKE_FLAGS)))
+ cores=$(shell $(PYTHON) -c 'import multiprocessing; print(multiprocessing.cpu_count())')
+ MOZ_MAKE_FLAGS += -j$(cores)
+endif
+
+
ifndef MOZ_OBJDIR
MOZ_OBJDIR = obj-$(CONFIG_GUESS)
else
# On Windows Pymake builds check MOZ_OBJDIR doesn't start with "/"
ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(MOZ_OBJDIR))))
$(error For Windows Pymake builds, MOZ_OBJDIR must be a Windows [and not MSYS] style path.)
endif
--- a/mail/config/mozconfigs/linux32/debug
+++ b/mail/config/mozconfigs/linux32/debug
@@ -7,18 +7,14 @@ ac_add_options --enable-calendar
. $topsrcdir/build/unix/mozconfig.linux32
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
#Use ccache
ac_add_options --with-ccache=/usr/bin/ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/linux32/l10n-mozconfig
+++ b/mail/config/mozconfigs/linux32/l10n-mozconfig
@@ -14,18 +14,14 @@ ac_add_options --enable-gnomevfs
ac_add_options --disable-gio
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Use ccache
ac_add_options --with-ccache=/usr/bin/ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/linux32/nightly
+++ b/mail/config/mozconfigs/linux32/nightly
@@ -9,18 +9,14 @@ ac_add_options --disable-elf-hack # --en
ac_add_options --enable-calendar
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Use ccache
ac_add_options --with-ccache=/usr/bin/ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/linux32/release
+++ b/mail/config/mozconfigs/linux32/release
@@ -7,15 +7,11 @@ ac_add_options --enable-official-brandin
ac_add_options --enable-calendar
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/linux64/debug
+++ b/mail/config/mozconfigs/linux64/debug
@@ -7,18 +7,14 @@ ac_add_options --enable-calendar
. $topsrcdir/build/unix/mozconfig.linux
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Use ccache
ac_add_options --with-ccache=/usr/bin/ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/linux64/l10n-mozconfig
+++ b/mail/config/mozconfigs/linux64/l10n-mozconfig
@@ -14,18 +14,14 @@ ac_add_options --enable-gnomevfs
ac_add_options --disable-gio
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Use ccache
ac_add_options --with-ccache=/usr/bin/ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/linux64/nightly
+++ b/mail/config/mozconfigs/linux64/nightly
@@ -9,18 +9,14 @@ ac_add_options --disable-elf-hack # --en
ac_add_options --enable-calendar
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Use ccache
ac_add_options --with-ccache=/usr/bin/ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/linux64/release
+++ b/mail/config/mozconfigs/linux64/release
@@ -7,15 +7,11 @@ ac_add_options --enable-official-brandin
ac_add_options --enable-calendar
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-# Enable parallel compiling
-CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/macosx-universal/l10n-mozconfig
+++ b/mail/config/mozconfigs/macosx-universal/l10n-mozconfig
@@ -22,17 +22,13 @@ ac_add_options --enable-calendar
mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
-# Enable parallel compiling
-CONCURRENCY=$(( `sysctl hw.logicalcpu | awk {'print $2'}` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
ac_add_options --with-ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/macosx-universal/nightly
+++ b/mail/config/mozconfigs/macosx-universal/nightly
@@ -22,17 +22,13 @@ ac_add_options --enable-calendar
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Make sure Lightning is also unified
mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
-# Enable parallel compiling
-CONCURRENCY=$(( `sysctl hw.logicalcpu | awk {'print $2'}` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
ac_add_options --with-ccache
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/macosx-universal/release
+++ b/mail/config/mozconfigs/macosx-universal/release
@@ -20,15 +20,11 @@ ac_add_options --enable-calendar
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Make sure Lightning is also unified
mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
-# Enable parallel compiling
-CONCURRENCY=$(( `sysctl hw.logicalcpu | awk {'print $2'}` + 2 ))
-mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"
-
# Run client.py
mk_add_options CLIENT_PY_ARGS="$(cat $topsrcdir/build/client.py-args)"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
--- a/mail/config/mozconfigs/macosx64/debug
+++ b/mail/config/mozconfigs/macosx64/debug
@@ -1,19 +1,16 @@
. $topsrcdir/build/macosx/mozconfig.common
ac_add_options --enable-application=mail
ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
ac_add_options --enable-signmar
ac_add_options --enable-calendar
-# Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j12"
-
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --with-ccache
--- a/mail/config/mozconfigs/win32/debug
+++ b/mail/config/mozconfigs/win32/debug
@@ -7,19 +7,17 @@ ac_add_options --enable-signmar
ac_add_options --enable-calendar
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
-if test -n "${_PYMAKE}"; then
- mk_add_options MOZ_MAKE_FLAGS=-j4
-else
+if test -z "${_PYMAKE}"; then
mk_add_options MOZ_MAKE_FLAGS=-j1
fi
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
. $topsrcdir/build/win32/mozconfig.vs2010-win64
else
. $topsrcdir/build/win32/mozconfig.vs2010
fi
--- a/mail/config/mozconfigs/win32/l10n-mozconfig
+++ b/mail/config/mozconfigs/win32/l10n-mozconfig
@@ -11,19 +11,17 @@ ac_add_options --with-l10n-base=../../l1
ac_add_options --enable-calendar
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
-if test -n "${_PYMAKE}"; then
- mk_add_options MOZ_MAKE_FLAGS=-j4
-else
+if test -z "${_PYMAKE}"; then
mk_add_options MOZ_MAKE_FLAGS=-j1
fi
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
. $topsrcdir/build/win32/mozconfig.vs2010-win64
else
. $topsrcdir/build/win32/mozconfig.vs2010
fi
--- a/mail/config/mozconfigs/win32/nightly
+++ b/mail/config/mozconfigs/win32/nightly
@@ -9,19 +9,17 @@ ac_add_options --enable-profiling
ac_add_options --enable-calendar
# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
-if test -n "${_PYMAKE}"; then
- mk_add_options MOZ_MAKE_FLAGS=-j4
-else
+if test -z "${_PYMAKE}"; then
mk_add_options MOZ_MAKE_FLAGS=-j1
fi
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
. $topsrcdir/build/win32/mozconfig.vs2010-win64
else
. $topsrcdir/build/win32/mozconfig.vs2010
fi
--- a/mail/config/mozconfigs/win64/debug
+++ b/mail/config/mozconfigs/win64/debug
@@ -7,19 +7,17 @@ ac_add_options --enable-application=mail
ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
ac_add_options --enable-signmar
ac_add_options --enable-calendar
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
-if test -n "${_PYMAKE}"; then
- mk_add_options MOZ_MAKE_FLAGS=-j4
-else
+if test -z "${_PYMAKE}"; then
mk_add_options MOZ_MAKE_FLAGS=-j1
fi
. $topsrcdir/build/win64/mozconfig.vs2010
# Set up mapi includes (must be done after visual studio setup)
export INCLUDE=$INCLUDE:/c/Office\ 2010\ Developer\ Resources/Outlook\ 2010\ MAPI\ Headers
mk_export_correct_style INCLUDE
--- a/mail/config/mozconfigs/win64/l10n-mozconfig
+++ b/mail/config/mozconfigs/win64/l10n-mozconfig
@@ -10,19 +10,17 @@ ac_add_options --enable-jemalloc
ac_add_options --enable-profiling
# Build lightning locales
ac_add_options --enable-calendar
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
-if test -n "${_PYMAKE}"; then
- mk_add_options MOZ_MAKE_FLAGS=-j4
-else
+if test -z "${_PYMAKE}"; then
mk_add_options MOZ_MAKE_FLAGS=-j1
fi
. $topsrcdir/build/win64/mozconfig.vs2010
# Set up mapi includes (must be done after visual studio setup)
export INCLUDE=$INCLUDE:/c/Office\ 2010\ Developer\ Resources/Outlook\ 2010\ MAPI\ Headers
mk_export_correct_style INCLUDE