bugmake - Bugs: bug #27047, Difficulties defining...

 
 

bug #27047: Difficulties defining prerequisites for pattern targets.

Submitted by:  Robert L Walton <walton>
Submitted on:  Fri 17 Jul 2009 10:18:57 AM UTC  
 
Severity: 3 - NormalItem Group: Enhancement
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/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 02 Aug 2009 12:27:20 AM UTC, comment #4:

The failure you are reporting is actually documented behavior; the documentation for target-specific variables says:

As with automatic variables, these values are only available within the context of a target's command script (and in other target-specific assignments).

So, they are not available for expansion in prerequisites.

As Boris points out you can use the secondary expansion feature for this, at a slight performance penalty.

As for the pattern rule canceling behavior: I agree it's probably not the best choice but it's been like that in GNU make since pattern rules were invented and can't be changed now.

Paul D. Smith <psmith>
Project Administrator
Fri 17 Jul 2009 10:57:19 PM UTC, comment #3:

You can get the desired behavior using the second expansion feature (note $$):

.SECONDEXPANSION:

all: test1001.out

foo:
@echo making foo

test1%.out: TEST=foo

test%.out: $${TEST}
@echo making test$*.out with TEST=${TEST}

Boris Kolpackov <bosk>
Project Member
Fri 17 Jul 2009 08:22:39 PM UTC, comment #2:

Fails in the sense that applying `make' to

produces

when I would like it to produce

The pattern specific variable is not substituted in the first
${TEST}.

Pattern specific variables get substituted in the commands but NOT the prerequisites, apparently.

The use of pattern targets without commands to cancel previous pattern target rules is unfortunate, since it conflicts with the common non-pattern use of adding prerequisites. Too bad. Worse, the cancel usage is obscure and the failure of the prerequisite use is confusing to debug.

(file #18435)

Robert L Walton <walton>
Fri 17 Jul 2009 12:46:19 PM UTC, comment #1:

Pattern rules with no commands ARE recognized, just not as you are thinking. This is documented: http://www.gnu.org/software/make/manual/html_node/Canceling-Rules.html#Canceling-Rules

As for your second point, in what way do they fail? Certainly target specific variables can be used as you show; they are called pattern-specific varibles, as defined here: http://www.gnu.org/software/make/manual/html_node/Pattern_002dspecific.html#Pattern_002dspecific

Can you provide specific examples of what you mean by "fails"? If there is a real bug here I'll reopen this report.

Paul D. Smith <psmith>
Project Administrator
Fri 17 Jul 2009 10:18:57 AM UTC, original submission:

Implicit rules with a pattern target are NOT recognized if they have no commands.

This means they cannot be used to define prerequisites. I.e.

does'nt do anything. Also

fails because target specific variables cannot be used in prerequisite list.

Something should be done to make this so users don't get trapped
by it an have to waste a lot of time figuring all this out. Perhaps a pattern rule with no commands could give a warning message, at a minimum. It would be nice if target specific variables could appear in prerequisites.
~

Robert L Walton <walton>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #18435:  Makefile added by walton (127B - application/octet-stream - Makefile that fails to do what I want.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bosk (Posted a comment)
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by walton (Submitted the item)
  •  

    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
    Fri 17 Jul 2009 08:22:38 PM UTCwaltonAttached File-=>Added Makefile, #18435
    Fri 17 Jul 2009 12:46:19 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1