bugmake - Bugs: bug #16531, Substitution reference and...

 
 

bug #16531: Substitution reference and secondary expansion

Submitted by:  None
Submitted on:  Fri 05 May 2006 03:36:39 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.81Operating 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 04 Mar 2012 03:26:51 PM UTC, comment #4:

I think the original description is not a bug. As I said in my comment #3, because make is not parsing the contents of the parens as a variable reference (because we've escaped it), it's treating the ":" as a special character. I think this is just the behavior we have to accept: ":" is a special character to make, just like "$" and "%" (in some contexts) so it needs to be escaped sometimes. This is not always obvious but I don't see any way to make it better.

The separate issue, that escaping the colon causes problems, will be addressed by bug #16545.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Sun 07 May 2006 06:57:37 PM UTC, comment #3:

The OP is correct: it's not the "%", it's the ":". Because the variable reference is escaped, make doesn't skip over it when parsing the command line like it normally would, and instead make sees the second ":" inside the substitution reference and interprets the command as a static pattern rule (any command with two colons on the line is interpreted that way).

I tried to escape the ":" with a backslash and got a core dump (!) which I've reported as bug #16545.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Sun 07 May 2006 07:28:36 AM UTC, comment #2:

> GNU make gets confused by the % in your patsubst call.

The secondary expansion of GNU make is not that much bad. The
putsubst call works perfect without any kind of workarounds.

What the problem is "substitution reference".

.PHONY: foo.bar
.SECONDEXPANSION:
foo: $$(@:%=%.bar); @echo $^
--------
Makefile:3: *** target pattern contains no `%'. Stop.

Anonymous
Fri 05 May 2006 07:09:45 PM UTC, comment #1:

GNU make gets confused by the % in your patsubst call. You will need to add an indirection:

.PHONY: foo.bar
.SECONDEXPANSION:
p := %
foo: $$(patsubst $p,$p.bar,$$@); @echo $^

Boris Kolpackov <bosk>
Project Member
Fri 05 May 2006 03:36:39 PM UTC, original submission:

The make doesn't recognize substitution references while the
secondary expansion. I don't find any restrictive note about
this in the manual either.

--------
.PHONY: foo.bar

.SECONDEXPANSION:
#foo: $$(patsubst %,%.bar,$$@)
foo: $$(@:%=%.bar)
\t@echo $^
--------
Makefile:5: *** target pattern contains no `%'. Stop.

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

 

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

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

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 04 Mar 2012 03:26:51 PM UTCpsmithStatusNone=>Not A Bug
      Assigned toNone=>psmith
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1