On Fri, 2025-06-27 at 10:18 -0700, Collin Funk wrote:
> If one wants to add a default value because they know it will always
> work with their system they can easily add this to their ~/.profile:
> 
>     export GNUMAKEFLAGS="$((2 * `nproc`))"
> 
> Assuming this is the value they want (and 'nproc' from Coreutils).

The advantage to putting some value like this into the makefile itself
rather than a per-user environment setting is that different makefiles,
which have different types of builds and run different types of tools
in their recipes, could choose different values.

But I agree with, and others have requested that, parallelism being
limited in some way by available _memory_ and not just available CPU:
this seems very reasonable.  The fly in the ointment is that, even
moreso than CPU, memory is not allocated up-front and by the time
memory pressure gets significant it's very possible make has already
spawned too many parallel jobs.  Also, detecting amount of memory in
use vs. free is harder to do, even among different POSIX systems.

Nevertheless, it would still be a useful feature IMO.

Reply via email to