bugmake - Bugs: bug #15913, Target-specific immediate append...

 
 

bug #15913: Target-specific immediate append operator not working as expected

Submitter:  None
Submitted:  Mon 27 Feb 2006 01:47:29 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.80 Operating System:  Any
Fixed Release:  3.81 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 15 Mar 2006 03:11:18 AM UTC, comment #2: 

OK, I've fixed this for the next release of GNU make.

Paul D. Smith <psmith>
Group administrator
Mon 27 Feb 2006 05:57:17 PM UTC, comment #1: 

Please see this reply I sent to the original message on the bug-make mailing list:

http://www.mail-archive.com/bug-make%40gnu.org/msg03815.html

Paul D. Smith <psmith>
Group administrator
Mon 27 Feb 2006 01:47:29 PM UTC, original submission:  

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

VAR := $$LOGNAME

bar: VAR += bar

foo bar:
        echo $(VAR)

colsw07m -> ~/src/make/make-3.81rc1/make foo echo $LOGNAME makholm colsw07m -> ~/src/make/make-3.81rc1/make bar echo OGNAME bar 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?

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-04-01 psmith Fixed Release4.0 3.81
2006-03-15 psmith StatusNone Fixed
    Open/ClosedOpen Closed
    Fixed ReleaseNone 4.0
2006-02-27 psmith Assigned toNone psmith

Back to the top

Powered by Savane 3.13-02a9.
Corresponding source code