bugmake - Bugs: bug #39485, target specific make variables are...

 
 

bug #39485: target specific make variables are incorrectly accumulated

Submitter:  None
Submitted:  Sun 14 Jul 2013 08:22:00 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.82 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 14 Jul 2013 10:51:52 PM UTC, comment #1: 

This is defined as the correct behavior for target-specific variables; from the GNU make manual:


   There is one more special feature of target-specific variables: when
you define a target-specific variable that variable value is also in
effect for all prerequisites of this target, and all their
prerequisites, etc. (unless those prerequisites override that variable
with their own target-specific variable value).


The idea is to support usages such as:


DEBUGFLAGS =
all: thisprog thatlib

debug: all
debug: DEBUGFLAGS = -g


Now when you run "make" you'll get the non-debug version (DEBUGFLAGS is empty), but when you run "make debug" you get the debug version (DEBUGFLAGS is set to -g).

Paul D. Smith <psmith>
Group administrator
Sun 14 Jul 2013 08:22:00 PM UTC, original submission:  

$ cat Makefile
V=
t1: t2
t1: V+=v1
t2: V+=v2
%:
@echo target=$@ V=$(V)

$ make t1
target=t2 V=v1 v2
target=t1 V=v1
$ make t2
target=t2 V=v2
$ make t2 t1
target=t2 V=v2
target=t1 V=v1
$ make t1 t2
target=t2 V=v1 v2
target=t1 V=v1
make: `t2' is up to date.

i expected V to be consistently v2 for target t2,
the fact that t2 is a dependency of t1 should not
change the variable setting for t2 because that
makes the result unpredictable

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

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-14 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code