[Top][All Lists]

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

Re: Possible bug with pattern-specific variables

From: Markus F.X.J. Oberhumer
Subject: Re: Possible bug with pattern-specific variables
Date: Wed, 27 Sep 2023 16:35:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

I think you did not get what I'm complaining about. Please
try this 3-line Makefile:

FOO +=
build/%: BAR +=
build/release: ; @echo "FOO='$(FOO)' BAR='$(BAR)'"
### END

And run "make FOO=X BAR=Y"

BAR is now **two** Y aka 'Y Y' which does not make any sense.


On 2023-09-27 16:20, Bahman Movaqar wrote:
> Invoking make like `make FOO=X BAR=Y' causes Make to consider `FOO' and
> `BAR' as special recursive/deferred variables.
>>From GNU Make manual:
>> all ordinary assignments of the same variable in the makefile are 
>> ignored; we say they have been overridden by the command line 
>> argument. 
> Each one will be appended to twice (matching pattern rules) before
> being expanded as `$(FOO)' and `$(BAR)'.
> See https://www.gnu.org/software/make/manual/make.html#Overriding
> On the other hand, `env FOO=X BAR=Y make' creates two environment
> variables which make does not treat as recursive variables.  They just
> always expand to the same value.
> HTH,

Markus Oberhumer, <markus@oberhumer.com>, http://www.oberhumer.com/

reply via email to

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