bug-make
[Top][All Lists]
Advanced

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

Re: New conditional assignment facility


From: Alejandro Colomar
Subject: Re: New conditional assignment facility
Date: Thu, 11 Jan 2024 17:30:08 +0100
User-agent: Mozilla Thunderbird

Hi Paul,

On 1/11/24 14:38, Paul Smith wrote:
On Thu, 2024-01-11 at 14:28 +0100, Alejandro Colomar wrote:
        alx@debian:~/tmp$ cat Makefile
        var ?= foo
        var ?+= bar
        $(info $(var))
        alx@debian:~/tmp$ make-9000
        foo bar
        make: *** No targets.  Stop.
        alx@debian:~/tmp$ make-9000 var=foo
        foo
        make: *** No targets.  Stop.
        alx@debian:~/tmp$ var=foo make-9000
        foo
        make: *** No targets.  Stop.

Sorry Alejandro; maybe you need to rewrite your examples again without
all the corrections, because I don't understand what you mean.

In all your examples, the value of var is set by the first line if it's
not already set:

     var ?= foo

After this line, var will either be "foo" or it will be whatever value
var had before that assignment (from the environment or command line or
whatever, it doesn't matter).  But it's definitely defined.

Once that happens, any subsequent "?" assignments, of any type, are
simply ignored and useless because "?" means "set if not defined" but
after the above line, var is always defined.

Hmm, after thinking about it again, I think my suggestion was dumb.

I was thinking of "?" meaning "set if not defined in the environment",
which is how I always used it.  But that's not what it means.

Cheers,
Alex


So it doesn't matter if the next line is "var ?= bar" or "var ?+= bar"
or whatever: it is just ignored.





reply via email to

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