[Python-Dev] addressing distutils inability to track file dependencies
Guido van Rossum
guido@python.org
Mon, 17 Jun 2002 10:47:38 -0400
> Here's a rough strategy for exploiting this feature in distutils.
> Does it make sense? Happily, I can't see any possible use of make.
>
> There is an option to enable dependency tracking. Not sure how the
> option is passed: command line (tedious), setup (not easily customized
> by user), does distutils have a user options file of some sort?
We could make the configure script check for GCC, and if detected, add
-MD to it.
> Each time distutils compiles a file it passes the -MD file to generate
> a .d file.
>
> On subsequent compilations, it checks for the .d file. If the .d file
> does not exist or is older than the .c file, it recompiles.
> Otherwise, it parses the .d file and compares the times for each of
> the dependencies.
Sounds good. It could skip parsing the .d file if the .o file
doesn't exist or is older than the .c file. If there is no .d file, I
would suggest only recompiling if the .c file is newer than the .o
file (otherwise systems without GCC will see recompilation of
everything all the time -- not a good idea IMO.)
Go ahead and implement this!
--Guido van Rossum (home page: http://www.python.org/~guido/)