Re: GNUMAKEFLAGS vs MAKEFLAGS

Alejandro Colomar <[email protected]> Tue, 16 Jul 2024 20:56:52 +0200
Newsgroups gmane.comp.gnu.make.general
Message-ID <5umdcroy7bhsk6nfnlf3i67vfvsxxzssdtmefyhakqzywd4inq@uviaqiccogyj>
Hi Paul,

On Tue, Jul 16, 2024 at 02:39:11PM GMT, Paul Smith wrote:
> On Tue, 2024-07-16 at 20:27 +0200, Alejandro Colomar wrote:
> > As discussed in a different thread, the docs claim that GNUMAKEFLAGS
> > and
> > MAKEFLAGS are treated in the same way.
> > 
> > All else equal, since I'm using GNU-specific flags, I think I should
> > be
> > using GNUMAKEFLAGS.
> > 
> > However, Paul said that I should use MAKEFLAGS, because GNUMAKEFLAGS
> > is not special when passing -R and/or -r.
> 
> That's not actually what I said.
> 
> What I said was that GNUMAKEFLAGS is not special when it appears inside
> a makefile.  It's only special when it's read from the environment.

Sorry for my imprecise wording.  I meant that.

> 
> That is, this does what you expect:
> 
>   $ GNUMAKEFLAGS=-Rr make -f Makefile

But this would be quite insane, isn't it?  (Except during recursive
make(1), which is also insane in its own way.)  :-)

> 
> but this doesn't do what you expect:
> 
>   $ cat Makefile.pre
>   GNUMAKEFLAGS += -Rr
> 
>   $ make -f Makefile.pre -f Makefile
> 
> > Should make(1) be patched to actually treat GNUMAKEFLAGS the same as
> > MAKEFLAGS?
> > 
> > Or maybe should the docs be fixed to say that GNUMAKEFLAGS doesn't
> > have the special properties that MAKEFLAGS has?
> 
> I think it will be difficult to change make to treat GNUMAKEFLAGS as
> special inside a makefile.  The entire handling of makefiles is a
> hornets nest, and we are stung repeatedly every time we try to tweak it
> to work differently.

Makes sense.

> 
> And, I'm not convinced such a thing is really useful.  If you are
> writing a makefile and you are relying on this always being set, it's
> almost 100% guaranteed that your makefile won't work with any other
> version o make anyway.

Agree, and anyway, I'm using GNUmakefile for that reason.

> 
> So I'm not sure I see the harm in having people write:
> 
>    MAKEFLAGS += -rR
> 
> inside their makefiles, if that's the behavior they want.

That's fine.  Then please clarify the docs.  :)

I'll revert the use of GNUMAKEFLAGS in my project.

Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmaWwnQACgkQnowa+77/
2zKglA/+Pg/uJokqOM/iBgxSwvfWnb3aFY56makwliwL8pFeIH0aCgwtLL15xYo5
8XFRUzH4my+3Sut66VnYfvXfjt6Zk637wHBFLQkE03cCx6wy/2C69rTBYYF9Xpsf
U8ghlOvlNBYpNyRn5pKLszB0v+TpuygE6Dv2ZYlMR0mS1t+NL/elxO7ddWl/7/g2
7o/pp0xmeniU5N9hvE2wPBE0KUBrxBWz1PN9utpM1HKf4Jf2M+HbVLwa6U0cES5k
3PEXUodBEvLRN53Hhx65nHFy18dgq42+OTNWxa8uzAk2I00n1DCf/m5Rs2ezEdLd
L11xnDRrtBE6BqrjBf3S0n/3sPFxNqODOREiB5DXyrRcFiY1LzMWl2cgOS22CqXI
i3PqBIg43ohMGslKlWRmKu/piVbFlFyhllPjMAniRwUDDLqk5RdjyvpTrePtmB21
Xb64U4GUXRjwDaiqiXLEH5lZvQ3R2WBi2CY/ClsgiVUZzgES0MV+vFgEgk6MbXhO
oL950brRNpzLx7/ysh5kHsEjS7bBoVaJLPEL0+zGrHWNG7HCVu7KqYpO6k/BgtmE
3qlSkNdu5g/PZkpju+3LFSQ1rT33XXoG2CNc86R40FkCS6IGAwBZv4yhWh/6J+Ir
xBdfUd2wojqNhpWMX6qDjPMcFi6X+hIaomAVg/WRpW4SmxFSxog=
=H2J1
-----END PGP SIGNATURE-----