Mail Archives: djgpp/1997/03/02/06:18:10
On Fri, 28 Feb 1997, Vyacheslav O. Myskin wrote:
> My question is: what's the best way to use gcc dependency-generating
> feature in a makefile? That's how I do it now:
>
> %.d: %.c
> gcc -MM $< | sed ... >$@ #don't remember the exact command line,
> #it inserts $@ between $*.o and ':'
>
> include foo.d bar.d ....
>
> It works, but when I start building from scratch make warns about lots
> of non-existent .d files before generating them. I'd like to use more
> elegant way if possible.
Prefix the `include' directive with a `-', like so:
-include foo.d bar.d ....
Note that the warning printed by Make is a *feature*, not a bug (the
GNU Make manual mentions this warning), so you might as well live with
it. The disadvantages of the silent `-include' are that (1) it is not
so portable to other Make's; and (2) if Make cannot find or generate
the include'd files at all, you don't get any message to that effect.
- Raw text -