bugmake - Bugs: bug #20502, Allow attaching target-specific...


bug #20502: Allow attaching target-specific variables to implicit rules

Submitted by:  Matt McCutchen <hashproduct>
Submitted on:  Tue 17 Jul 2007 05:03:31 AM UTC  
Votes:  1  
Severity: 3 - NormalItem Group: Enhancement
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
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.


Tue 17 Jul 2007 05:03:31 AM UTC, original submission:

I'm using GNU make 3.81 on Fedora Core 7 Linux.

Suppose I have some documentation files, some of which use a hash symbol to mark comments and some of which use a double slash; a file's extension (.hc or .ssc) tells what format it's in. I want to generate comment-free versions of all the files. Here's the makefile:

UNCOMMENT = grep -v '^$(commentsymbol)'

all: foo.txt bar.txt
# foo.hc and bar.ssc exist

%.txt: %.hc
$(UNCOMMENT) $< -o $@

%.txt: %.ssc
$(UNCOMMENT) $< -o $@

I want to associate a target-specific variable definition for $(commentsymbol) with each implicit rule so that a target's $(commentsymbol) will be correct based on which rule was chosen to build it. Make will let me attach definitions to the target pattern %.txt, but that's no good because I can't get make to use one definition for the first rule and a different definition for the second. Make should provide a way for me attach a definition to an implicit rule. Since only one implicit rule can exist with a given target pattern and a given set of prerequisite patterns, attaching the definition to those patterns comes to the same. The syntax could be something like this:

%.txt: %.hc: commentsymbol = \#
%.txt: %.ssc: commentsymbol = //

Matt McCutchen <hashproduct>


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

Attach File(s):

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 hashproduct (Voted in favor of this item)
  • -unavailable- added by hashproduct (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 1 encouragement so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 28 Nov 2009 03:49:10 AM UTChashproductCarbon-Copy-=>Added hashproduct

    Back to the top

    Powered by Savane 3.1-cleanup1