From ba233fbe92582abf1c779aa392b36130e1b3a7da Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Wed, 9 Feb 2000 02:17:00 +0000 Subject: [PATCH] Added 'debug' flags to compile and link methods, and modified code to add '-g' flag to compiler/linker command lines when it's true. --- Lib/distutils/unixccompiler.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index 9ace98606c3..cc0d7723adb 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -102,6 +102,7 @@ class UnixCCompiler (CCompiler): output_dir=None, macros=None, include_dirs=None, + debug=0, extra_preargs=None, extra_postargs=None): @@ -149,6 +150,8 @@ class UnixCCompiler (CCompiler): # (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 debug: + cc_args[:0] = ['-g'] if extra_preargs: cc_args[:0] = extra_preargs if extra_postargs is None: @@ -194,7 +197,8 @@ class UnixCCompiler (CCompiler): def link_static_lib (self, objects, output_libname, - output_dir=None): + output_dir=None, + debug=0): if type (objects) not in (ListType, TupleType): raise TypeError, \ @@ -234,6 +238,7 @@ class UnixCCompiler (CCompiler): output_dir=None, libraries=None, library_dirs=None, + debug=0, extra_preargs=None, extra_postargs=None): # XXX should we sanity check the library name? (eg. no @@ -244,6 +249,7 @@ class UnixCCompiler (CCompiler): output_dir, libraries, library_dirs, + debug, extra_preargs, extra_postargs) @@ -254,6 +260,7 @@ class UnixCCompiler (CCompiler): output_dir=None, libraries=None, library_dirs=None, + debug=0, extra_preargs=None, extra_postargs=None): @@ -279,6 +286,8 @@ class UnixCCompiler (CCompiler): if self.force or newer: ld_args = self.ldflags_shared + objects + \ lib_opts + ['-o', output_filename] + if debug: + ld_args[:0] = ['-g'] if extra_preargs: ld_args[:0] = extra_preargs if extra_postargs: @@ -296,6 +305,7 @@ class UnixCCompiler (CCompiler): output_dir=None, libraries=None, library_dirs=None, + debug=0, extra_preargs=None, extra_postargs=None): @@ -318,6 +328,8 @@ class UnixCCompiler (CCompiler): if self.force or newer: ld_args = objects + lib_opts + ['-o', output_filename] + if debug: + ld_args[:0] = ['-g'] if extra_preargs: ld_args[:0] = extra_preargs if extra_postargs: