[Top][All Lists]

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

Re: curious behaviour of $MAKEFLAGS and leading hyphen

From: Robert P. J. Day
Subject: Re: curious behaviour of $MAKEFLAGS and leading hyphen
Date: Fri, 22 Apr 2005 09:53:24 -0400 (EDT)

On Fri, 22 Apr 2005, Paul D. Smith wrote:

> %% "Robert P. J. Day" <address@hidden> writes:
>   rpjd> MAKEFLAGS would, when calling a subshell, be set to "I /tmp" and, i'm
>   rpjd> assuming, the callee would then use "-${MAKEFLAGS}", right?
> No.  You should NEVER use MAKEFLAGS in a command line.  It's
> completely inappropriate to do so and will break your make process
> in some situations.
> MAKEFLAGS is and has always been intended to be passed THROUGH THE
> ENVIRONMENT, not on the command line.  You should set MAKEFLAGS in
> the environment, and add to it or reset it in the makefile, but you
> should never use it explicitly in a command line.

ok, that makes sense, so let me ask one more followup question.  is
there a reason i can't use ${MAKEFLAGS} in a make directive to
*examine* the values of the command-line options with which i, the
makefile, was invoked?

as a trivial example,

  $(warning Hi, my MAKEFLAGS value is ${MAKEFLAGS}.)

if you do that in a makefile, it won't represent the command-line
options you were invoked with but, if you make a recursive call, then
the command-line options will be added to MAKEFLAGS for the purpose of
that recursive call.

in short, if a makefile is invoked with, say, "-I /tmp/fred", that
information will certainly affect the behaviour of the makefile but
won't be reflected in that current MAKEFLAGS variable.  (i'm not sure
*why* i'd want to look at it, but i'm just curious.)


reply via email to

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