make.sh: Introduce MAX_PARALLELISM
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 Mar 2019 11:51:08 +0000 (11:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 Mar 2019 11:51:08 +0000 (11:51 +0000)
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>
lfs/Config
lfs/boost

index be6725b..2bb0f28 100644 (file)
 # 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
index e0b550c..50a3a46 100644 (file)
--- a/lfs/boost
+++ b/lfs/boost
@@ -38,7 +38,7 @@ CXXFLAGS  += -O3 -fno-strict-aliasing
 # 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 \