[Xorp-cvs] SF.net SVN: xorp:[11596] trunk/xorp/SConstruct
bms_fbsd at users.sourceforge.net
bms_fbsd at users.sourceforge.net
Thu Nov 26 18:28:49 PST 2009
Revision: 11596
http://xorp.svn.sourceforge.net/xorp/?rev=11596&view=rev
Author: bms_fbsd
Date: 2009-11-27 02:28:48 +0000 (Fri, 27 Nov 2009)
Log Message:
-----------
Add a 'debug' command line variable which can be used to set
the debug symbol level in a portable way. CFLAGS/CXXFLAGS will be
sanitized to enforce this option, unless 'debug' is set to 'override'.
This switch only affects the build as it is being staged; if 'strip'
is enabled, debug information will be stripped on a 'scons install'
as before.
Set the default to 'full', which passes -g3 to gcc and g++. This seems
reasonable, as most folk building from SVN will want full debug information.
On ELF platforms, DWARF-2 normally will be used, and -g3 will produce
richer C++ debugging information in the DWARF sections.
Update comments.
Approximate disk usage of $BUILDDIR for an amd64 self-hosted build,
with optimize=yes (gcc/g++ -O1):-
705M with debug=yes (the old default)
831M with debug=full (the new default)
Modified Paths:
--------------
trunk/xorp/SConstruct
Modified: trunk/xorp/SConstruct
===================================================================
--- trunk/xorp/SConstruct 2009-11-27 01:53:26 UTC (rev 11595)
+++ trunk/xorp/SConstruct 2009-11-27 02:28:48 UTC (rev 11596)
@@ -69,6 +69,9 @@
BoolVariable('debug_msg', 'Build with debug messages', False),
BoolVariable('debug_fn', 'Build with function names in debug_msg output', False),
BoolVariable('debug_cb', 'Build with callback debugging', False),
+ EnumVariable('debug', 'Build with debug symbols', 'full',
+ allowed_values=('no', 'yes', 'full', 'override'),
+ map={}, ignorecase=2),
EnumVariable('optimize', 'Build with optimization', 'yes',
allowed_values=('no', 'yes', 'full', 'size', 'override'),
map={}, ignorecase=2),
@@ -166,9 +169,12 @@
env['AUTOTEST_SKIP_ERRORS'] = True
print 'Ignore check errors: ', env['AUTOTEST_SKIP_ERRORS']
+# NOTE: Enabling debug messages for the whole tree may not be what you want,
+# as it can lead to premature timeouts.
+# Enabling callback debugging is currently not advised as it does
+# inline printfs.
+print 'Debug symbols: ', env['debug']
print 'Debug STL: ', env['debug_stl']
-# XXX Enabling debug messages for the whole tree may not be what you want,
-# as it can lead to premature timeouts.
print 'Debug messages: ', env['debug_msg']
print 'Debug function names: ', env['debug_fn']
print 'Debug callbacks: ', env['debug_cb']
@@ -349,9 +355,9 @@
SCons.Tool.FindTool(['g++'], env) is None:
print gnutoolwarning % 'gcc or g++ compiler'
-env.AppendUnique( CFLAGS = Split(ARGUMENTS.get('CFLAGS', "-g")) )
-env.AppendUnique( CXXFLAGS = Split(ARGUMENTS.get('CXXFLAGS', "-g")) )
-env.AppendUnique( LINKFLAGS = Split(ARGUMENTS.get('LINKFLAGS', "")) )
+env.AppendUnique( CFLAGS = Split(ARGUMENTS.get('CFLAGS', '')) )
+env.AppendUnique( CXXFLAGS = Split(ARGUMENTS.get('CXXFLAGS', '')) )
+env.AppendUnique( LINKFLAGS = Split(ARGUMENTS.get('LINKFLAGS', '')) )
# If the user didn't override our default optimization, then
# sanitize user's CFLAGS/CXXFLAGS to not contain optimization options,
@@ -366,6 +372,17 @@
env.AppendUnique(CFLAGS = [ bigoflag ])
env.AppendUnique(CXXFLAGS = [ bigoflag ])
+# Do the same for the flags which control debug symbols.
+if not env['debug'] == 'override':
+ env.Replace( CFLAGS = filter(lambda s: not s.startswith('-g'),
+ Split(env['CFLAGS'])))
+ env.Replace( CXXFLAGS = filter(lambda s: not s.startswith('-g'),
+ Split(env['CXXFLAGS'])))
+ gdict = { 'no': '', 'yes': '-g', 'full': '-g3' }
+ gflag = gdict[env['debug']]
+ env.AppendUnique(CFLAGS = [ gflag ])
+ env.AppendUnique(CXXFLAGS = [ gflag ])
+
env.AppendUnique(CPPDEFINES = [
( '_FORTIFY_SOURCE', 0 ),
])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Xorp-cvs
mailing list