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

 
 

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

Submitter:  Matt McCutchen <hashproduct>
Submitted:  Tue 17 Jul 2007 05:03:31 AM UTC
Votes: 1
 
Severity:  3 - Normal Priority:  5 - 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
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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>

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by hashproduct (Voted in favor of this item)
  • -email is unavailable- added by hashproduct (Submitted the item)
  •  

    Votes

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    History

    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.16-ed84.
    Corresponding source code