[Python-Dev] addressing distutils inability to track file dependencies

Martin v. Loewis martin@v.loewis.de
15 Jun 2002 00:38:41 +0200

Skip Montanaro <skip@pobox.com> writes:

> "gcc -M" gives you all dependencies.  "gcc -MM" gives you just the stuff
> included via '#include "file"' and omits the headers included via '#include
> <file>'.  

Both options are somewhat obsolete. It requires a separate invocation
of the compiler to output the dependencies, since it outputs the
dependencies to stdout; it can't do compilation at the same time.

It is much better if compilation of a file updates the dependency
information as a side effect. For that, gcc supports -MD/-MMD since
1989; this generates dependencies in a file obtained by replacing the
.o extension of the target with .d.

SunPRO supports generation of dependency files also as a separate
compiler invocation. It also supports the undocumented environment
variable SUNPRO_DEPENDENCIES, which allows specification of the
dependency file, along with specification of directories.

GCC also supports SUNPRO_DEPENDENCIES, so this is the most effective
and portable way to get dependency file generation.