Ideally, yes.

Not certain that 100% of make environments have that exact command available 
(e.g. Command Prompt, PowerShell).

It's also more efficient to query an OS API than to create a new process and 
parse the I/O streams.

I propose attempting to query first, and apply a default of 4 as a fallback.

Note that make implementations such as GNU currently interleave the output 
streams from different concurrent tasks, making them harder to read. Recommend 
striping outputs in dedicated ncurses style bands, like Docker.

On Tue, Oct 29, 2024 at 1:13 PM, Rob Landley <[[email protected]](mailto:On Tue, 
Oct 29, 2024 at 1:13 PM, Rob Landley <<a href=)> wrote:

> On 10/22/24 00:42, Andrew via austin-group-l at The Open Group wrote:
>> Hi,
>>
>> Both GNU and BSD make support parallelism with -j flags.
>>
>> Can POSIX make adopt a -j flag to indicate the maximum number of concurrent 
>> jobs, default 4?
>>
>> This can help to accelerate a lot of existing makefiles.
>>
>> Cheers,
>>
>> Andrew
>> [email protected]
>
> Why not autodetect? I use -j $(nproc) a lot, although on BSD/mac it's
> "sysctl -n hw.ncpu" instead.
>
> Arbitrary limit seems a bit silly when the ability to probe exists. (The
> linux one even responds to taskset by default, dunno about bsd-land...)
>
> Rob
  • request: make [-j... Andrew via austin-group-l at The Open Group
    • Re: request:... Lawrence Velázquez via austin-group-l at The Open Group
    • Re: request:... Rob Landley via austin-group-l at The Open Group
      • Re: requ... G. Branden Robinson via austin-group-l at The Open Group
      • Re: requ... Andrew via austin-group-l at The Open Group
        • Re: ... Paul Smith via austin-group-l at The Open Group
          • ... Andrew via austin-group-l at The Open Group
            • ... Paul Smith via austin-group-l at The Open Group
              • ... David A. Wheeler via austin-group-l at The Open Group
                • ... Paul Smith via austin-group-l at The Open Group
                • ... Steffen Nurpmeso via austin-group-l at The Open Group
        • Re: ... Rob Landley via austin-group-l at The Open Group
          • ... enh via austin-group-l at The Open Group
          • ... Paul Smith via austin-group-l at The Open Group
            • ... David A. Wheeler via austin-group-l at The Open Group

Reply via email to