Add more info:
For make 4.3:
$make KBUILD_OUTPUT=test
KBUILD_OUTPUT in shell is
KBUILD_OUTPUT is test
For make 4.4:
$make KBUILD_OUTPUT=test
KBUILD_OUTPUT in shell is test
KBUILD_OUTPUT is test
On 11/22/22 11:12, Changqing Li wrote:
Hi,
Here is the Makefile:
KBUILD_OUTPUT =
defs := $(shell echo $$KBUILD_OUTPUT)
all:
@echo "KBUILD_OUTPUT in shell is $(defs)"
@echo "KBUILD_OUTPUT is $(KBUILD_OUTPUT)"
1. For make version 4.3
$ KBUILD_OUTPUT=test make
KBUILD_OUTPUT in shell is test
KBUILD_OUTPUT is
2. For make version 4.4
$ KBUILD_OUTPUT=test make
KBUILD_OUTPUT in shell is
KBUILD_OUTPUT is
Here is what the make manual says,
6.10 Variables from the Environment
- However, an explicit assignment in the makefile, or with a command
argument, overrides the environment.
- Note this is not totally reliable; some makefiles set CFLAGS
explicitly and therefore are not affected by the value in the
environment.
I think the behavior of 4.4 is aligned with doc, if KBUILD_OUTPUT is
explicit set in Makefile, in $(shell) , it should also use the value
set in Makefile, not still use
the value in shell environment like what 4.3 done. But I don't find
which commit or bug ID is for fixing this issue, so I send this mail
to double check with the
exports at this. Thanks a lot.
Best regards
Changqing