# HG changeset patch # User Gustavo J. A. M. Carneiro # Date 1182425206 -3600 # Node ID 778784e6bd8dc98fec001d0f06b6e154e1a52612 # Parent 78982ea2435928356f35355f75cc0daa336bbca9 WAF: simplify --debug-level option to only have debug and optimized as possible values (debug becomes the former ultradebug); Add a warning to some options help text saying they only work in configure. diff -r 78982ea24359 -r 778784e6bd8d wscript --- a/wscript Thu Jun 21 11:59:55 2007 +0100 +++ b/wscript Thu Jun 21 12:26:46 2007 +0100 @@ -7,6 +7,7 @@ import Params import Object import pproc as subprocess +import optparse Params.g_autoconfig = 1 @@ -23,11 +24,32 @@ shutil.rmtree("doc/latex") def set_options(opt): + + def debug_option_callback(option, opt, value, parser): + if value == 'debug': + setattr(parser.values, option.dest, 'ultradebug') + elif value == 'optimized': + setattr(parser.values, option.dest, 'optimized') + else: + raise optparse.OptionValueError("allowed --debug-level values" + " are debug, optimized.") + + opt.add_option('-d', '--debug-level', + action='callback', + type=str, dest='debug_level', default='debug', + help=('Specify the debug level, does nothing if CFLAGS is set' + ' in the environment. [Allowed Values: debug, optimized].' + ' WARNING: this option only has effect ' + 'with the configure command.'), + callback=debug_option_callback) + # options provided by the modules opt.tool_options('compiler_cxx') opt.add_option('--enable-gcov', - help=('Enable code coverage analysis'), + help=('Enable code coverage analysis.' + ' WARNING: this option only has effect ' + 'with the configure command.'), action="store_true", default=False, dest='enable_gcov') @@ -61,7 +83,11 @@ # create the second environment, set the variant and set its name variant_env = conf.env.copy() - variant_name = Params.g_options.debug_level.lower() + debug_level = Params.g_options.debug_level.lower() + if debug_level == 'ultradebug': + variant_name = 'debug' + else: + variant_name = debug_level if Params.g_options.enable_gcov: variant_name += '-gcov'