mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Added 'debug' flags to compile and link methods, and modified code to add
'-g' flag to compiler/linker command lines when it's true.
This commit is contained in:
parent
3c045a5766
commit
ba233fbe92
1 changed files with 13 additions and 1 deletions
|
@ -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):
|
||||||
# (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):
|
||||||
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):
|
||||||
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):
|
||||||
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):
|
||||||
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):
|
||||||
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):
|
||||||
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):
|
||||||
|
|
||||||
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:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue