bugmake - Bugs: bug #51414, Use of multiple $$% (for...

 
 

bug #51414: Use of multiple $$% (for .SECONDEXPANSION) causes make to misinterpret the rule as a pattern rule

Submitted by:  None
Submitted on:  Fri 07 Jul 2017 01:15:19 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 4.2.1Operating System: None
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 09 Jul 2017 09:26:49 PM UTC, comment #1:

Actually what's happening is that your rule is being misinterpreted as a static pattern rule, not a pattern rule, and it's not because you are using $$%, it's because you are using a substitution reference in a secondary expansion. Also it doesn't matter how many uses of "$$%" you use; even one substitution reference will show this problem.

Because you have used "$$" in the prerequisites list, make doesn't interpret this as a variable reference. That means the open parenthesis is not part of a variable reference and has no special meaning to make. So when make sees this:

it tokenizes this string as "blahblah", ":", "$$(%", ":", "blah)". The ":" IS a special character to make, it's a rule separator. When make sees a word containing the special character "%" between two ":" characters it interprets this to be a static pattern rule. Because the "target" doesn't match the pattern, you get this error.

I don't see any way to solve this problem: the grammar here is simply ambiguous and make can't know what you mean.

In order to do what you want you cannot use a substitution reference (directly) because of the ":" character in it. You can either use a patsubst function:

(here there's no ":" in the prereq list so it works). Or you can use a variable to hide the ":" and ensure that make parses things correctly:

Paul D. Smith <psmith>
Project Administrator
Fri 07 Jul 2017 01:15:19 PM UTC, original submission:

Minimal test Makefile:

.SECONDEXPANSION:

libmy.a(my_source.o): $$(%:_source.o=)_internal.h $$(%:_source.o=)_api.h

Resulting error message:

../test_makefile:2: target 'libmy.a(my_source.o)' doesn't match the target pattern

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

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 09 Jul 2017 09:26:49 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1