make dep gotchas

Keith Owens (
Fri, 1 Nov 1996 10:45:06 +1100 (EST)

Following a few posts about "when should I run make dep?", I took a look
at the .depend process, there are a couple of things that (IMHO) need to
be better documented and put in Documentation/ or as updates to the
Kernel-howto. I'll do it but I want to check the facts first, please
email corrections where I've got it wrong.

Some users seem to think that you only need to run make dep after
changing a configuration option and not at any other time. Wrong
and possibly causing some of the unreproducible problems posted to
the lists. Maybe bug reporting should say "first recompile with
'make dep clean zImage modules modules_install && lilo' then
reproduce the bug".

Since make dep tracks the relationship of source to headers
(current_directory/.depend) and headers to headers (top_dir/.hdepend),
make dep must be run after *any* change that affects this relationship.
This includes :-

1) Configuration changes.

2) Applying a patch that :-

a) adds a header to an existing source or header file.
b) deletes a header from an existing source or header file.
c) changes the name of an existing header.
d) It's too messy to check, always do 'make dep clean' after
applying patches.

3) Renaming or copying the linux source directory!

The .depend files contain the name of the source directory, if
you rename/copy to another directory, your dependencies are
still pointing at the old directory. If you make any changes
to your headers then sources do *not* get recompiled unless you
first make dep.

Caused me a couple of hours of problems when manually changing
headers and some sources in a copy of /usr/src/linux. The
.depend and .hdepend files were still pointing at the original
source tree, in the copied tree only the changed sources got
recompiled instead of all sources affected by the header changes.

4) Anything else?

email please and I'll summarise, no need to clutter up the list.