Re: [PATCH] Kbuild: add RUSTC_BOOTSTRAP to rustc-option
From: Miguel Ojeda
Date: Tue Oct 08 2024 - 16:06:13 EST
On Tue, Oct 8, 2024 at 8:45 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> Really?
>
> $(shell ...) inherits env variables in my understanding.
I mean the Make-exported variables (not the external environment),
i.e. `RUSTC_BOOTSTRAP=1` that we export in the main `Makefile`. Those
are not exported into the `shell` function.
However, it turns out this changes in GNU Make 4.4 in commit
98da874c4303 ("[SV 10593] Export variables to $(shell ...) commands"):
* WARNING: Backward-incompatibility!
Previously makefile variables marked as export were not exported
to commands
started by the $(shell ...) function. Now, all exported variables are
exported to $(shell ...). If this leads to recursion during
expansion, then
for backward-compatibility the value from the original
environment is used.
To detect this change search for 'shell-export' in the .FEATURES variable.
And indeed:
export A := .PHONY: a
$(shell echo $$A)
a: ; @echo exported
Gives:
$ make-4.3
make: 'a' is up to date.
$ make-4.4.1
exported
Cheers,
Miguel