From 7691a1bfe73067cb2f3ad3470d0000faf029a24f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 4 Mar 2019 11:51:08 +0000 Subject: [PATCH] make.sh: Introduce MAX_PARALLELISM 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 --- lfs/Config | 10 +++++++++- lfs/boost | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lfs/Config b/lfs/Config index be6725bc84..2bb0f28354 100644 --- a/lfs/Config +++ b/lfs/Config @@ -33,7 +33,15 @@ # 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 diff --git a/lfs/boost b/lfs/boost index e0b550c30e..50a3a46746 100644 --- 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 \ -- 2.39.2