Skip to content

Commit 19f0bca

Browse files
authored
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: #53088 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 177b8b9 commit 19f0bca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ endif
146146
ifdef JOBS
147147
NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS)
148148
else
149-
NINJA_ARGS := $(NINJA_ARGS) $(filter -j%,$(MAKEFLAGS))
149+
IMMEDIATE_NINJA_ARGS := $(NINJA_ARGS)
150+
NINJA_ARGS = $(IMMEDIATE_NINJA_ARGS) $(filter -j%,$(MAKEFLAGS))
150151
endif
151152
$(NODE_EXE): config.gypi out/Release/build.ninja
152153
$(NINJA) -C out/Release $(NINJA_ARGS)

0 commit comments

Comments
 (0)