[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNUMAKEFLAGS vs MAKEFLAGS
From: |
Paul Smith |
Subject: |
Re: GNUMAKEFLAGS vs MAKEFLAGS |
Date: |
Tue, 16 Jul 2024 14:39:11 -0400 |
User-agent: |
Evolution 3.52.3 (by Flathub.org) |
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.
That is, this does what you expect:
$ GNUMAKEFLAGS=-Rr make -f Makefile
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.
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.
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.