02_debug_symbols.patch Paul Wise Add an option to generate debugging symbols without side-effects on optimisation flags and an option to enable/disable optimisation Index: SCons/Config/gnu =================================================================== --- SCons/Config/gnu.orig 2007-02-02 20:34:33.000000000 +1100 +++ SCons/Config/gnu 2007-02-08 15:33:51.000000000 +1100 @@ -81,13 +81,16 @@ makensis_env = defenv.Copy() -if not defenv['DEBUG']: - makensis_env.Append(CCFLAGS = '-O2') # optimize +if defenv['DEBUG_SYMBOLS']: + makensis_env.Append(CCFLAGS = '-g') # debugging + makensis_env.Append(LINKFLAGS = '-g') # debugging +if not defenv['DEBUG'] and defenv['OPT']: + makensis_env.Append(CCFLAGS = '-O2') # optimize makensis_env.Append(CCFLAGS = '-Wall') # all warnings conf = FlagsConfigure(makensis_env) conf.CheckLinkFlag('$MAP_FLAG') # generate map file -if not defenv['DEBUG']: +if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS']: TestStrip(conf) # strip conf.Finish() @@ -110,13 +113,16 @@ cp_util_env = defenv.Copy() -if not defenv['DEBUG']: +if defenv['DEBUG_SYMBOLS']: + cp_util_env.Append(CCFLAGS = '-g') # debugging + cp_util_env.Append(LINKFLAGS = '-g') # debugging +if not defenv['DEBUG'] and defenv['OPT']: cp_util_env.Append(CCFLAGS = '-O2') # optimize cp_util_env.Append(CCFLAGS = '-Wall') # all warnings conf = FlagsConfigure(cp_util_env) conf.CheckLinkFlag('$MAP_FLAG') # generate map file -if not defenv['DEBUG']: +if not defenv['DEBUG'] and not defenv['DEBUG_SYMBOLS']: TestStrip(conf) # strip conf.Finish() @@ -131,6 +137,9 @@ ### test environment test_env = defenv.Copy() +if defenv['DEBUG_SYMBOLS']: + test_env.Append(LINKFLAGS = '-g') # debugging + test_env.Append(CCFLAGS = '-g') # debugging ### weird GCC requirements Index: SConstruct =================================================================== --- SConstruct.orig 2007-02-02 20:34:33.000000000 +1100 +++ SConstruct 2007-02-08 15:48:40.000000000 +1100 @@ -127,6 +127,8 @@ opts.Add(PathOption('LIBPATH', 'Path to search for libraries', None)) # build options opts.Add(BoolOption('DEBUG', 'Build executables with debugging information', 'no')) +opts.Add(BoolOption('DEBUG_SYMBOLS', 'Build with debugging information, but none of the side effects of DEBUG', 'no')) +opts.Add(BoolOption('OPT', 'Build with optimization', 'yes')) opts.Add(PathOption('CODESIGNER', 'A program used to sign executables', None)) # path related build options opts.Add(('PREFIX_DEST', 'Intermediate installation prefix (extra install time prefix)', dirs['dest']))