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

Thomas Heller thomas.heller@ion-tof.com
Fri, 14 Jun 2002 22:23:17 +0200

From: "Skip Montanaro" <skip@pobox.com>
>     >> Gcc has had good dependency checking for probably ten years.
>     Guido> How do you invoke this?  Maybe we can use this to our advantage.
> "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>'.  Programmers use <file> and "file" inconsistently enough that it's
> probably better to just use -M and eliminate the files you don't care about
> (or leave them in and have Python rebuild automatically after OS upgrades).
> There are several other variants as well.  Search the GCC man page for "-M".
> It seems to me that distutils' base compiler class could provide a generic
> makedepend-like method which could be overridden in subclasses where
> specific compilers have better builtin schemes for dependency generation.

MSVC could do something similar with the /E or /P flag (preprocess
to standard out or to file). A simple python filter looking for #line
directives could then collect the dependencies.
Isn't -E and -P also available in any unixish compiler?