From 9aa896e7f5354deb25cd03c671875921bc38e2b9 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 f2009fff0c2f2b..5187d6a95033a9 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)