bugmake - Bugs: bug #26001, Evaluating eval expressions does...

 
 

bug #26001: Evaluating eval expressions does not work for % type names

Submitter:  None
Submitted:  Wed 25 Mar 2009 11:42:30 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.81 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 31 May 2009 08:11:39 PM UTC, comment #2: 

Olexiy is mostly correct: if you don't escape the call then it will be expanded as the makefile is read in, as with all variables and functions that appear in prerequisites.  At that time, the pattern "%" is not a special value so basically you're calling the reversLookup function with the literal string "file%", which obviously won't do what you want.

What you need to do, if you want to do this, is define the .SECONDEXPANSION: pseudo-target then do something like:

file%: $$(call reverseLookup,$$@)

See the section on "Secondary Expansion" in the GNU make manual.

Paul D. Smith <psmith>
Group administrator
Thu 26 Mar 2009 04:00:27 PM UTC, comment #1: 

I think you have to use two dollars.
try next

file%: $$(call reverseLookup,file%)


Olexiy Buyanskyy <olexiyb>
Wed 25 Mar 2009 11:42:30 PM UTC, original submission:  


I have a situation where I have one to many compilation stage. Essentially, I have one file that when "compiled"/loaded creates N number of output files.

Now , I have a makefile that I want to set up a dependency where if any of those compiled files were older than the original then I want to re-compile the original file and remake the N files over again.

So, what I did was create a simple reverse mapping function using the define ...endef expression.

However, I cannot apply this in a rule . For instance


file%:  $(call reverseLookup,file%)

will fail.  although this will not

FILE1: $(call reverseLookup,file1)

file%: $(FILE1)

And this works as well

FILE1: $(call reverseLookup,file1)

file%: $(FILE1)
       @echo "Your dependency was $(call reverseLookup,$@)"







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)
  • -email is unavailable- added by olexiyb (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
    2009-05-31 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code