On Wed, 2009-11-25 at 19:59 -0600, Peng Yu wrote:
> 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

You seem to be under the impression that this rule means that make will
invoke your command.sh one time only, and believe that it generates two
different files.

That's not what this means.

The rule you've written above is _identical_ to, just shorthand for,
writing this:

        a: command.sh
                ./command.sh
        b: command.sh
                ./command.sh

So, in this case, there is only one target file each time command.sh is
invoked, and the name of that target will be stored in $...@.  So the first
time command.sh is invoked, $@ will be set to "a" and the second time it
will be set to "b".

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email protected]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to