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.
This commit is contained in:
parent
dd95bc4d44
commit
f713af951a
1 changed files with 13 additions and 7 deletions
20
SConstruct
20
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
|
||||
|
|
Loading…
Reference in a new issue