bin/68534: make(1) - ${.MAKEFLAGS} does not contain cmd line args

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Jun 30 17:40:22 PDT 2004


The following reply was made to PR bin/68534; it has been noted by GNATS.

From: Giorgos Keramidas <keramida at ceid.upatras.gr>
To: "John E. Hein" <jhein at timing.com>
Cc: bug-followup at freebsd.org
Subject: Re: bin/68534: make(1) - ${.MAKEFLAGS} does not contain cmd line args
Date: Thu, 1 Jul 2004 03:37:25 +0300

 On 2004-06-30 17:36, "John E. Hein" <jhein at timing.com> wrote:
 > MAKEFLAGS env variable & .MAKEFLAGS make variable does not contain command
 > line args as specified in make(1).
 
 This is not a bug.
 
 The keyword is "may".  If you set .MAKEFLAGS in your Makefile or MAKEFLAGS in
 the environment than make(1) *will* *pass* these to child processes (as the
 value of MAKEFLAGS in the environment).
 
 Not setting MAKEFLAGS is not an error, but does not imply that something
 related to make's invocation will get passed in the environment.
 
 Here's an an example:
 
 : giorgos at gothmog:/tmp/maketest$ cat Makefile
 : SUBDIR= alpha
 :
 : .MAKEFLAGS=     WITHOUT_X11=YES
 :
 : all:
 :         @echo "MFLAGS     : ${MFLAGS}"
 :         @echo "MAKEFLAGS  : ${MAKEFLAGS}"
 :         @echo ".MAKEFLAGS : ${.MAKEFLAGS}"
 :
 : .include <bsd.subdir.mk>
 : giorgos at gothmog:/tmp/maketest$ cat alpha/Makefile
 : all:
 :         @echo "MFLAGS     : ${MFLAGS}"
 :         @echo "MAKEFLAGS  : ${MAKEFLAGS}"
 :         @echo ".MAKEFLAGS : ${.MAKEFLAGS}"
 :
 : giorgos at gothmog:/tmp/maketest$ make WITHOUT_X11=NO
 : MFLAGS     :  WITHOUT_X11=YES
 : MAKEFLAGS  : WITHOUT_X11=YES
 : .MAKEFLAGS : WITHOUT_X11=YES
 : ===> alpha
 : MFLAGS     :
 : MAKEFLAGS  : WITHOUT_X11=YES
 : .MAKEFLAGS :
 : giorgos at gothmog:/tmp/maketest$
 
 Note how WITHOUT_X11=NO in the command line does not have any effect because
 ./Makefile sets .MAKEFLAGS to something different.  But the correct value *is*
 propagated as expected to alpha/Makefile.
 
 If there is a bug here it's in what is described in the manpage as:
 
      MFLAGS     A synonym for .MAKEFLAGS provided for backward compatibility.
 
 which isn't quite true AFAICT, since MFLAGS includes the value of .MAKEFLAGS
 when the latter is set but not vice versa.
 
 - Giorgos
 


More information about the freebsd-bugs mailing list