help-make
[Top][All Lists]
Advanced

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

Re: Which behavior is expected of $(shell )


From: Changqing Li
Subject: Re: Which behavior is expected of $(shell )
Date: Tue, 22 Nov 2022 11:33:18 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

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







reply via email to

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