[Top][All Lists]

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

Re: removing compile directive

From: Paul Smith
Subject: Re: removing compile directive
Date: Wed, 23 Apr 2008 13:42:59 -0400

On Wed, 2008-04-23 at 18:46 +0200, grischka wrote:
> From: "Paul Smith":
> > > > On Mon, 2008-04-21 at 10:43 -0700, Brian Dessent wrote:
> > > > > CFLAGS = $(filter-out -D_REMOVE_THIS_,$(CFLAGS))
> > In a recursive variable assignment, which this is, the right hand side
> > is NOT evaluated, at all, during assignment.  The text string on the
> > right side is simply taken as-is and the variable now contains that
> > value.  It's only later that the variable is expanded.  When that
> > happens, what's the value of $(CFLAGS)?  It's "$(filter-out
> > -D_REMOVE_THIS_,$(CFLAGS))".  How can you expand that?  You don't know
> > what the "old" value of $(CFLAGS) is, so you can't do it.
> Well then maybe the current limitation in GNU-make is that it does 
> not remember the "old" value.  Intuitively it is clear what the 
> old value is, either the lexically previous assignment or empty.

Yes, it's true that for every variable make COULD create a LIFO stack of
values, saving every assignment made to that variable in order; when
expanding the variable it could then "walk through" that stack of
values.  That would enable self-referential variable assignment.

Making it work that way is not actually that easy.  Storing the
historical values is the easy part (although it could create memory
pressures).  Getting the expansion right in all cases is a lot less

The example above is quite simple, but consider more complicated
situations where the expansion is quite complex, referencing lots of
variables (not just one), each of which has a number of historical
values.  The same variable could even be referenced by more than one of
these values.  So, while expanding a variable you have to remember how
far down the value stack you've gone and that has to be remembered
individually for each variable and potentially for each INSTANCE of each

Maybe I'm making it more confusing than it needs to be, but I don't
think so.

 Paul D. Smith <address@hidden>       
 "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]