SConstruct revision 4773
1955SN/A# -*- mode:python -*-
2955SN/A
35871Snate@binkert.org# Copyright (c) 2004-2005 The Regents of The University of Michigan
41762SN/A# All rights reserved.
5955SN/A#
6955SN/A# Redistribution and use in source and binary forms, with or without
7955SN/A# modification, are permitted provided that the following conditions are
8955SN/A# met: redistributions of source code must retain the above copyright
9955SN/A# notice, this list of conditions and the following disclaimer;
10955SN/A# redistributions in binary form must reproduce the above copyright
11955SN/A# notice, this list of conditions and the following disclaimer in the
12955SN/A# documentation and/or other materials provided with the distribution;
13955SN/A# neither the name of the copyright holders nor the names of its
14955SN/A# contributors may be used to endorse or promote products derived from
15955SN/A# this software without specific prior written permission.
16955SN/A#
17955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19955SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20955SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21955SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22955SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23955SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24955SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25955SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26955SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27955SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28955SN/A#
292665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt
302665Ssaidi@eecs.umich.edu
315863Snate@binkert.org###################################################
32955SN/A#
33955SN/A# SCons top-level build description (SConstruct) file.
34955SN/A#
35955SN/A# While in this directory ('m5'), just type 'scons' to build the default
36955SN/A# configuration (see below), or type 'scons build/<CONFIG>/<binary>'
372632Sstever@eecs.umich.edu# to build some other configuration (e.g., 'build/ALPHA_FS/m5.opt' for
382632Sstever@eecs.umich.edu# the optimized full-system version).
392632Sstever@eecs.umich.edu#
402632Sstever@eecs.umich.edu# You can build M5 in a different directory as long as there is a
41955SN/A# 'build/<CONFIG>' somewhere along the target path.  The build system
422632Sstever@eecs.umich.edu# expects that all configs under the same build directory are being
432632Sstever@eecs.umich.edu# built for the same host system.
442761Sstever@eecs.umich.edu#
452632Sstever@eecs.umich.edu# Examples:
462632Sstever@eecs.umich.edu#
472632Sstever@eecs.umich.edu#   The following two commands are equivalent.  The '-u' option tells
482761Sstever@eecs.umich.edu#   scons to search up the directory tree for this SConstruct file.
492761Sstever@eecs.umich.edu#   % cd <path-to-src>/m5 ; scons build/ALPHA_FS/m5.debug
502761Sstever@eecs.umich.edu#   % cd <path-to-src>/m5/build/ALPHA_FS; scons -u m5.debug
512632Sstever@eecs.umich.edu#
522632Sstever@eecs.umich.edu#   The following two commands are equivalent and demonstrate building
532761Sstever@eecs.umich.edu#   in a directory outside of the source tree.  The '-C' option tells
542761Sstever@eecs.umich.edu#   scons to chdir to the specified directory to find this SConstruct
552761Sstever@eecs.umich.edu#   file.
562761Sstever@eecs.umich.edu#   % cd <path-to-src>/m5 ; scons /local/foo/build/ALPHA_FS/m5.debug
572761Sstever@eecs.umich.edu#   % cd /local/foo/build/ALPHA_FS; scons -C <path-to-src>/m5 m5.debug
582632Sstever@eecs.umich.edu#
592632Sstever@eecs.umich.edu# You can use 'scons -H' to print scons options.  If you're in this
602632Sstever@eecs.umich.edu# 'm5' directory (or use -u or -C to tell scons where to find this
612632Sstever@eecs.umich.edu# file), you can use 'scons -h' to print all the M5-specific build
622632Sstever@eecs.umich.edu# options as well.
632632Sstever@eecs.umich.edu#
642632Sstever@eecs.umich.edu###################################################
65955SN/A
66955SN/Aimport sys
67955SN/Aimport os
685863Snate@binkert.orgimport subprocess
695863Snate@binkert.org
705863Snate@binkert.orgfrom os.path import isdir, join as joinpath
715863Snate@binkert.org
725863Snate@binkert.org# Check for recent-enough Python and SCons versions.  If your system's
735863Snate@binkert.org# default installation of Python is not recent enough, you can use a
745863Snate@binkert.org# non-default installation of the Python interpreter by either (1)
755863Snate@binkert.org# rearranging your PATH so that scons finds the non-default 'python'
765863Snate@binkert.org# first or (2) explicitly invoking an alternative interpreter on the
775863Snate@binkert.org# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
785863Snate@binkert.orgEnsurePythonVersion(2,4)
795863Snate@binkert.org
805863Snate@binkert.org# Ironically, SCons 0.96 dies if you give EnsureSconsVersion a
815863Snate@binkert.org# 3-element version number.
825863Snate@binkert.orgmin_scons_version = (0,96,91)
835863Snate@binkert.orgtry:
845863Snate@binkert.org    EnsureSConsVersion(*min_scons_version)
855863Snate@binkert.orgexcept:
865863Snate@binkert.org    print "Error checking current SCons version."
875863Snate@binkert.org    print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
885863Snate@binkert.org    Exit(2)
895863Snate@binkert.org    
905863Snate@binkert.org
915863Snate@binkert.org# The absolute path to the current directory (where this file lives).
925863Snate@binkert.orgROOT = Dir('.').abspath
935863Snate@binkert.org
945863Snate@binkert.org# Path to the M5 source tree.
955863Snate@binkert.orgSRCDIR = joinpath(ROOT, 'src')
965863Snate@binkert.org
975863Snate@binkert.org# tell python where to find m5 python code
985863Snate@binkert.orgsys.path.append(joinpath(ROOT, 'src/python'))
996654Snate@binkert.org
100955SN/Adef check_style_hook(ui):
1015396Ssaidi@eecs.umich.edu    ui.readconfig(joinpath(ROOT, '.hg', 'hgrc'))
1025863Snate@binkert.org    style_hook = ui.config('hooks', 'pretxncommit.style', None)
1035863Snate@binkert.org
1044202Sbinkertn@umich.edu    if not style_hook:
1055863Snate@binkert.org        print """\
1065863Snate@binkert.orgYou're missing the M5 style hook.
1075863Snate@binkert.orgPlease install the hook so we can ensure that all code fits a common style.
1085863Snate@binkert.org
109955SN/AAll you'd need to do is add the following lines to your repository .hg/hgrc
1106654Snate@binkert.orgor your personal .hgrc
1115273Sstever@gmail.com----------------
1125871Snate@binkert.org
1135273Sstever@gmail.com[extensions]
1146655Snate@binkert.orgstyle = %s/util/style.py
1156655Snate@binkert.org
1166655Snate@binkert.org[hooks]
1176655Snate@binkert.orgpretxncommit.style = python:style.check_whitespace
1186655Snate@binkert.org""" % (ROOT)
1196655Snate@binkert.org        sys.exit(1)
1205871Snate@binkert.org
1216654Snate@binkert.orgif isdir(joinpath(ROOT, '.hg')):
1225396Ssaidi@eecs.umich.edu    try:
1235871Snate@binkert.org        from mercurial import ui
1245871Snate@binkert.org        check_style_hook(ui.ui())
1256121Snate@binkert.org    except ImportError:
1265871Snate@binkert.org        pass
1275871Snate@binkert.org
1286003Snate@binkert.org###################################################
1296655Snate@binkert.org#
130955SN/A# Figure out which configurations to set up based on the path(s) of
1315871Snate@binkert.org# the target(s).
1325871Snate@binkert.org#
1335871Snate@binkert.org###################################################
1345871Snate@binkert.org
135955SN/A# Find default configuration & binary.
1366121Snate@binkert.orgDefault(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
1376121Snate@binkert.org
1386121Snate@binkert.org# helper function: find last occurrence of element in list
1391533SN/Adef rfind(l, elt, offs = -1):
1406655Snate@binkert.org    for i in range(len(l)+offs, 0, -1):
1416655Snate@binkert.org        if l[i] == elt:
1426655Snate@binkert.org            return i
1436655Snate@binkert.org    raise ValueError, "element not found"
1445871Snate@binkert.org
1455871Snate@binkert.org# helper function: compare dotted version numbers.
1465863Snate@binkert.org# E.g., compare_version('1.3.25', '1.4.1')
1475871Snate@binkert.org# returns -1, 0, 1 if v1 is <, ==, > v2
1485871Snate@binkert.orgdef compare_versions(v1, v2):
1495871Snate@binkert.org    # Convert dotted strings to lists
1505871Snate@binkert.org    v1 = map(int, v1.split('.'))
1515871Snate@binkert.org    v2 = map(int, v2.split('.'))
1525863Snate@binkert.org    # Compare corresponding elements of lists
1536121Snate@binkert.org    for n1,n2 in zip(v1, v2):
1545863Snate@binkert.org        if n1 < n2: return -1
1555871Snate@binkert.org        if n1 > n2: return  1
1564678Snate@binkert.org    # all corresponding values are equal... see if one has extra values
1574678Snate@binkert.org    if len(v1) < len(v2): return -1
1584678Snate@binkert.org    if len(v1) > len(v2): return  1
1594678Snate@binkert.org    return 0
1604678Snate@binkert.org
1614678Snate@binkert.org# Each target must have 'build' in the interior of the path; the
1624678Snate@binkert.org# directory below this will determine the build parameters.  For
1634678Snate@binkert.org# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
1644678Snate@binkert.org# recognize that ALPHA_SE specifies the configuration because it
1654678Snate@binkert.org# follow 'build' in the bulid path.
1664678Snate@binkert.org
1674678Snate@binkert.org# Generate absolute paths to targets so we can see where the build dir is
1686121Snate@binkert.orgif COMMAND_LINE_TARGETS:
1694678Snate@binkert.org    # Ask SCons which directory it was invoked from
1705871Snate@binkert.org    launch_dir = GetLaunchDir()
1715871Snate@binkert.org    # Make targets relative to invocation directory
1725871Snate@binkert.org    abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))),
1735871Snate@binkert.org                      COMMAND_LINE_TARGETS)
1745871Snate@binkert.orgelse:
1755871Snate@binkert.org    # Default targets are relative to root of tree
1765871Snate@binkert.org    abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))),
1775871Snate@binkert.org                      DEFAULT_TARGETS)
1785871Snate@binkert.org
1795871Snate@binkert.org
1805871Snate@binkert.org# Generate a list of the unique build roots and configs that the
1815871Snate@binkert.org# collected targets reference.
1825871Snate@binkert.orgbuild_paths = []
1835990Ssaidi@eecs.umich.edubuild_root = None
1845871Snate@binkert.orgfor t in abs_targets:
1855871Snate@binkert.org    path_dirs = t.split('/')
1865871Snate@binkert.org    try:
1874678Snate@binkert.org        build_top = rfind(path_dirs, 'build', -2)
1886654Snate@binkert.org    except:
1895871Snate@binkert.org        print "Error: no non-leaf 'build' dir found on target path", t
1905871Snate@binkert.org        Exit(1)
1915871Snate@binkert.org    this_build_root = joinpath('/',*path_dirs[:build_top+1])
1925871Snate@binkert.org    if not build_root:
1935871Snate@binkert.org        build_root = this_build_root
1945871Snate@binkert.org    else:
1955871Snate@binkert.org        if this_build_root != build_root:
1965871Snate@binkert.org            print "Error: build targets not under same build root\n"\
1975871Snate@binkert.org                  "  %s\n  %s" % (build_root, this_build_root)
1984678Snate@binkert.org            Exit(1)
1995871Snate@binkert.org    build_path = joinpath('/',*path_dirs[:build_top+2])
2004678Snate@binkert.org    if build_path not in build_paths:
2015871Snate@binkert.org        build_paths.append(build_path)
2025871Snate@binkert.org
2035871Snate@binkert.org###################################################
2045871Snate@binkert.org#
2055871Snate@binkert.org# Set up the default build environment.  This environment is copied
2065871Snate@binkert.org# and modified according to each selected configuration.
2075871Snate@binkert.org#
2085871Snate@binkert.org###################################################
2095871Snate@binkert.org
2106121Snate@binkert.orgenv = Environment(ENV = os.environ,  # inherit user's environment vars
2116121Snate@binkert.org                  ROOT = ROOT,
2125863Snate@binkert.org                  SRCDIR = SRCDIR)
213955SN/A
214955SN/A#Parse CC/CXX early so that we use the correct compiler for 
2152632Sstever@eecs.umich.edu# to test for dependencies/versions/libraries/includes
2162632Sstever@eecs.umich.eduif ARGUMENTS.get('CC', None):
217955SN/A    env['CC'] = ARGUMENTS.get('CC')
218955SN/A
219955SN/Aif ARGUMENTS.get('CXX', None):
220955SN/A    env['CXX'] = ARGUMENTS.get('CXX')
2215863Snate@binkert.org
222955SN/AExport('env')
2232632Sstever@eecs.umich.edu
2242632Sstever@eecs.umich.eduenv.SConsignFile(joinpath(build_root,"sconsign"))
2252632Sstever@eecs.umich.edu
2262632Sstever@eecs.umich.edu# Default duplicate option is to use hard links, but this messes up
2272632Sstever@eecs.umich.edu# when you use emacs to edit a file in the target dir, as emacs moves
2282632Sstever@eecs.umich.edu# file to file~ then copies to file, breaking the link.  Symbolic
2292632Sstever@eecs.umich.edu# (soft) links work better.
2302632Sstever@eecs.umich.eduenv.SetOption('duplicate', 'soft-copy')
2312632Sstever@eecs.umich.edu
2322632Sstever@eecs.umich.edu# I waffle on this setting... it does avoid a few painful but
2332632Sstever@eecs.umich.edu# unnecessary builds, but it also seems to make trivial builds take
2342632Sstever@eecs.umich.edu# noticeably longer.
2352632Sstever@eecs.umich.eduif False:
2363718Sstever@eecs.umich.edu    env.TargetSignatures('content')
2373718Sstever@eecs.umich.edu
2383718Sstever@eecs.umich.edu# M5_PLY is used by isa_parser.py to find the PLY package.
2393718Sstever@eecs.umich.eduenv.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
2403718Sstever@eecs.umich.eduenv['GCC'] = False
2415863Snate@binkert.orgenv['SUNCC'] = False
2425863Snate@binkert.orgenv['ICC'] = False
2433718Sstever@eecs.umich.eduenv['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True, 
2443718Sstever@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2456121Snate@binkert.org        close_fds=True).communicate()[0].find('GCC') >= 0
2465863Snate@binkert.orgenv['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
2473718Sstever@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2483718Sstever@eecs.umich.edu        close_fds=True).communicate()[0].find('Sun C++') >= 0
2492634Sstever@eecs.umich.eduenv['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
2502634Sstever@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2515863Snate@binkert.org        close_fds=True).communicate()[0].find('Intel') >= 0
2522638Sstever@eecs.umich.eduif env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
2532632Sstever@eecs.umich.edu    print 'Error: How can we have two at the same time?'
2542632Sstever@eecs.umich.edu    Exit(1)
2552632Sstever@eecs.umich.edu
2562632Sstever@eecs.umich.edu
2572632Sstever@eecs.umich.edu# Set up default C++ compiler flags
2582632Sstever@eecs.umich.eduif env['GCC']:
2591858SN/A    env.Append(CCFLAGS='-pipe')
2603716Sstever@eecs.umich.edu    env.Append(CCFLAGS='-fno-strict-aliasing')
2612638Sstever@eecs.umich.edu    env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
2622638Sstever@eecs.umich.eduelif env['ICC']:
2632638Sstever@eecs.umich.edu    pass #Fix me... add warning flags once we clean up icc warnings
2642638Sstever@eecs.umich.eduelif env['SUNCC']:
2652638Sstever@eecs.umich.edu    env.Append(CCFLAGS='-Qoption ccfe')
2662638Sstever@eecs.umich.edu    env.Append(CCFLAGS='-features=gcc')
2672638Sstever@eecs.umich.edu    env.Append(CCFLAGS='-features=extensions')
2685863Snate@binkert.org    env.Append(CCFLAGS='-library=stlport4')
2695863Snate@binkert.org    env.Append(CCFLAGS='-xar')
2705863Snate@binkert.org#    env.Append(CCFLAGS='-instances=semiexplicit')
271955SN/Aelse:
2725341Sstever@gmail.com    print 'Error: Don\'t know what compiler options to use for your compiler.'
2735341Sstever@gmail.com    print '       Please fix SConstruct and src/SConscript and try again.'
2745863Snate@binkert.org    Exit(1)
2757756SAli.Saidi@ARM.com
2765341Sstever@gmail.comif sys.platform == 'cygwin':
2776121Snate@binkert.org    # cygwin has some header file issues...
2784494Ssaidi@eecs.umich.edu    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
2796121Snate@binkert.orgenv.Append(CPPPATH=[Dir('ext/dnet')])
2801105SN/A
2812667Sstever@eecs.umich.edu# Check for SWIG
2822667Sstever@eecs.umich.eduif not env.has_key('SWIG'):
2832667Sstever@eecs.umich.edu    print 'Error: SWIG utility not found.'
2842667Sstever@eecs.umich.edu    print '       Please install (see http://www.swig.org) and retry.'
2856121Snate@binkert.org    Exit(1)
2862667Sstever@eecs.umich.edu
2875341Sstever@gmail.com# Check for appropriate SWIG version
2885863Snate@binkert.orgswig_version = os.popen('swig -version').read().split()
2895341Sstever@gmail.com# First 3 words should be "SWIG Version x.y.z"
2905341Sstever@gmail.comif len(swig_version) < 3 or \
2915341Sstever@gmail.com        swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
2925863Snate@binkert.org    print 'Error determining SWIG version.'
2935341Sstever@gmail.com    Exit(1)
2945341Sstever@gmail.com
2955341Sstever@gmail.commin_swig_version = '1.3.28'
2965863Snate@binkert.orgif compare_versions(swig_version[2], min_swig_version) < 0:
2975341Sstever@gmail.com    print 'Error: SWIG version', min_swig_version, 'or newer required.'
2985341Sstever@gmail.com    print '       Installed version:', swig_version[2]
2995341Sstever@gmail.com    Exit(1)
3005341Sstever@gmail.com
3015341Sstever@gmail.com# Set up SWIG flags & scanner
3025341Sstever@gmail.comswig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
3035341Sstever@gmail.comenv.Append(SWIGFLAGS=swig_flags)
3045341Sstever@gmail.com
3055341Sstever@gmail.com# filter out all existing swig scanners, they mess up the dependency
3065341Sstever@gmail.com# stuff for some reason
3075863Snate@binkert.orgscanners = []
3085341Sstever@gmail.comfor scanner in env['SCANNERS']:
3095863Snate@binkert.org    skeys = scanner.skeys
3107756SAli.Saidi@ARM.com    if skeys == '.i':
3115341Sstever@gmail.com        continue
3125863Snate@binkert.org    
3136121Snate@binkert.org    if isinstance(skeys, (list, tuple)) and '.i' in skeys:
3146121Snate@binkert.org        continue
3155397Ssaidi@eecs.umich.edu
3165397Ssaidi@eecs.umich.edu    scanners.append(scanner)
3177727SAli.Saidi@ARM.com
3185341Sstever@gmail.com# add the new swig scanner that we like better
3196168Snate@binkert.orgfrom SCons.Scanner import ClassicCPP as CPPScanner
3206168Snate@binkert.orgswig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
3215341Sstever@gmail.comscanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
3227756SAli.Saidi@ARM.com
3237756SAli.Saidi@ARM.com# replace the scanners list that has what we want
3247756SAli.Saidi@ARM.comenv['SCANNERS'] = scanners
3257756SAli.Saidi@ARM.com
3267756SAli.Saidi@ARM.com# Platform-specific configuration.  Note again that we assume that all
3277756SAli.Saidi@ARM.com# builds under a given build root run on the same host platform.
3285341Sstever@gmail.comconf = Configure(env,
3295341Sstever@gmail.com                 conf_dir = joinpath(build_root, '.scons_config'),
3305341Sstever@gmail.com                 log_file = joinpath(build_root, 'scons_config.log'))
3315341Sstever@gmail.com
3325863Snate@binkert.org# Find Python include and library directories for embedding the
3335341Sstever@gmail.com# interpreter.  For consistency, we will use the same Python
3345341Sstever@gmail.com# installation used to run scons (and thus this script).  If you want
3356121Snate@binkert.org# to link in an alternate version, see above for instructions on how
3366121Snate@binkert.org# to invoke scons with a different copy of the Python interpreter.
3377756SAli.Saidi@ARM.com
3385341Sstever@gmail.com# Get brief Python version name (e.g., "python2.4") for locating
3396814Sgblack@eecs.umich.edu# include & library files
3407756SAli.Saidi@ARM.compy_version_name = 'python' + sys.version[:3]
3416814Sgblack@eecs.umich.edu
3425863Snate@binkert.org# include path, e.g. /usr/local/include/python2.4
3436121Snate@binkert.orgpy_header_path = joinpath(sys.exec_prefix, 'include', py_version_name)
3445341Sstever@gmail.comenv.Append(CPPPATH = py_header_path)
3455863Snate@binkert.org# verify that it works
3465341Sstever@gmail.comif not conf.CheckHeader('Python.h', '<>'):
3476121Snate@binkert.org    print "Error: can't find Python.h header in", py_header_path
3486121Snate@binkert.org    Exit(1)
3496121Snate@binkert.org
3505742Snate@binkert.org# add library path too if it's not in the default place
3515742Snate@binkert.orgpy_lib_path = None
3525341Sstever@gmail.comif sys.exec_prefix != '/usr':
3535742Snate@binkert.org    py_lib_path = joinpath(sys.exec_prefix, 'lib')
3545742Snate@binkert.orgelif sys.platform == 'cygwin':
3555341Sstever@gmail.com    # cygwin puts the .dll in /bin for some reason
3566017Snate@binkert.org    py_lib_path = '/bin'
3576121Snate@binkert.orgif py_lib_path:
3586017Snate@binkert.org    env.Append(LIBPATH = py_lib_path)
3597756SAli.Saidi@ARM.com    print 'Adding', py_lib_path, 'to LIBPATH for', py_version_name
3607756SAli.Saidi@ARM.comif not conf.CheckLib(py_version_name):
3617756SAli.Saidi@ARM.com    print "Error: can't find Python library", py_version_name
3627756SAli.Saidi@ARM.com    Exit(1)
3637756SAli.Saidi@ARM.com
3647756SAli.Saidi@ARM.com# On Solaris you need to use libsocket for socket ops
3657756SAli.Saidi@ARM.comif not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
3667756SAli.Saidi@ARM.com   if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'):
3677756SAli.Saidi@ARM.com       print "Can't find library with socket calls (e.g. accept())"
3687756SAli.Saidi@ARM.com       Exit(1)
3697756SAli.Saidi@ARM.com
3707756SAli.Saidi@ARM.com# Check for zlib.  If the check passes, libz will be automatically
3717756SAli.Saidi@ARM.com# added to the LIBS environment variable.
3727756SAli.Saidi@ARM.comif not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
3737756SAli.Saidi@ARM.com    print 'Error: did not find needed zlib compression library '\
3747756SAli.Saidi@ARM.com          'and/or zlib.h header file.'
3757756SAli.Saidi@ARM.com    print '       Please install zlib and try again.'
3767756SAli.Saidi@ARM.com    Exit(1)
3777756SAli.Saidi@ARM.com
3787756SAli.Saidi@ARM.com# Check for <fenv.h> (C99 FP environment control)
3797756SAli.Saidi@ARM.comhave_fenv = conf.CheckHeader('fenv.h', '<>')
3807756SAli.Saidi@ARM.comif not have_fenv:
3817756SAli.Saidi@ARM.com    print "Warning: Header file <fenv.h> not found."
3827756SAli.Saidi@ARM.com    print "         This host has no IEEE FP rounding mode control."
3837756SAli.Saidi@ARM.com
3847756SAli.Saidi@ARM.com# Check for mysql.
3857756SAli.Saidi@ARM.commysql_config = WhereIs('mysql_config')
3867756SAli.Saidi@ARM.comhave_mysql = mysql_config != None
3877756SAli.Saidi@ARM.com
3887756SAli.Saidi@ARM.com# Check MySQL version.
3897756SAli.Saidi@ARM.comif have_mysql:
3907756SAli.Saidi@ARM.com    mysql_version = os.popen(mysql_config + ' --version').read()
3917756SAli.Saidi@ARM.com    min_mysql_version = '4.1'
3927756SAli.Saidi@ARM.com    if compare_versions(mysql_version, min_mysql_version) < 0:
3936654Snate@binkert.org        print 'Warning: MySQL', min_mysql_version, 'or newer required.'
3946654Snate@binkert.org        print '         Version', mysql_version, 'detected.'
3955871Snate@binkert.org        have_mysql = False
3966121Snate@binkert.org
3976121Snate@binkert.org# Set up mysql_config commands.
3986121Snate@binkert.orgif have_mysql:
3996121Snate@binkert.org    mysql_config_include = mysql_config + ' --include'
4003940Ssaidi@eecs.umich.edu    if os.system(mysql_config_include + ' > /dev/null') != 0:
4013918Ssaidi@eecs.umich.edu        # older mysql_config versions don't support --include, use
4023918Ssaidi@eecs.umich.edu        # --cflags instead
4031858SN/A        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
4046121Snate@binkert.org    # This seems to work in all versions
4057739Sgblack@eecs.umich.edu    mysql_config_libs = mysql_config + ' --libs'
4067739Sgblack@eecs.umich.edu
4076143Snate@binkert.orgenv = conf.Finish()
4087739Sgblack@eecs.umich.edu
4097618SAli.Saidi@arm.com# Define the universe of supported ISAs
4107618SAli.Saidi@arm.comall_isa_list = [ ]
4117618SAli.Saidi@arm.comExport('all_isa_list')
4127618SAli.Saidi@arm.com
4137618SAli.Saidi@arm.com# Define the universe of supported CPU models
4147618SAli.Saidi@arm.comall_cpu_list = [ ]
4157618SAli.Saidi@arm.comdefault_cpus = [ ]
4167739Sgblack@eecs.umich.eduExport('all_cpu_list', 'default_cpus')
4176121Snate@binkert.org
4183940Ssaidi@eecs.umich.edu# Sticky options get saved in the options file so they persist from
4196121Snate@binkert.org# one invocation to the next (unless overridden, in which case the new
4207739Sgblack@eecs.umich.edu# value becomes sticky).
4217739Sgblack@eecs.umich.edusticky_opts = Options(args=ARGUMENTS)
4227739Sgblack@eecs.umich.eduExport('sticky_opts')
4237739Sgblack@eecs.umich.edu
4247739Sgblack@eecs.umich.edu# Non-sticky options only apply to the current build.
4257739Sgblack@eecs.umich.edunonsticky_opts = Options(args=ARGUMENTS)
4263918Ssaidi@eecs.umich.eduExport('nonsticky_opts')
4273918Ssaidi@eecs.umich.edu
4283940Ssaidi@eecs.umich.edu# Walk the tree and execute all SConsopts scripts that wil add to the
4293918Ssaidi@eecs.umich.edu# above options
4303918Ssaidi@eecs.umich.edufor root, dirs, files in os.walk('.'):
4316157Snate@binkert.org    if 'SConsopts' in files:
4326157Snate@binkert.org        SConscript(os.path.join(root, 'SConsopts'))
4336157Snate@binkert.org
4346157Snate@binkert.orgall_isa_list.sort()
4355397Ssaidi@eecs.umich.eduall_cpu_list.sort()
4365397Ssaidi@eecs.umich.edudefault_cpus.sort()
4376121Snate@binkert.org
4386121Snate@binkert.orgdef ExtraPathValidator(key, val, env):
4396121Snate@binkert.org    paths = val.split(':')
4406121Snate@binkert.org    for path in paths:
4416121Snate@binkert.org        path = os.path.expanduser(path)
4426121Snate@binkert.org        if not isdir(path):
4435397Ssaidi@eecs.umich.edu            raise AttributeError, "Invalid path: '%s'" % path
4441851SN/A
4451851SN/Asticky_opts.AddOptions(
4467739Sgblack@eecs.umich.edu    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
447955SN/A    BoolOption('FULL_SYSTEM', 'Full-system support', False),
4483053Sstever@eecs.umich.edu    # There's a bug in scons 0.96.1 that causes ListOptions with list
4496121Snate@binkert.org    # values (more than one value) not to be able to be restored from
4503053Sstever@eecs.umich.edu    # a saved option file.  If this causes trouble then upgrade to
4513053Sstever@eecs.umich.edu    # scons 0.96.90 or later.
4523053Sstever@eecs.umich.edu    ListOption('CPU_MODELS', 'CPU models', default_cpus, all_cpu_list),
4533053Sstever@eecs.umich.edu    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
4543053Sstever@eecs.umich.edu    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
4556654Snate@binkert.org               False),
4563053Sstever@eecs.umich.edu    BoolOption('SS_COMPATIBLE_FP',
4574742Sstever@eecs.umich.edu               'Make floating-point results compatible with SimpleScalar',
4584742Sstever@eecs.umich.edu               False),
4593053Sstever@eecs.umich.edu    BoolOption('USE_SSE2',
4603053Sstever@eecs.umich.edu               'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts',
4613053Sstever@eecs.umich.edu               False),
4623053Sstever@eecs.umich.edu    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
4636654Snate@binkert.org    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
4643053Sstever@eecs.umich.edu    BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False),
4653053Sstever@eecs.umich.edu    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
4663053Sstever@eecs.umich.edu    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
4673053Sstever@eecs.umich.edu    BoolOption('BATCH', 'Use batch pool for build and tests', False),
4682667Sstever@eecs.umich.edu    ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
4694554Sbinkertn@umich.edu    ('PYTHONHOME',
4706121Snate@binkert.org     'Override the default PYTHONHOME for this system (use with caution)',
4712667Sstever@eecs.umich.edu     '%s:%s' % (sys.prefix, sys.exec_prefix)),
4724554Sbinkertn@umich.edu    ('EXTRAS', 'Add Extra directories to the compilation', '',
4734554Sbinkertn@umich.edu     ExtraPathValidator)
4744554Sbinkertn@umich.edu    )
4756121Snate@binkert.org
4764554Sbinkertn@umich.edunonsticky_opts.AddOptions(
4774554Sbinkertn@umich.edu    BoolOption('update_ref', 'Update test reference outputs', False)
4784554Sbinkertn@umich.edu    )
4794781Snate@binkert.org
4804554Sbinkertn@umich.edu# These options get exported to #defines in config/*.hh (see src/SConscript).
4814554Sbinkertn@umich.eduenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
4822667Sstever@eecs.umich.edu                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
4834554Sbinkertn@umich.edu                     'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA']
4844554Sbinkertn@umich.edu
4854554Sbinkertn@umich.edu# Define a handy 'no-op' action
4864554Sbinkertn@umich.edudef no_action(target, source, env):
4872667Sstever@eecs.umich.edu    return 0
4884554Sbinkertn@umich.edu
4892667Sstever@eecs.umich.eduenv.NoAction = Action(no_action, None)
4904554Sbinkertn@umich.edu
4916121Snate@binkert.org###################################################
4922667Sstever@eecs.umich.edu#
4935522Snate@binkert.org# Define a SCons builder for configuration flag headers.
4945522Snate@binkert.org#
4955522Snate@binkert.org###################################################
4965522Snate@binkert.org
4975522Snate@binkert.org# This function generates a config header file that #defines the
4985522Snate@binkert.org# option symbol to the current option setting (0 or 1).  The source
4995522Snate@binkert.org# operands are the name of the option and a Value node containing the
5005522Snate@binkert.org# value of the option.
5015522Snate@binkert.orgdef build_config_file(target, source, env):
5025522Snate@binkert.org    (option, value) = [s.get_contents() for s in source]
5035522Snate@binkert.org    f = file(str(target[0]), 'w')
5045522Snate@binkert.org    print >> f, '#define', option, value
5055522Snate@binkert.org    f.close()
5065522Snate@binkert.org    return None
5075522Snate@binkert.org
5085522Snate@binkert.org# Generate the message to be printed when building the config file.
5095522Snate@binkert.orgdef build_config_file_string(target, source, env):
5105522Snate@binkert.org    (option, value) = [s.get_contents() for s in source]
5115522Snate@binkert.org    return "Defining %s as %s in %s." % (option, value, target[0])
5125522Snate@binkert.org
5135522Snate@binkert.org# Combine the two functions into a scons Action object.
5145522Snate@binkert.orgconfig_action = Action(build_config_file, build_config_file_string)
5155522Snate@binkert.org
5165522Snate@binkert.org# The emitter munges the source & target node lists to reflect what
5175522Snate@binkert.org# we're really doing.
5185522Snate@binkert.orgdef config_emitter(target, source, env):
5192638Sstever@eecs.umich.edu    # extract option name from Builder arg
5202638Sstever@eecs.umich.edu    option = str(target[0])
5216121Snate@binkert.org    # True target is config header file
5223716Sstever@eecs.umich.edu    target = joinpath('config', option.lower() + '.hh')
5235522Snate@binkert.org    val = env[option]
5245522Snate@binkert.org    if isinstance(val, bool):
5255522Snate@binkert.org        # Force value to 0/1
5265522Snate@binkert.org        val = int(val)
5275522Snate@binkert.org    elif isinstance(val, str):
5285522Snate@binkert.org        val = '"' + val + '"'
5291858SN/A        
5305227Ssaidi@eecs.umich.edu    # Sources are option name & value (packaged in SCons Value nodes)
5315227Ssaidi@eecs.umich.edu    return ([target], [Value(option), Value(val)])
5325227Ssaidi@eecs.umich.edu
5335227Ssaidi@eecs.umich.educonfig_builder = Builder(emitter = config_emitter, action = config_action)
5346654Snate@binkert.org
5356654Snate@binkert.orgenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
5367769SAli.Saidi@ARM.com
5377769SAli.Saidi@ARM.com###################################################
5387769SAli.Saidi@ARM.com#
5397769SAli.Saidi@ARM.com# Define a SCons builder for copying files.  This is used by the
5405227Ssaidi@eecs.umich.edu# Python zipfile code in src/python/SConscript, but is placed up here
5415227Ssaidi@eecs.umich.edu# since it's potentially more generally applicable.
5425227Ssaidi@eecs.umich.edu#
5435204Sstever@gmail.com###################################################
5445204Sstever@gmail.com
5455204Sstever@gmail.comcopy_builder = Builder(action = Copy("$TARGET", "$SOURCE"))
5465204Sstever@gmail.com
5475204Sstever@gmail.comenv.Append(BUILDERS = { 'CopyFile' : copy_builder })
5485204Sstever@gmail.com
5495204Sstever@gmail.com###################################################
5505204Sstever@gmail.com#
5515204Sstever@gmail.com# Define a simple SCons builder to concatenate files.
5525204Sstever@gmail.com#
5535204Sstever@gmail.com# Used to append the Python zip archive to the executable.
5545204Sstever@gmail.com#
5555204Sstever@gmail.com###################################################
5565204Sstever@gmail.com
5575204Sstever@gmail.comconcat_builder = Builder(action = Action(['cat $SOURCES > $TARGET',
5585204Sstever@gmail.com                                          'chmod +x $TARGET']))
5595204Sstever@gmail.com
5606121Snate@binkert.orgenv.Append(BUILDERS = { 'Concat' : concat_builder })
5615204Sstever@gmail.com
5623118Sstever@eecs.umich.edu
5633118Sstever@eecs.umich.edu# base help text
5643118Sstever@eecs.umich.eduhelp_text = '''
5653118Sstever@eecs.umich.eduUsage: scons [scons options] [build options] [target(s)]
5663118Sstever@eecs.umich.edu
5675863Snate@binkert.org'''
5683118Sstever@eecs.umich.edu
5695863Snate@binkert.org# libelf build is shared across all configs in the build root.
5703118Sstever@eecs.umich.eduenv.SConscript('ext/libelf/SConscript',
5717457Snate@binkert.org               build_dir = joinpath(build_root, 'libelf'),
5727457Snate@binkert.org               exports = 'env')
5735863Snate@binkert.org
5745863Snate@binkert.org###################################################
5755863Snate@binkert.org#
5765863Snate@binkert.org# This function is used to set up a directory with switching headers
5775863Snate@binkert.org#
5785863Snate@binkert.org###################################################
5795863Snate@binkert.org
5806003Snate@binkert.orgenv['ALL_ISA_LIST'] = all_isa_list
5815863Snate@binkert.orgdef make_switching_dir(dirname, switch_headers, env):
5825863Snate@binkert.org    # Generate the header.  target[0] is the full path of the output
5835863Snate@binkert.org    # header to generate.  'source' is a dummy variable, since we get the
5846120Snate@binkert.org    # list of ISAs from env['ALL_ISA_LIST'].
5855863Snate@binkert.org    def gen_switch_hdr(target, source, env):
5865863Snate@binkert.org	fname = str(target[0])
5875863Snate@binkert.org	basename = os.path.basename(fname)
5886120Snate@binkert.org	f = open(fname, 'w')
5896120Snate@binkert.org	f.write('#include "arch/isa_specific.hh"\n')
5905863Snate@binkert.org	cond = '#if'
5915863Snate@binkert.org	for isa in all_isa_list:
5926120Snate@binkert.org	    f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
5935863Snate@binkert.org		    % (cond, isa.upper(), dirname, isa, basename))
5946121Snate@binkert.org	    cond = '#elif'
5956121Snate@binkert.org	f.write('#else\n#error "THE_ISA not set"\n#endif\n')
5965863Snate@binkert.org	f.close()
5977727SAli.Saidi@ARM.com	return 0
5987727SAli.Saidi@ARM.com
5997727SAli.Saidi@ARM.com    # String to print when generating header
6007727SAli.Saidi@ARM.com    def gen_switch_hdr_string(target, source, env):
6017727SAli.Saidi@ARM.com	return "Generating switch header " + str(target[0])
6027727SAli.Saidi@ARM.com
6035863Snate@binkert.org    # Build SCons Action object. 'varlist' specifies env vars that this
6043118Sstever@eecs.umich.edu    # action depends on; when env['ALL_ISA_LIST'] changes these actions
6055863Snate@binkert.org    # should get re-executed.
6063118Sstever@eecs.umich.edu    switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
6073118Sstever@eecs.umich.edu                               varlist=['ALL_ISA_LIST'])
6085863Snate@binkert.org
6095863Snate@binkert.org    # Instantiate actions for each header
6105863Snate@binkert.org    for hdr in switch_headers:
6115863Snate@binkert.org        env.Command(hdr, [], switch_hdr_action)
6123118Sstever@eecs.umich.eduExport('make_switching_dir')
6133483Ssaidi@eecs.umich.edu
6143494Ssaidi@eecs.umich.edu###################################################
6153494Ssaidi@eecs.umich.edu#
6163483Ssaidi@eecs.umich.edu# Define build environments for selected configurations.
6173483Ssaidi@eecs.umich.edu#
6183483Ssaidi@eecs.umich.edu###################################################
6193053Sstever@eecs.umich.edu
6203053Sstever@eecs.umich.edu# rename base env
6213918Ssaidi@eecs.umich.edubase_env = env
6223053Sstever@eecs.umich.edu
6233053Sstever@eecs.umich.edufor build_path in build_paths:
6243053Sstever@eecs.umich.edu    print "Building in", build_path
6253053Sstever@eecs.umich.edu    env['BUILDDIR'] = build_path
6263053Sstever@eecs.umich.edu
6271858SN/A    # build_dir is the tail component of build path, and is used to
6281858SN/A    # determine the build parameters (e.g., 'ALPHA_SE')
6291858SN/A    (build_root, build_dir) = os.path.split(build_path)
6301858SN/A    # Make a copy of the build-root environment to use for this config.
6311858SN/A    env = base_env.Copy()
6321858SN/A
6335863Snate@binkert.org    # Set env options according to the build directory config.
6345863Snate@binkert.org    sticky_opts.files = []
6351859SN/A    # Options for $BUILD_ROOT/$BUILD_DIR are stored in
6365863Snate@binkert.org    # $BUILD_ROOT/options/$BUILD_DIR so you can nuke
6371858SN/A    # $BUILD_ROOT/$BUILD_DIR without losing your options settings.
6385863Snate@binkert.org    current_opts_file = joinpath(build_root, 'options', build_dir)
6391858SN/A    if os.path.isfile(current_opts_file):
6401859SN/A        sticky_opts.files.append(current_opts_file)
6411859SN/A        print "Using saved options file %s" % current_opts_file
6426654Snate@binkert.org    else:
6433053Sstever@eecs.umich.edu        # Build dir-specific options file doesn't exist.
6446654Snate@binkert.org
6453053Sstever@eecs.umich.edu        # Make sure the directory is there so we can create it later
6463053Sstever@eecs.umich.edu        opt_dir = os.path.dirname(current_opts_file)
6471859SN/A        if not os.path.isdir(opt_dir):
6481859SN/A            os.mkdir(opt_dir)
6491859SN/A
6501859SN/A        # Get default build options from source tree.  Options are
6511859SN/A        # normally determined by name of $BUILD_DIR, but can be
6521859SN/A        # overriden by 'default=' arg on command line.
6531859SN/A        default_opts_file = joinpath('build_opts',
6541859SN/A                                     ARGUMENTS.get('default', build_dir))
6551862SN/A        if os.path.isfile(default_opts_file):
6561859SN/A            sticky_opts.files.append(default_opts_file)
6571859SN/A            print "Options file %s not found,\n  using defaults in %s" \
6581859SN/A                  % (current_opts_file, default_opts_file)
6595863Snate@binkert.org        else:
6605863Snate@binkert.org            print "Error: cannot find options file %s or %s" \
6615863Snate@binkert.org                  % (current_opts_file, default_opts_file)
6625863Snate@binkert.org            Exit(1)
6636121Snate@binkert.org
6641858SN/A    # Apply current option settings to env
6655863Snate@binkert.org    sticky_opts.Update(env)
6665863Snate@binkert.org    nonsticky_opts.Update(env)
6675863Snate@binkert.org
6685863Snate@binkert.org    help_text += "Sticky options for %s:\n" % build_dir \
6695863Snate@binkert.org                 + sticky_opts.GenerateHelpText(env) \
6702139SN/A                 + "\nNon-sticky options for %s:\n" % build_dir \
6714202Sbinkertn@umich.edu                 + nonsticky_opts.GenerateHelpText(env)
6724202Sbinkertn@umich.edu
6732139SN/A    # Process option settings.
6746994Snate@binkert.org
6756994Snate@binkert.org    if not have_fenv and env['USE_FENV']:
6766994Snate@binkert.org        print "Warning: <fenv.h> not available; " \
6776994Snate@binkert.org              "forcing USE_FENV to False in", build_dir + "."
6786994Snate@binkert.org        env['USE_FENV'] = False
6796994Snate@binkert.org
6806994Snate@binkert.org    if not env['USE_FENV']:
6816994Snate@binkert.org        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
6826994Snate@binkert.org        print "         FP results may deviate slightly from other platforms."
6836994Snate@binkert.org
6846994Snate@binkert.org    if env['EFENCE']:
6856994Snate@binkert.org        env.Append(LIBS=['efence'])
6866994Snate@binkert.org
6876994Snate@binkert.org    if env['USE_MYSQL']:
6886994Snate@binkert.org        if not have_mysql:
6896994Snate@binkert.org            print "Warning: MySQL not available; " \
6906994Snate@binkert.org                  "forcing USE_MYSQL to False in", build_dir + "."
6916994Snate@binkert.org            env['USE_MYSQL'] = False
6926994Snate@binkert.org        else:
6936994Snate@binkert.org            print "Compiling in", build_dir, "with MySQL support."
6946994Snate@binkert.org            env.ParseConfig(mysql_config_libs)
6956994Snate@binkert.org            env.ParseConfig(mysql_config_include)
6966994Snate@binkert.org
6976994Snate@binkert.org    # Save sticky option settings back to current options file
6986994Snate@binkert.org    sticky_opts.Save(current_opts_file, env)
6996994Snate@binkert.org
7006994Snate@binkert.org    # Do this after we save setting back, or else we'll tack on an
7016994Snate@binkert.org    # extra 'qdo' every time we run scons.
7022155SN/A    if env['BATCH']:
7035863Snate@binkert.org        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
7041869SN/A        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
7051869SN/A
7065863Snate@binkert.org    if env['USE_SSE2']:
7075863Snate@binkert.org        env.Append(CCFLAGS='-msse2')
7084202Sbinkertn@umich.edu
7096108Snate@binkert.org    # The src/SConscript file sets up the build rules in 'env' according
7106108Snate@binkert.org    # to the configured options.  It returns a list of environments,
7116108Snate@binkert.org    # one for each variant build (debug, opt, etc.)
7126108Snate@binkert.org    envList = SConscript('src/SConscript', build_dir = build_path,
7134202Sbinkertn@umich.edu                         exports = 'env')
7145863Snate@binkert.org
7155742Snate@binkert.org    # Set up the regression tests for each build.
7165742Snate@binkert.org    for e in envList:
7175341Sstever@gmail.com        SConscript('tests/SConscript',
7185342Sstever@gmail.com                   build_dir = joinpath(build_path, 'tests', e.Label),
7195342Sstever@gmail.com                   exports = { 'env' : e }, duplicate = False)
7204202Sbinkertn@umich.edu
7214202Sbinkertn@umich.eduHelp(help_text)
7224202Sbinkertn@umich.edu
7235863Snate@binkert.org
7245863Snate@binkert.org###################################################
7255863Snate@binkert.org#
7266994Snate@binkert.org# Let SCons do its thing.  At this point SCons will use the defined
7276994Snate@binkert.org# build environments to build the requested targets.
7286994Snate@binkert.org#
7295863Snate@binkert.org###################################################
7305863Snate@binkert.org
7315863Snate@binkert.org