Index | Thread | Search

From:
Lucas Gabriel Vuotto <lucas@sexy.is>
Subject:
Re: make: -j without params
To:
tech@openbsd.org
Date:
Sat, 22 Feb 2025 18:57:19 +0000

Download raw body.

Thread
  • Lucas Gabriel Vuotto:

    make: -j without params

  • 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`.
    
    The C part looks fine. The manpage does need an small adjustment to
    reflect the previous comment (which is also reflected in some part of
    POSIX [0], where optional args are shown as `-c option_argument 
    -f[option_argument]`). btw, next section of POSIX, Utility Syntax
    Guidelines, suggest against optional arguments.
    
    [0]: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap12.html
    
    	Lucas
    
    
    
  • Lucas Gabriel Vuotto:

    make: -j without params