bugmake - Bugs: bug #9760, Cannot add pattern or suffix rule...

 
 

bug #9760: Cannot add pattern or suffix rule through define/eval

Submitted by:  None
Submitted on:  Sun 25 Jul 2004 06:52:47 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.80Operating System: POSIX-Based
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.

 

Sun 25 Jul 2004 11:20:03 PM UTC, comment #1:

This is not a bug. You have a number of syntax errors here. First, the first argument to $(call ...) is supposed to be a variable NAME, not a reference to a variable. You are basically having make try to look up a variable name which is the expanded definition of the "rule" variable, which of course does not exist. So, the eval is evaluating the empty string.

Second, even if you changed this to $(call rule) it wouldn't work. Call will evaluate the variable value and that means any unescaped variable references will be expanded, and in this context (before the eval) $@ and $< are empty, so you'd get a command script like "gcc -o" with no variable references. You'd need to escape them with $$@ and $$<.

But, the basic problem is you don't need call at all. Call should only be used if you have a user-defined function that contains variables that need to be replaced, and you don't have that here.

Just eval the variable directly:

$(eval $(value rule))

Paul D. Smith <psmith>
Project Administrator
Sun 25 Jul 2004 06:52:47 PM UTC, original submission:

A simple makefile that uses a pattern or suffix rule works fine:

.SUFFIXES: .xx
.cc.xx:
^Tgcc -o $@ $<
all : a.xx

or

%.xx : %.cc
^Tgcc -o $@ $<
all : a.xx

However, one cannot insert the rule dynamically:

define rule
%.xx : %.cc
^Tgcc -o $@ $<
endef
$(eval $(call $(rule)))
all : a.xx

make: *** No rule to make target `a.xx',
needed by `all'. Stop.

I realize most bugs submitted here are dups; this probably is as well, though I honestly did look for similar bugs.

Anonymous

 

(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
Sun 25 Jul 2004 11:20:03 PM UTCpsmithStatusNone=>Not A Bug
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1