The behavior you're getting is correct.  When you list two targets, it isn't 
just for convienience so you don't have to type the rule twice.  If a rule 
creates both targets for some reason, you only want the rule to run once.  
This is for rules that create multiple files.

For example, I have a script that does heavy parsing of a data file and 
produces 4 different outputs.  Each is derived from a single source file, but 
4 output files are created so that the file doesn't have to be parsed 4 
seperate times.

One can assume that if the files have the same pattern for %, then they're 
related and can be made by the same rule.  If different patterns for % need 
to be made, then it seems logical to run two rules to create them.

$@ only represents the filename that caused the rule to execute, hence the 
reason why "touch a.foo a.bar" isn't running.

You need to do this to get the behavior you want:

%.foo :
        touch $@

%.bar :
        touch $@

if the rule is particulary complex, then simply define it as a variable like:

MAKE_FOO_OR_BAR = touch $@

%.foo :
        $(MAKE_FOO_OR_BAR)

%.bar :
        $(MAKE_FOO_OR_BAR)

(note that you *don't* use := to assign since this would expand the $@ 
prematurely)

Mike Gibson


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to