changeset 06f3a4cbd585 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=06f3a4cbd585
description:
        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:

 SConstruct |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (35 lines):

diff -r 66a3187a6714 -r 06f3a4cbd585 SConstruct
--- a/SConstruct        Mon May 02 00:16:14 2011 -0400
+++ b/SConstruct        Mon May 02 12:40:31 2011 -0700
@@ -967,18 +967,24 @@
 
         # 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
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to