Index | Thread | Search

From:
Anders Andersson <pipatron@gmail.com>
Subject:
Re: make: -j without params
To:
tech@openbsd.org
Date:
Sat, 22 Feb 2025 18:45:50 +0100

Download raw body.

Thread
On Sat, Feb 22, 2025 at 4:29 PM Marc Espie <marc.espie.openbsd@gmail.com> wrote:
>
> I had quite a bit of fun with students this week, and stumbled upon
> getopt ::   extension.
>
> Figured out, it would be obvious to do in make.
>
> I looked at the others (very few instances) of tools that use ::
> to discern a pattern: in general, the consensus is that if we get an
> optarg, we whine if it doesn't match our expectation.
>
> So here's a patch to have make -j use hw.ncpuonlines if there's no optarg.
> Might come in handy for people compiling on several machines who don't
> want to remember the details.
>
> Wrt posix's compatibility, opengroup doesn't say anything.
>
> And gmake -j does something (doesn't limit the number of jobs, from the doc)
>
>
> So, handy ? crazy ? not needed ?

gmake -j does indeed run EVERYTHING in parallel, which can work in
many cases on small projects but it is a crazy default. I wonder if
it's designed to be used with distcc.

Using the number of CPUs is of course a far better and more intuitive
option, and what I first assumed gmake did until I read the docs more
carefully and tried it on a larger project...

// Anders