summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2011-05-02 12:40:31 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2011-05-02 12:40:31 -0700
commitf713af951a6bfd0953fba801b72513b82469fdeb (patch)
tree95be7ecade6a64ba415127478f3d4a5da0a2e249 /SConstruct
parentdd95bc4d44d124abec3580f95db725895027bd1c (diff)
downloadgem5-f713af951a6bfd0953fba801b72513b82469fdeb.tar.xz
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.
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct20
1 files changed, 13 insertions, 7 deletions
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