[Top][All Lists]

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

Target specific immediate append operator not working as expected

From: lasse.makholm
Subject: Target specific immediate append operator not working as expected
Date: Mon, 20 Feb 2006 11:22:22 +0100

There is some weirdness going on with the append operator and
target-specific contexts.

The append operator should act immediately if the variable was
originally assigned with an immediate assignment but this does not
happen if the variable was globally assigned and the append is
target-specific, the append does variable expansion (as if the variable
had been deferred).

Here's a test case showing the problem:

colsw07m -> cat Makefile


bar: VAR += bar

foo bar:
        echo $(VAR)

colsw07m -> ~/src/make/make-3.81rc1/make foo
colsw07m -> ~/src/make/make-3.81rc1/make bar
echo OGNAME bar

Making the assignment target-specific or making the append global both
work as expected.

It seems to be a thing introduced in 3.80 which makes sense since AFAIK
3.80 brought some fixes to target specific variables.
3.78.1 seems to work correctly.
3.79.1, as expected, breaks with target-specific variables.
3.80 works the same as 3.80rc1.

The documentation (chapter on target-specific vars) states that:

"The variable-assignment can be any valid form of assignment; recursive
(`='), static (`:='), appending (`+='), or conditional (`?='). All
variables that appear within the variable-assignment are evaluated
within the context of the target: thus, any previously-defined
target-specific variable values will be in effect. Note that this
variable is actually distinct from any "global" value: the two variables
do not have to have the same flavor (recursive vs. static)."

What basically happens though is that the target-specific append treats
the global instance of VAR as recursive.

I would consider this a bug especially since this:

bar: VAR := $(VAR) bar

...also works as expected...

On a slightly related side note, the manual seems to switch between the
terms immediate/deferred and static/recursive for describing the same
things; the two flavours of variables... Perhaps the two pairs of terms
should be unified into one?


reply via email to

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