Subject: Re: Auto creating depend files
To: <>
From: David Laight <>
List: tech-toolchain
Date: 12/15/2003 20:15:18
On Mon, Dec 15, 2003 at 09:33:06AM +1100, matthew green wrote:
>    This means that incorrect dependencies are used the first time a source
>    file is rebuilt, but after that they self correct.  It also completely
>    removes the need for a 'make depend' pass.
> i think this is actually a step backwards.  we may lose the make depend
> step, but we gain incorrectness...  now i have to run 'make all' twice
> to be sure, which is _way_ slower than 'make dependall' once.

I beg to differ.
'make dependall' only regenerates the .depend file if the source file
itself has changed.  If that is true the file will be recompiled.
The 'autodepend' will remake the .depend file if any one the dependant
files have changed.

So if I have (now):

$ echo '#include <a.h>' >x.c
$ echo '#include <b.h>' >a.h
$ echo 'extern int b;' >b.h
x.d will contain a.h and b.h

If I then do:
$ echo '#include <c.h>' >a.h; mv b.h c.h
then 'make dependall' won't change x.d [1] so after 'touch c.h' x.o
won't be recreated.

[1] The first build actually dies badly until you play 'hunt the obsolete
file' in all the '*.d' files. The .OPTIONAL makes it all build...

With the proposed change the first recompilation will regenerate x.d as
part of the build process (when it is quick) so that x.o will then depend
on c.h.


David Laight: