Skip to content

Commit

Permalink
build: fix -j propagation to ninja
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
tniessen authored and marco-ippolito committed Jul 19, 2024
1 parent acdbc78 commit 9aa896e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9aa896e

Please sign in to comment.