bug-make
[Top][All Lists]
Advanced

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

Re: gmake-4.2.1 ignores assignment of ARCH on FreeBSD


From: Paul Smith
Subject: Re: gmake-4.2.1 ignores assignment of ARCH on FreeBSD
Date: Tue, 26 Dec 2017 15:47:52 -0500

On Tue, 2017-12-26 at 12:29 -0800, Yuri wrote:
> On 12/26/17 11:37, Paul Smith wrote:
> > to the makefile right after you assign ARCH and see whether the
> > shell result is what you expect, and whether the ARCH assignment
> > here is what you expect.
> > 
> > Also, if you invoke make with the '-p' option it will show you
> > where all the variables are assigned along with their value.  This
> > may help you track down where ARCH is being set.
> 
> I found that ARCH=amd64 is set in the environment by the framework.
> This is what makes a difference.
> 
> But this is very confusing and error prone that := assignments are 
> ignored for variables that are present in environment.

That is not true, at least not by default.  The precedence of variables
is that command line settings (or settings in the makefile with
'override') have the highest priority, then values set in the makefile,
then values set in the environment, and lastly default values provided
by make itself.

Perhaps the ports system is invoking make with the '-e' option, which
forces environment variables to have a higher precedence than variables
set in the makefile.

Again, the "-p" option will tell you if that is so.

For example, the environment is used by default:

   $ FOO=env make -p -f/dev/null 2>/dev/null | grep -B1 FOO
   # environment
   FOO = env

But if a makefile overrides then:

   $ echo 'FOO=make' | FOO=env make -p -f- 2>/dev/null | grep -B1 FOO
   # makefile (from '/tmp/GmYsMWk9', line 1)
   FOO = make

But if you invoke with -e, then:

   $ echo 'FOO=make' | FOO=env make -p -f- -e 2>/dev/null | grep -B1 FOO
   # environment under -e
   FOO = env

Note how the comment in the output of "-p" changes based on where the
variable is obtained.



reply via email to

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