help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: duplicated definition for a target


From: Leeuwesteijn,Joost
Subject: RE: duplicated definition for a target
Date: Wed, 3 May 2006 09:43:40 +0200

Hi George,
 
> --------------------
> Goo:
>       @echo "Goo"
>
> Foo: Goo
> 
> Foo:
>       @echo "Foo"
> --------------------
> when I execute make Foo, the output is,
> --------------------
> Goo
> Foo
> --------------------
> So, my question is that. Is it ok to define a target more 
> than once? Always ok or under some conditions?

Check the manual :-) Chapter 4.10 Multiple Rules for One Target (version
3.81).

'Foo : Goo' just adds a prerequisite to Foo. The actual command/recipe is
defined in the last Foo rule. This can be used to add dependencies for
example. I use:
foo.o : foo.c
    @build foo

and then I also include a makefile that contains:
foo.o : foo.h bar.h

This is the same as:
foo.o : foo.c foo.h bar.h

Regards,
Joost Leeuwesteijn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]