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

Jeremy Hylton jeremy@zope.com
Mon, 17 Jun 2002 10:30:24 -0400

>>>>> "MvL" == Martin v Loewis <martin@v.loewis.de> writes:

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

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?

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.

This doesn't involve make because the only thing make would do for us
is check the dependencies and invoke the compiler.  distutils already
knows how to do both those things.