delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/02/06:18:10

Date: Sun, 2 Mar 1997 13:12:43 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Vyacheslav O. Myskin" <V DOT O DOT Myskin AT inp DOT nsk DOT su>
cc: djgpp AT delorie DOT com
Subject: Re: Another makefile question
In-Reply-To: <271CB367F60@csd.inp.nsk.su>
Message-ID: <Pine.SUN.3.91.970302131206.6609H-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019