help-make
[Top][All Lists]
Advanced

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

Re: Rd: Using the same options for compiling and linking


From: Britton Kerin
Subject: Re: Rd: Using the same options for compiling and linking
Date: Wed, 8 May 2013 19:36:54 -0800

On Tue, May 7, 2013 at 1:16 PM, Mark Galeck <address@hidden> wrote:
>>
>> Assigning to MAKEFLAGS only affects sub-makes, despite this (wrong)
>> paragraph from the documentation:
>>
>> MAKEFLAGS
>>    The flags given to make. You can set this in the environment
>>    or a makefile to set flags. See Communicating Options to a
>
>
> I disagree that this paragraph is wrong.  You can set MAKEFLAGS in the
> environment or makefile.  The meaning of "MAKEFLAGS" from the manual is
> this:
>
>
>
> MAKEFLAGS (...) variable is set up automatically by make to contain the flag
> letters that make received. (...)
>
> As a consequence, every sub-make gets a value for MAKEFLAGS in its
> environment. (...)
>
> The MAKEFLAGS variable can also be useful if you want to have certain
> options, such as ‘-k’ (see Summary of Options), set each time you run make.
> You simply put a value for MAKEFLAGS in your environment. You can also set
> MAKEFLAGS in a makefile, to specify additional flags that should also be in
> effect for that makefile.

Its not useful for this unless you never build any software but your own.
You will confuse many shipped Makefiles hopelessly with some make options
(particularly -r and -R).  Most Makefiles will probably not have code to
report why they are confused.  You have to make an alias/function/wrapper
with a different name instead.

> So, you can assign MAKEFLAGS in a makefile, and the flags will be in effect
> "for that makefile", meaning - for the recursive sub-make calls that appear
> in that makefile.  The manual never says that the variable MAKEFLAGS has
> anything to do with the same makefile or makefile call where it is parsed.
> It is used for recursive calls.

The language on its own strongly implies that assigning to MAKEFLAGS affects
the current instance.  It may be possible to ferret out the true meaning
by looking up all the other references to the variable, but there's no good
reason to use confusing language in the above location.

The previous responder indicated that the true behavior is in fact variable on
a per-flag basis.  I don't know whether that's correct or not from my experience
but if so then the documentation is completely wrong on any interpretation.

Britton



reply via email to

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