This will now adjust MAKETUNING to not launch more processes
than MAX_PARALLELISM. Handy to limit builds that use a lot of memory.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Cleanup environment from any variables
unexport BUILD_ARCH BUILD_PLATFORM BUILDTARGET CROSSTARGET TOOLCHAIN TOOLS_DIR
# Cleanup environment from any variables
unexport BUILD_ARCH BUILD_PLATFORM BUILDTARGET CROSSTARGET TOOLCHAIN TOOLS_DIR
-MAKETUNING = -j $(DEFAULT_PARALLELISM)
+PARALLELISM = $(shell echo $$( \
+ if [ -n "$(MAX_PARALLELISM)" ] && [ $(MAX_PARALLELISM) -lt $(DEFAULT_PARALLELISM) ]; then \
+ echo $(MAX_PARALLELISM); \
+ else \
+ echo $(DEFAULT_PARALLELISM); \
+ fi) \
+)
+
+MAKETUNING = -j $(PARALLELISM)
ifeq "$(BUILD_ARCH)" "aarch64"
IS_64BIT = 1
ifeq "$(BUILD_ARCH)" "aarch64"
IS_64BIT = 1
# The compiler uses a lot of memory to compile boost, hence we reduce
# the total number of processes a little bit to be able to build on
# smaller machines
# The compiler uses a lot of memory to compile boost, hence we reduce
# the total number of processes a little bit to be able to build on
# smaller machines
-override MAKETUNING = -j$(shell echo $$(( $(SYSTEM_MEMORY) / 512)))
+MAX_PARALLELISM = $(shell echo $$(( $(SYSTEM_MEMORY) / 512)))
CONFIGURE_OPTIONS = \
--prefix=/usr \
CONFIGURE_OPTIONS = \
--prefix=/usr \