On Mon, Jan 22, 2024 at 4:59 PM Martin Dorey <martin.do...@hitachivantara.com> wrote: > > Why is that? > > > I imagine because that's how, to my surprise, it is today: > > martind@stormy:~/tmp/make-conditional-assignment-2024-01-22$ cat Makefile > A := 42 > A += $(shell hello) > martind@stormy:~/tmp/make-conditional-assignment-2024-01-22$ make > make: hello: No such file or directory > make: *** No targets. Stop. > martind@stormy:~/tmp/make-conditional-assignment-2024-01-22$ > > ... and changing something so foundational sounds likely to cause widespread > issues. >
As said before, += is going to be the exception (by respecting any pre-existing variable type) because of legacy. That's not all that bad though, it just exemplifies that variables can go from recursively expanded to simply expanded, but not back.