From f713af951a6bfd0953fba801b72513b82469fdeb Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Mon, 2 May 2011 12:40:31 -0700 Subject: scons: allow use of current builds as default build settings Currently the --default= option only looks at the predefined build configs (in m5/build_opts), so you're limited to basing a new build config off of those (ALPHA_SE, etc.). If you've already defined a non-standard build config and want to clone it or tweak it, you have to start from scratch. This patch causes --default= to look first among the existing builds (in build/variables) before looking in build_opts so you can specify an existing non-standard build config as a starting point for a new config. --- SConstruct | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index eee1c78e8..012b968f1 100755 --- a/SConstruct +++ b/SConstruct @@ -967,18 +967,24 @@ for variant_path in variant_paths: # Get default build variables from source tree. Variables are # normally determined by name of $VARIANT_DIR, but can be - # overriden by 'default=' arg on command line. + # overridden by '--default=' arg on command line. default = GetOption('default') - if not default: - default = variant_dir - default_vars_file = joinpath('build_opts', default) - if isfile(default_vars_file): + opts_dir = joinpath(main.root.abspath, 'build_opts') + if default: + default_vars_files = [joinpath(build_root, 'variables', default), + joinpath(opts_dir, default)] + else: + default_vars_files = [joinpath(opts_dir, variant_dir)] + existing_files = filter(isfile, default_vars_files) + if existing_files: + default_vars_file = existing_files[0] sticky_vars.files.append(default_vars_file) print "Variables file %s not found,\n using defaults in %s" \ % (current_vars_file, default_vars_file) else: - print "Error: cannot find variables file %s or %s" \ - % (current_vars_file, default_vars_file) + print "Error: cannot find variables file %s or " \ + "default file(s) %s" \ + % (current_vars_file, ' or '.join(default_vars_files)) Exit(1) # Apply current variable settings to env -- cgit v1.2.3