On Mon, Nov 23, 2009 at 10:58 PM, Paul Smith <psm...@gnu.org> wrote: > On Mon, 2009-11-23 at 22:13 -0600, Peng Yu wrote: >> $< refers to the first prerequisite. How to refer to the first target? > > Not sure what you mean: generally there is only one target. > > If you mean in a pattern rule with multiple target patterns, there is no > way. You can construct it with $*, but since, unlike prerequisites, all > targets have to be defined right there in the rule it's not as important > to be able to generically refer to the "first" target.
Suppose I have 'command.sh' that generate files 'a' and 'b'. If either of 'a' or 'b' is older than 'command.sh', I need to run 'command.sh' again. The following Makefile has two targets, right? I want to refer to the second target 'b' in this Makefile. $ cat Makefile all: a b a b: command.sh ./command.sh $ cat command.sh echo 'a' > a echo 'b' > b _______________________________________________ Help-make mailing list Help-make@gnu.org http://lists.gnu.org/mailman/listinfo/help-make