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 targos committed Jun 1, 2024
1 parent 6b1731c commit ca655b6
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 ca655b6

Please sign in to comment.