help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUMAKEFLAGS vs MAKEFLAGS


From: Alejandro Colomar
Subject: Re: GNUMAKEFLAGS vs MAKEFLAGS
Date: Tue, 16 Jul 2024 20:56:52 +0200

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/>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]