help-make
[Top][All Lists]
Advanced

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

Re: The -e option confuses the $(origin ) ?


From: Kaz Kylheku (gmake)
Subject: Re: The -e option confuses the $(origin ) ?
Date: Mon, 13 Sep 2021 05:22:04 -0700
User-agent: Roundcube Webmail/0.9.2

On 2021-09-13 00:28, Masahiro Yamada wrote:
masahiro@oscar:~/workspace/foo$ export FOO=2
masahiro@oscar:~/workspace/foo$ make
Makefile:1: the origin of FOO is: environment
Makefile:2: the value of FOO is: 2
make -e -f Makefile.sub1 FOO=1

Note that this FOO=1 will be exported to the environment. See the
GNU Make 4.3 manual, section 5.7.2 Communicating Variables to a Sub-make:

  "Except by explicit request, make exports a variable only if it is
   either defined in the environment initially or set on the command
line, and if its name consists only of letters, numbers, and underscores."

make[1]: Entering directory '/home/masahiro/workspace/foo'
Makefile.sub1:1: the origin of FOO is: command line
Makefile.sub1:2: the value of FOO is: 1
make -f Makefile.sub2
make[2]: Entering directory '/home/masahiro/workspace/foo'
Makefile.sub2:1: the origin of FOO is: environment
Makefile.sub2:2: the value of FOO is: 1

Here, we are seeing the value of FOO from the environment,
as exported by make -e -f Makefile.sub1 FOO=1.

(Since your makefiles do not define FOO themselves, the
effect of -e is not being demonstrated.)



reply via email to

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