Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2004 01:30:10 GMT
From:      John E Hein <jhein@timing.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/68534: make(1) - ${.MAKEFLAGS} does not contain cmd line args
Message-ID:  <200407010130.i611UA2C026647@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/68534; it has been noted by GNATS.

From: John E Hein <jhein@timing.com>
To: Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc: bug-followup@freebsd.org
Subject: Re: bin/68534: make(1) - ${.MAKEFLAGS} does not contain cmd line args
Date: Wed, 30 Jun 2004 19:22:20 -0600

 This is interesting env var precedence weirdness...
 
 $ cat Makefile
 FOO?=0
 X?=0
 .PHONY: x
 x:
 	@echo MAKEFLAGS: ${MAKEFLAGS}
 	@echo .MAKEFLAGS: ${.MAKEFLAGS}
 	@echo FOO: ${FOO}
 .if $X != 1
 	make X=1
 .endif
 
 $ env FOO=1 MAKEFLAGS=FOO=3 make FOO=2
 MAKEFLAGS: FOO=3
 .MAKEFLAGS:
 FOO: 2
 make X=1
 MAKEFLAGS: FOO=3
 .MAKEFLAGS:
 FOO: 3
 
 $ env FOO=1 make FOO=2
 MAKEFLAGS:
 .MAKEFLAGS:
 FOO: 2
 make X=1
 MAKEFLAGS:
 .MAKEFLAGS:
 FOO: 2
 
 
 In the first case FOO=3 is inserted in the environment by make via
 MAKEFLAGS.
 
 In the second case FOO=1 is inserted in the environment in a more
 generic way.
 
 Why does FOO=2 (the cmd line variable) override FOO in the environment
 in the first case, but not the second?  I'm going to have a look in
 the source.
 
 And finally...
 
 $ env FOO=1 make -E FOO FOO=2
 MAKEFLAGS: -E FOO
 .MAKEFLAGS: -E FOO
 FOO: 2
 make X=1
 MAKEFLAGS: -E FOO
 .MAKEFLAGS: -E FOO
 FOO: 2
 
 But that is as expected.  It's case 2 that puzzles me.
 
 Whoa, wait a second.  There's some stuff from the command line
 in MAKEFLAGS now.
 
 So I guess the bug is that only CERTAIN things from the command
 line show up in MAKEFLAGS>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407010130.i611UA2C026647>