]> git.ipfire.org Git - thirdparty/git.git/commit - Makefile
Makefile: lazily compute header dependencies
authorJonathan Nieder <jrnieder@gmail.com>
Tue, 26 Jan 2010 15:52:49 +0000 (09:52 -0600)
committerJonathan Nieder <jrnieder@gmail.com>
Tue, 26 Jan 2010 16:08:55 +0000 (10:08 -0600)
commitdfea575017ddc2ae7c9e8dcb978f4557f07715d3
tree9e1e30e1fe6accd016c8be2b892044148f3acacc
parentc373991375a4903dbb9bea69e2ce11ce819253e2
Makefile: lazily compute header dependencies

Use the gcc -MMD -MP -MF options to generate dependency rules as
a byproduct when building .o files if the
COMPUTE_HEADER_DEPENDENCIES variable is defined.  That variable
is left undefined by default for now.

As each object file is built, write a makefile fragment
containing its dependencies in the deps/ subdirectory of its
containing directory.  The deps/ directories should be generated
if they are missing at the start of each build.  So let each
object file depend on $(missing_dep_dirs), which lists only the
directories of this kind that are missing to avoid needlessly
regenerating files when the directories' timestamps change.

gcc learned the -MMD -MP -MF options in version 3.0, so most gcc
users should have them by now.

The dependencies this option computes are more specific than the
rough estimates hard-coded in the Makefile, greatly speeding up
rebuilds when only a little-used header file has changed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
.gitignore
Makefile