Recursive Make and -j: The Jobserver Trap
Recursive `make` and `-j`
Recursive Makefiles often break parallel builds because the -j jobserver isn't forwarded to sub-makes. Testing GNU Make 3.81 through 4.3 reveals inconsistent warnings and behavior: without + or $(MAKE), parallelism silently drops to 1; with them, it works but can still trigger 'resetting jobserver mode' warnings when -j flags conflict. No version yet offers the ideal: inherit the parent's jobserver unless explicitly overridden.
What we really want is a row that would look like `fantasy` below. But at the moment, it seems we have to choose our preferred tradeoff from one of the quoted rows, instead.
- stabbles
The `-j` is meant for the top-level invocation only, and the $(MAKE) pattern is standard.
The `+` or $(MAKE) "tricks" to ensure the jobserver is inherited in submake and any other subprocess are no longer needed in gmake 4.4 (from 2022) because it defaults to a FIFO instead of pipes. The author should just upgrade gmake :).
- fragmede
Don't do it!
https://accu.org/journals/overload/14/71/miller_2004/
Recursive Make Considered Harmful
By Peter Miller