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

Added 'debug' flags to compile and link methods, and modified code to add

'-g' flag to compiler/linker command lines when it's true.
üst 3c045a57
...@@ -102,6 +102,7 @@ class UnixCCompiler (CCompiler): ...@@ -102,6 +102,7 @@ class UnixCCompiler (CCompiler):
output_dir=None, output_dir=None,
macros=None, macros=None,
include_dirs=None, include_dirs=None,
debug=0,
extra_preargs=None, extra_preargs=None,
extra_postargs=None): extra_postargs=None):
...@@ -149,6 +150,8 @@ class UnixCCompiler (CCompiler): ...@@ -149,6 +150,8 @@ class UnixCCompiler (CCompiler):
# (will have to fix this when I add the ability to build a # (will have to fix this when I add the ability to build a
# new Python) # new Python)
cc_args = ['-c'] + pp_opts + self.ccflags + self.ccflags_shared cc_args = ['-c'] + pp_opts + self.ccflags + self.ccflags_shared
if debug:
cc_args[:0] = ['-g']
if extra_preargs: if extra_preargs:
cc_args[:0] = extra_preargs cc_args[:0] = extra_preargs
if extra_postargs is None: if extra_postargs is None:
...@@ -194,7 +197,8 @@ class UnixCCompiler (CCompiler): ...@@ -194,7 +197,8 @@ class UnixCCompiler (CCompiler):
def link_static_lib (self, def link_static_lib (self,
objects, objects,
output_libname, output_libname,
output_dir=None): output_dir=None,
debug=0):
if type (objects) not in (ListType, TupleType): if type (objects) not in (ListType, TupleType):
raise TypeError, \ raise TypeError, \
...@@ -234,6 +238,7 @@ class UnixCCompiler (CCompiler): ...@@ -234,6 +238,7 @@ class UnixCCompiler (CCompiler):
output_dir=None, output_dir=None,
libraries=None, libraries=None,
library_dirs=None, library_dirs=None,
debug=0,
extra_preargs=None, extra_preargs=None,
extra_postargs=None): extra_postargs=None):
# XXX should we sanity check the library name? (eg. no # XXX should we sanity check the library name? (eg. no
...@@ -244,6 +249,7 @@ class UnixCCompiler (CCompiler): ...@@ -244,6 +249,7 @@ class UnixCCompiler (CCompiler):
output_dir, output_dir,
libraries, libraries,
library_dirs, library_dirs,
debug,
extra_preargs, extra_preargs,
extra_postargs) extra_postargs)
...@@ -254,6 +260,7 @@ class UnixCCompiler (CCompiler): ...@@ -254,6 +260,7 @@ class UnixCCompiler (CCompiler):
output_dir=None, output_dir=None,
libraries=None, libraries=None,
library_dirs=None, library_dirs=None,
debug=0,
extra_preargs=None, extra_preargs=None,
extra_postargs=None): extra_postargs=None):
...@@ -279,6 +286,8 @@ class UnixCCompiler (CCompiler): ...@@ -279,6 +286,8 @@ class UnixCCompiler (CCompiler):
if self.force or newer: if self.force or newer:
ld_args = self.ldflags_shared + objects + \ ld_args = self.ldflags_shared + objects + \
lib_opts + ['-o', output_filename] lib_opts + ['-o', output_filename]
if debug:
ld_args[:0] = ['-g']
if extra_preargs: if extra_preargs:
ld_args[:0] = extra_preargs ld_args[:0] = extra_preargs
if extra_postargs: if extra_postargs:
...@@ -296,6 +305,7 @@ class UnixCCompiler (CCompiler): ...@@ -296,6 +305,7 @@ class UnixCCompiler (CCompiler):
output_dir=None, output_dir=None,
libraries=None, libraries=None,
library_dirs=None, library_dirs=None,
debug=0,
extra_preargs=None, extra_preargs=None,
extra_postargs=None): extra_postargs=None):
...@@ -318,6 +328,8 @@ class UnixCCompiler (CCompiler): ...@@ -318,6 +328,8 @@ class UnixCCompiler (CCompiler):
if self.force or newer: if self.force or newer:
ld_args = objects + lib_opts + ['-o', output_filename] ld_args = objects + lib_opts + ['-o', output_filename]
if debug:
ld_args[:0] = ['-g']
if extra_preargs: if extra_preargs:
ld_args[:0] = extra_preargs ld_args[:0] = extra_preargs
if extra_postargs: if extra_postargs:
......
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