Re: Which behavior is expected of $(shell )

Changqing Li <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <[email protected]>
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
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.