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.
cc @nodejs/build
Not sure how to test it, but the code logic LGTM
Without this patch, ./configure --ninja followed by make -j4 will display ninja -C .... With this patch, make -j4 will instead show nina -C ... -j4.
CI: https://ci.nodejs.org/job/node-test-pull-request/59364/
CI: https://ci.nodejs.org/job/node-test-pull-request/59368/
CI: https://ci.nodejs.org/job/node-test-pull-request/59376/
It might make sense to add a comment to prevent it from being reverted to the original version.
@lpinca I tend to agree, but I am not sure if it's worth going through CI again (which presumably doesn't even cover this branch).
It's your call.
Landed in 19f0bcaa621f37023fbd35dc16c7a12f69e48345