Subject: Re: Auto creating depend files
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 12/16/2003 15:58:52
>>> I.e autodep has proven to be a net win.
>> i've been trying to figure out exactly when one would lose with this
>> method and i've not come up with anything yet..

>Source files f1.c and f2.c include g.h.  There is a g.h in this
>directory and another in some other directory later on the include
>search path (perhaps a system directory, perhaps in a -I directory, it
>doesn't matter).

>Now, let's say someone notices that the g.h facility is (now) provided
>by the g.h in /usr/include (or ../include or whatever) and destroys the
>local g.h.  This someone notices this while fixing an unrelated bug in
>f2.c.  Now, f1.o will not be rebuilt - nothing it depends on has

That would be a bug.  If a .OPTIONAL file is missing, the thing that depended
on it should be considered out of date.  That would ensure that f1.o is
rebuilt and the dependencies corrected.

In the absence of .OPTIONAL, the build will break in the dir where f1.c is
and a make clean all there will again, rebuild f1 and ensure the dependencies
are correct.

In short, it is hard to contrive a case where you will get the wrong result.

--sjg