[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to deal if source code and object file are in different director
Re: how to deal if source code and object file are in different directory?
Thu, 31 Aug 2006 02:25:44 -0700 (PDT)
Thank you for your comments, Philip!
I have read related parts of GNU Make manual and it is
very informative. I have also updated my Makefile
according to your comments. Please help to check
whether it is better now. :-)
I think in this way, it is more elegant according to
your comments. Agree?
Then, I think I need a rule to compile foo.c and goo.c
from src directory into foo.o and goo.c to debug
directory. Do you know how to write such a rule?
--- Philip Guenther <address@hidden> wrote:
> On 8/31/06, Lin George <address@hidden>
> > I have two further questions,
> > 1. when you say "a pattern rule" or "static
> > rule", do you mean the built-in implicit rules of
> > Make?
> Nope. The terms "pattern rule" and "static pattern
> rule" are
> described in the GNU make info pages. Please check
> there for the full
> > 2. This line you suggested,
> > > $(OBJ_DIR): debug/%.o: src/%.c
> > I am confused about it. Since there are two :
> > means two dependencies? In one line?
> Nope. The presence of two colons is part of what
> makes this a static
> pattern rule. That line specifies that for each
> file in the
> $(OBJ_DIR) variable, make should try to match the
> pattern "debug/%.o"
> against it. If that succeeds, then make should act
> like there's a
> rule building that file with a dependency on the
> matching file
> Philip Guenther
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around