Date: Sun, 2 Mar 1997 13:12:43 +0200 (IST) From: Eli Zaretskii To: "Vyacheslav O. Myskin" cc: djgpp AT delorie DOT com Subject: Re: Another makefile question In-Reply-To: <271CB367F60@csd.inp.nsk.su> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.