summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/unixccompiler.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-02-03 23:07:19 (GMT)
committerGreg Ward <gward@python.net>2000-02-03 23:07:19 (GMT)
commitef6f515d4994662fcec3e7b272232678e0c3b1e8 (patch)
tree43fd783808f0f8fc6e7d31250e96f2ba0d3766d5 /Lib/distutils/unixccompiler.py
parent4310debbd82443515d725519b96a8823d8b098ef (diff)
downloadcpython-ef6f515d4994662fcec3e7b272232678e0c3b1e8.zip
cpython-ef6f515d4994662fcec3e7b272232678e0c3b1e8.tar.gz
cpython-ef6f515d4994662fcec3e7b272232678e0c3b1e8.tar.bz2
Changed 'compile()' method to compile files one-at-a-time -- gives better
feedback and, theoretically, the opportunity to set compiler flags on a per-file basis.
Diffstat (limited to 'Lib/distutils/unixccompiler.py')
-rw-r--r--Lib/distutils/unixccompiler.py49
1 files changed, 21 insertions, 28 deletions
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index fb58269..9ace986 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -137,34 +137,27 @@ class UnixCCompiler (CCompiler):
for skipped_pair in skipped:
self.announce ("skipping %s (%s up-to-date)" % skipped_pair)
- # If anything left to compile, compile it
- if sources:
- # XXX use of ccflags_shared means we're blithely assuming
- # that we're compiling for inclusion in a shared object!
- # (will have to fix this when I add the ability to build a
- # new Python)
- cc_args = ['-c'] + pp_opts + \
- self.ccflags + self.ccflags_shared + \
- sources
- if extra_preargs:
- cc_args[:0] = extra_preargs
- if extra_postargs:
- cc_args.extend (extra_postargs)
- self.spawn ([self.cc] + cc_args)
-
-
- # Note that compiling multiple source files in the same go like
- # we've just done drops the .o file in the current directory, which
- # may not be what the caller wants (depending on the 'output_dir'
- # parameter). So, if necessary, fix that now by moving the .o
- # files into the desired output directory. (The alternative, of
- # course, is to compile one-at-a-time with a -o option. 6 of one,
- # 12/2 of the other...)
-
- if output_dir:
- for i in range (len (objects)):
- src = os.path.basename (objects[i])
- objects[i] = self.move_file (src, output_dir)
+ # Build list of (source,object) tuples for convenience
+ srcobj = []
+ for i in range (len (sources)):
+ srcobj.append ((sources[i], objects[i]))
+
+ # Compile all source files that weren't eliminated by
+ # 'newer_pairwise()'.
+ # XXX use of ccflags_shared means we're blithely assuming
+ # that we're compiling for inclusion in a shared object!
+ # (will have to fix this when I add the ability to build a
+ # new Python)
+ cc_args = ['-c'] + pp_opts + self.ccflags + self.ccflags_shared
+ if extra_preargs:
+ cc_args[:0] = extra_preargs
+ if extra_postargs is None:
+ extra_postargs = []
+
+ for (source,object) in srcobj:
+ self.spawn ([self.cc] + cc_args +
+ [source, '-o', object] +
+ extra_postargs)
# Have to re-fetch list of object filenames, because we want to
# return *all* of them, including those that weren't recompiled on