Kaydet (Commit) ef6f515d authored tarafından Greg Ward's avatar Greg Ward

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.
üst 4310debb
...@@ -137,34 +137,27 @@ class UnixCCompiler (CCompiler): ...@@ -137,34 +137,27 @@ class UnixCCompiler (CCompiler):
for skipped_pair in skipped: for skipped_pair in skipped:
self.announce ("skipping %s (%s up-to-date)" % skipped_pair) self.announce ("skipping %s (%s up-to-date)" % skipped_pair)
# If anything left to compile, compile it # Build list of (source,object) tuples for convenience
if sources: srcobj = []
# XXX use of ccflags_shared means we're blithely assuming for i in range (len (sources)):
# that we're compiling for inclusion in a shared object! srcobj.append ((sources[i], objects[i]))
# (will have to fix this when I add the ability to build a
# new Python) # Compile all source files that weren't eliminated by
cc_args = ['-c'] + pp_opts + \ # 'newer_pairwise()'.
self.ccflags + self.ccflags_shared + \ # XXX use of ccflags_shared means we're blithely assuming
sources # that we're compiling for inclusion in a shared object!
if extra_preargs: # (will have to fix this when I add the ability to build a
cc_args[:0] = extra_preargs # new Python)
if extra_postargs: cc_args = ['-c'] + pp_opts + self.ccflags + self.ccflags_shared
cc_args.extend (extra_postargs) if extra_preargs:
self.spawn ([self.cc] + cc_args) cc_args[:0] = extra_preargs
if extra_postargs is None:
extra_postargs = []
# Note that compiling multiple source files in the same go like
# we've just done drops the .o file in the current directory, which for (source,object) in srcobj:
# may not be what the caller wants (depending on the 'output_dir' self.spawn ([self.cc] + cc_args +
# parameter). So, if necessary, fix that now by moving the .o [source, '-o', object] +
# files into the desired output directory. (The alternative, of extra_postargs)
# 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)
# Have to re-fetch list of object filenames, because we want to # Have to re-fetch list of object filenames, because we want to
# return *all* of them, including those that weren't recompiled on # return *all* of them, including those that weren't recompiled on
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment