Question about .depends files

Joerg Sonnenberger joerg at britannica.bec.de
Wed Aug 18 08:14:02 PDT 2004


On Wed, Aug 18, 2004 at 07:45:39AM -0700, walt wrote:
> Buildkernel failed this morning, which I eventually traced to a .depend
> file in /usr/obj which was dated two days ago.  This got me wondering
> how 'make' decides, in general, whether to update a .depend file or not.
> 
> Is it always a 'manual' process, i.e. some makefile higher up has to
> do a 'make depend', or can it be done automatically by comparing
> timestamps?
> 
> Come to think of it I've never understood whether .depends files are
> mandatory or optional.  Some packages expects the user to type 
> 'make depend' and some don't.  What make the difference?
> 
> Thanks for any newbie clues you can give me.

`make depend` is used for two unrelated things.

First it is used to create source code e.g. by applying patches or
running special programs to setup header files for inclusions.
A good example for this is the newbus framework which creates e.g.
pci_if.[ch] from pci_if.m via an awk script. This has to be done first,
because otherwise compilation could not finish.

The second part is building the special file .depend, which is included
afterwards by the Makefile to update targets when e.g. a header file
changes.

In an ideal world, those two would have separate targets, because indead
the .depend file should not be mandatory and is not mandatory. IIRC noone
has done this, yet. Also there are more important parts in share/mk to be
done.

You should be fine by running `make depend` manually, but beware of a small
gotcha. If you run `make depend` and afterwards `make clean` you might get
some surprising results.

Joerg





More information about the Kernel mailing list