From: "Philip Guenther" <address@hidden>
To: "sharan basappa" <address@hidden>
CC: address@hidden
Subject: Re: multiple targets in a rule
Date: Mon, 25 Jun 2007 10:02:04 -0600
On 6/25/07, sharan basappa <address@hidden> wrote:
This looks very simple .. somehow I cant figure it out ..
...
I have a simple make with one rule that says :
a.o b.o : a.c
When I execute this make all I get is
Updating goal targets....
Considering target file `a.o'.
...
Successfully remade target file `a.o'.
Is there a reason why target b.o is considered by make ?
a.o and b.o are distinct targets. The fact that you've specified a
common dependency for them using a single line does not change that.
The make info pages say this about how make selects the default goal:
By default, `make' starts with the first target (not targets whose
names start with `.'). This is called the "default goal".
The first target in your makefile is "a.o". Therefore, if you don't
otherwise specify a goal, simply running "make" will only build a.o
and its dependencies. If you want a.o and b.o to both be built by
default, the traditional technique is to do so by putting the 'all'
target first and making them both dependencies of that target:
all: a.o b.o
a.o b.o: a.c
Philip Guenther