diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2017-04-05 21:56:08 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2017-04-10 17:35:58 +0200 |
commit | a448495dbef6809b2837e07c4fc9c2657e1d67a2 (patch) | |
tree | 7f1e2cfd358870a00161d3494ba2dee439b6c026 /numpy/distutils/unixccompiler.py | |
parent | 38e152a4272f79772b48f7232fc7f3a8ebbf61a6 (diff) | |
download | numpy-a448495dbef6809b2837e07c4fc9c2657e1d67a2.tar.gz |
ENH: automatically determine compile dependencies
Use these dependencies to avoid unnecessary recompilations of unchanged
files.
Diffstat (limited to 'numpy/distutils/unixccompiler.py')
-rw-r--r-- | numpy/distutils/unixccompiler.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py index a92ccd3e7..307b56ce4 100644 --- a/numpy/distutils/unixccompiler.py +++ b/numpy/distutils/unixccompiler.py @@ -44,8 +44,16 @@ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts self.linker_so = llink_s.split() + opt.split() display = '%s: %s' % (os.path.basename(self.compiler_so[0]), src) + + # gcc style automatic dependencies, outputs a makefile (-MF) that lists + # all headers needed by a c file as a side effect of compilation (-MMD) + if getattr(self, '_auto_depends', False): + deps = ['-MMD', '-MF', obj + '.d'] + else: + deps = [] + try: - self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + + self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + deps + extra_postargs, display = display) except DistutilsExecError: msg = str(get_exception()) |