On Tue, 2017-12-26 at 13:07 -0800, Yuri wrote:
> On 12/26/17 12:47, Paul Smith wrote:
> > Again, the "-p" option will tell you if that is so.
> 
> 
> With -p, ARCH appears in these lines:
> 
> # automatic
> -*-command-variables-*- := SHARED=true LDFLAGS=-fstack-protector\ 
> -L/usr/local/lib\ -lgmp\ -lm\ -lz DCC=cc LINKCC=cc CC=cc _SMP_CPUS=8 
> _PKG_CHECKED=1 _PERL5_FROM_BIN=5.24.3 _OSRELEASE=11.1-STABLE 
> OSVERSION=1101506 OSREL=11.1 OPSYS=FreeBSD
> HAVE_COMPAT_IA32_KERN=YES\  
> ARCH=amd64
> 
> # command line
> ARCH = amd64

Well, this clearly shows that the ARCH variable has been supplied on
the command line, NOT through the environment.  So it's no surprise at
all that this value is taking precedence over the value set in the
makefile: values set on the command line always have the highest
precedence.

I'm not sure why you are thinking that it's being obtained from the
environment; it clearly says "command line" above.

> However, when I added these lines:
> 
> MYENV=$(shell /usr/bin/env)
> $(info MYENV = $(MYENV))
> 
> it printed that ARCH=amd64 is set in environment too.

Sure... make will export variable values that are requested to be
exported to programs that it runs via the environment.  I'm not sure
what that has to do with anything though.

> It's very strange that -p doesn't show ARCH being in the environment.

The -p option doesn't show every possible way that a variable is
set.  It only shows how the actual value that make is using 
is obtained.  Since this value is set on the command line that's all
the -p output shows.  It might have been set in the makefile and in the
environment as well, but since those settings are ignored by make they
won't appear in the -p output.

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to