bugmake - Bugs: bug #9066, Pattern-specific Variable Values

 
 

bug #9066: Pattern-specific Variable Values

Submitted by:  Alon Blayer-Gat <alonbg>
Submitted on:  Sun 23 May 2004 02:28:11 PM UTC  
 
Severity: 3 - NormalItem Group: Enhancement
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.80Operating System: Any
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 24 May 2004 06:01:15 PM UTC, comment #3:

> %.xx: SRC:=$*.ff


Static assignments are evaluated at the time of the assignment. Automatic variables are not set until the rule is about to run. So, when the static assignment is evaluated it uses the global value for the "*" variable, of which there isn't one. So, this is expected behavior.

> dd: ; @echo dd $(SRC)


The value of $* is the target name without the suffix. For a target like "dd", there is no way to determine what the suffix would be, so $* is empty. See the GNU make manual for details. You can see that even using very simple rules with no fancy things like target-specific variables you get the same results:

echo 'dd: ; @echo x=%*' | make -f-
x=

Paul D. Smith <psmith>
Project Administrator
Sun 23 May 2004 09:20:17 PM UTC, comment #2:

Correct, Thank you
Never the less, I checked some options out.

Option 1
%.xx: SRC=$*.ff

%.xx: %.dd
@echo xx $(SRC)

%.dd:
@echo dd $(SRC)

> make foo.xx

dd foo.ff
xx foo.ff

Option 2 (static assignment):
%.xx: SRC:=$*.ff

> make foo.xx

dd .ff
xx .ff

Option 3:
%.xx: SRC=$*.ff

%.xx: dd
@echo xx $(SRC)

dd:
@echo dd $(SRC)

>make foo.xx

dd .ff
xx foo.ff

Does options 2 and 3 present a bug ?
Should 'export' be supported ? ( %.xx: export SRC=$*.ff )
'make' ignores this kind of 'export'

Alon Blayer-Gat <alonbg>
Sun 23 May 2004 08:38:48 PM UTC, comment #1:

Why not just "%.o : SRC = $*.cc"?

Paul D. Smith <psmith>
Project Administrator
Sun 23 May 2004 02:28:11 PM UTC, original submission:

%.o: SRC=%.cc

Would be very helpfull

Regards,
Alon Blayer-Gat

Alon Blayer-Gat <alonbg>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Wed 02 Jun 2004 06:06:54 PM UTCpsmithStatusNone=>Not A Bug
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1