From: Marc Espie Subject: Re: make: -j without params To: Mark Kettenis Cc: Lucas Gabriel Vuotto , tech@openbsd.org Date: Sun, 23 Feb 2025 18:49:40 +0100 On Sat, Feb 22, 2025 at 08:49:17PM +0100, Mark Kettenis wrote: > > Date: Sat, 22 Feb 2025 18:57:19 +0000 > > From: Lucas Gabriel Vuotto > > > > On Sat, Feb 22, 2025 at 04:27:38PM +0100, Marc Espie 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 ? > > > > > > > > > It's a very straightforward patch with an obvious failure path. > > > > Personally, I don't like how optional args are handled: the argument is > > now required to go right after the option letter, without space: > > `make -j 4` doesn't work as it currently works anymore, and instead will > > use all the online cpus and will try to build the target `4`. > > Yeah, that's pretty much a deal-breaker for me. Ah, I didn't test this. I assumed getopt was smarter than that... IMO, unless gnu getopt does something fishy that's similar, -j4 ought to still work, obviously. Deal breaker for me as well ;)