help-make
[Top][All Lists]
Advanced

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

Re: override and +=


From: Paul Smith
Subject: Re: override and +=
Date: Tue, 19 Feb 2008 21:47:11 -0500

On Tue, 2008-02-19 at 18:29 -0800, Michael Morrell wrote:
> That works, but I don't see why.  I have now tried all four
> combinations of these two lines (each with and without "override").
> The other 3 cases make sense to me, but this one does not.  It appears
> that if the initial assignment is an "override" assigment, a "normal"
> += is always ignored.

Well, the GNU make manual section on "override" explicitly states that
to use += with an override variable, you have to declare the += override
as well.

Basically, make maintains different "priorities" of variables.  Of these
priorities, "override" is the highest, and command line is the second
highest.  Normal, non-override assignments in the makefile are the third
highest.  Once a variable has been set at a given priority, then any
attempt to set that variable in any manner using a lesser priority is
ignored.

> I'm not sure I want to call that a bug, but I would at least like to
> see a warning here that a line in my Makefile is always ignored and
> has no effect (and is therefore likely to be a bug).

But, it's not NECESSARILY a bug.  It's quite possible that, in a complex
makefile environment with lots of included makefiles, you are using
"override" to ensure that this value is set regardless of what other
"normal" priority assignments there might be.

I don't think it's appropriate for make to warn about things that MIGHT
be an error, but might not be, at least not by default.

However, it would be good to have some kind of enhanced debugging or
even "picky warning mode" that could be enabled to show these sorts of
warnings.  We do have one for warning about variables that are never
set, but this is not very flexible.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.us
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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