[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: removing compile directive
From: |
grischka |
Subject: |
Re: removing compile directive |
Date: |
Wed, 23 Apr 2008 18:46:25 +0200 |
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.
In a way I think now it's you assuming behaviour from other languages
like C. For example, if you have two assignments to the same variable
VAR = AAA
VAR = BBB
then this does not mean that the second line must erase the first.
You could of course store BOTH lines in the make database, say in
lexical order, or in reverse lexical order, whatever is suitable.
And then you can do the same with these two lines just as well:
VAR = AAA
VAR = BBB $(VAR)
Such there is no problem to access the old values as needed later
at expansion time.
--- grischka