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.