From ca655b61a769cce182ff5b9741e690ccde6ecade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 25 May 2024 19:37:05 +0200 Subject: [PATCH] build: fix -j propagation to ninja The expression containing MAKEFLAGS must be evaluated in a deferred context for the propagation to work in GNU make. Otherwise, regardless of the -j value passed to make, ninja will spawn a potentially greater number of parallel compilation tasks, which can quickly exhaust all available memory. PR-URL: https://github.com/nodejs/node/pull/53088 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 27c1755c9b8289..7ca7d6b02bae31 100644 --- a/Makefile +++ b/Makefile @@ -146,7 +146,8 @@ endif ifdef JOBS NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS) else - NINJA_ARGS := $(NINJA_ARGS) $(filter -j%,$(MAKEFLAGS)) + IMMEDIATE_NINJA_ARGS := $(NINJA_ARGS) + NINJA_ARGS = $(IMMEDIATE_NINJA_ARGS) $(filter -j%,$(MAKEFLAGS)) endif $(NODE_EXE): config.gypi out/Release/build.ninja $(NINJA) -C out/Release $(NINJA_ARGS)