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 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  3.81 Operating System:  POSIX-Based
Fixed Release:  None Triage 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 Files:

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 hashproduct (Voted in favor of this item)
  • -email is unavailable- added by hashproduct (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 1 encouragement so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-11-28 hashproduct Carbon-Copy- => Added hashproduct

    Back to the top

    Powered by Savane 3.3