SConstruct revision 4202
1955SN/A# -*- mode:python -*-
2955SN/A
312230Sgiacomo.travaglini@arm.com# Copyright (c) 2004-2005 The Regents of The University of Michigan
49812Sandreas.hansson@arm.com# All rights reserved.
59812Sandreas.hansson@arm.com#
69812Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
79812Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are
89812Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright
99812Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer;
109812Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright
119812Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the
129812Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution;
139812Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its
149812Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from
157816Ssteve.reinhardt@amd.com# this software without specific prior written permission.
165871Snate@binkert.org#
171762SN/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#
29955SN/A# Authors: Steve Reinhardt
30955SN/A
31955SN/A###################################################
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>'
37955SN/A# to build some other configuration (e.g., 'build/ALPHA_FS/m5.opt' for
38955SN/A# the optimized full-system version).
39955SN/A#
40955SN/A# 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
422665Ssaidi@eecs.umich.edu# expects that all configs under the same build directory are being
432665Ssaidi@eecs.umich.edu# built for the same host system.
445863Snate@binkert.org#
45955SN/A# Examples:
46955SN/A#
47955SN/A#   The following two commands are equivalent.  The '-u' option tells
48955SN/A#   scons to search up the directory tree for this SConstruct file.
49955SN/A#   % cd <path-to-src>/m5 ; scons build/ALPHA_FS/m5.debug
508878Ssteve.reinhardt@amd.com#   % cd <path-to-src>/m5/build/ALPHA_FS; scons -u m5.debug
512632Sstever@eecs.umich.edu#
528878Ssteve.reinhardt@amd.com#   The following two commands are equivalent and demonstrate building
532632Sstever@eecs.umich.edu#   in a directory outside of the source tree.  The '-C' option tells
54955SN/A#   scons to chdir to the specified directory to find this SConstruct
558878Ssteve.reinhardt@amd.com#   file.
562632Sstever@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
612761Sstever@eecs.umich.edu# file), you can use 'scons -h' to print all the M5-specific build
622761Sstever@eecs.umich.edu# options as well.
632761Sstever@eecs.umich.edu#
648878Ssteve.reinhardt@amd.com###################################################
658878Ssteve.reinhardt@amd.com
662761Sstever@eecs.umich.eduimport sys
672761Sstever@eecs.umich.eduimport os
682761Sstever@eecs.umich.eduimport subprocess
692761Sstever@eecs.umich.edu
702761Sstever@eecs.umich.edufrom os.path import join as joinpath
718878Ssteve.reinhardt@amd.com
728878Ssteve.reinhardt@amd.com# Check for recent-enough Python and SCons versions.  If your system's
732632Sstever@eecs.umich.edu# default installation of Python is not recent enough, you can use a
742632Sstever@eecs.umich.edu# non-default installation of the Python interpreter by either (1)
758878Ssteve.reinhardt@amd.com# rearranging your PATH so that scons finds the non-default 'python'
768878Ssteve.reinhardt@amd.com# first or (2) explicitly invoking an alternative interpreter on the
772632Sstever@eecs.umich.edu# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
78955SN/AEnsurePythonVersion(2,4)
79955SN/A
80955SN/A# Ironically, SCons 0.96 dies if you give EnsureSconsVersion a
8112563Sgabeblack@google.com# 3-element version number.
8212563Sgabeblack@google.commin_scons_version = (0,96,91)
836654Snate@binkert.orgtry:
8410196SCurtis.Dunham@arm.com    EnsureSConsVersion(*min_scons_version)
85955SN/Aexcept:
865396Ssaidi@eecs.umich.edu    print "Error checking current SCons version."
8711401Sandreas.sandberg@arm.com    print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
885863Snate@binkert.org    Exit(2)
895863Snate@binkert.org    
904202Sbinkertn@umich.edu
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.
95955SN/ASRCDIR = joinpath(ROOT, 'src')
966654Snate@binkert.org
975273Sstever@gmail.com# tell python where to find m5 python code
985871Snate@binkert.orgsys.path.append(joinpath(ROOT, 'src/python'))
995273Sstever@gmail.com
1006654Snate@binkert.org###################################################
1015396Ssaidi@eecs.umich.edu#
1028120Sgblack@eecs.umich.edu# Figure out which configurations to set up based on the path(s) of
1038120Sgblack@eecs.umich.edu# the target(s).
1048120Sgblack@eecs.umich.edu#
1058120Sgblack@eecs.umich.edu###################################################
1068120Sgblack@eecs.umich.edu
1078120Sgblack@eecs.umich.edu# Find default configuration & binary.
1088120Sgblack@eecs.umich.eduDefault(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
1098120Sgblack@eecs.umich.edu
1108879Ssteve.reinhardt@amd.com# helper function: find last occurrence of element in list
1118879Ssteve.reinhardt@amd.comdef rfind(l, elt, offs = -1):
1128879Ssteve.reinhardt@amd.com    for i in range(len(l)+offs, 0, -1):
1138879Ssteve.reinhardt@amd.com        if l[i] == elt:
1148879Ssteve.reinhardt@amd.com            return i
1158879Ssteve.reinhardt@amd.com    raise ValueError, "element not found"
1168879Ssteve.reinhardt@amd.com
1178879Ssteve.reinhardt@amd.com# helper function: compare dotted version numbers.
1188879Ssteve.reinhardt@amd.com# E.g., compare_version('1.3.25', '1.4.1')
1198879Ssteve.reinhardt@amd.com# returns -1, 0, 1 if v1 is <, ==, > v2
1208879Ssteve.reinhardt@amd.comdef compare_versions(v1, v2):
1218879Ssteve.reinhardt@amd.com    # Convert dotted strings to lists
1228879Ssteve.reinhardt@amd.com    v1 = map(int, v1.split('.'))
1238120Sgblack@eecs.umich.edu    v2 = map(int, v2.split('.'))
1248120Sgblack@eecs.umich.edu    # Compare corresponding elements of lists
1258120Sgblack@eecs.umich.edu    for n1,n2 in zip(v1, v2):
1268120Sgblack@eecs.umich.edu        if n1 < n2: return -1
1278120Sgblack@eecs.umich.edu        if n1 > n2: return  1
1288120Sgblack@eecs.umich.edu    # all corresponding values are equal... see if one has extra values
1298120Sgblack@eecs.umich.edu    if len(v1) < len(v2): return -1
1308120Sgblack@eecs.umich.edu    if len(v1) > len(v2): return  1
1318120Sgblack@eecs.umich.edu    return 0
1328120Sgblack@eecs.umich.edu
1338120Sgblack@eecs.umich.edu# Each target must have 'build' in the interior of the path; the
1348120Sgblack@eecs.umich.edu# directory below this will determine the build parameters.  For
1358120Sgblack@eecs.umich.edu# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
1368120Sgblack@eecs.umich.edu# recognize that ALPHA_SE specifies the configuration because it
1378879Ssteve.reinhardt@amd.com# follow 'build' in the bulid path.
1388879Ssteve.reinhardt@amd.com
1398879Ssteve.reinhardt@amd.com# Generate absolute paths to targets so we can see where the build dir is
1408879Ssteve.reinhardt@amd.comif COMMAND_LINE_TARGETS:
14110458Sandreas.hansson@arm.com    # Ask SCons which directory it was invoked from
14210458Sandreas.hansson@arm.com    launch_dir = GetLaunchDir()
14310458Sandreas.hansson@arm.com    # Make targets relative to invocation directory
1448879Ssteve.reinhardt@amd.com    abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))),
1458879Ssteve.reinhardt@amd.com                      COMMAND_LINE_TARGETS)
1468879Ssteve.reinhardt@amd.comelse:
1478879Ssteve.reinhardt@amd.com    # Default targets are relative to root of tree
1489227Sandreas.hansson@arm.com    abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))),
1499227Sandreas.hansson@arm.com                      DEFAULT_TARGETS)
15012063Sgabeblack@google.com
15112063Sgabeblack@google.com
15212063Sgabeblack@google.com# Generate a list of the unique build roots and configs that the
1538879Ssteve.reinhardt@amd.com# collected targets reference.
1548879Ssteve.reinhardt@amd.combuild_paths = []
1558879Ssteve.reinhardt@amd.combuild_root = None
1568879Ssteve.reinhardt@amd.comfor t in abs_targets:
15710453SAndrew.Bardsley@arm.com    path_dirs = t.split('/')
15810453SAndrew.Bardsley@arm.com    try:
15910453SAndrew.Bardsley@arm.com        build_top = rfind(path_dirs, 'build', -2)
16010456SCurtis.Dunham@arm.com    except:
16110456SCurtis.Dunham@arm.com        print "Error: no non-leaf 'build' dir found on target path", t
16210456SCurtis.Dunham@arm.com        Exit(1)
16310457Sandreas.hansson@arm.com    this_build_root = joinpath('/',*path_dirs[:build_top+1])
16410457Sandreas.hansson@arm.com    if not build_root:
16511342Sandreas.hansson@arm.com        build_root = this_build_root
16611342Sandreas.hansson@arm.com    else:
1678120Sgblack@eecs.umich.edu        if this_build_root != build_root:
16812063Sgabeblack@google.com            print "Error: build targets not under same build root\n"\
16912563Sgabeblack@google.com                  "  %s\n  %s" % (build_root, this_build_root)
17012063Sgabeblack@google.com            Exit(1)
17112063Sgabeblack@google.com    build_path = joinpath('/',*path_dirs[:build_top+2])
1725871Snate@binkert.org    if build_path not in build_paths:
1735871Snate@binkert.org        build_paths.append(build_path)
1746121Snate@binkert.org
1755871Snate@binkert.org###################################################
1765871Snate@binkert.org#
1779926Sstan.czerniawski@arm.com# Set up the default build environment.  This environment is copied
17812243Sgabeblack@google.com# and modified according to each selected configuration.
1791533SN/A#
18012246Sgabeblack@google.com###################################################
18112246Sgabeblack@google.com
18212246Sgabeblack@google.comenv = Environment(ENV = os.environ,  # inherit user's environment vars
18312246Sgabeblack@google.com                  ROOT = ROOT,
1849239Sandreas.hansson@arm.com                  SRCDIR = SRCDIR)
1859239Sandreas.hansson@arm.comExport('env')
1869239Sandreas.hansson@arm.com
1879239Sandreas.hansson@arm.com#Parse CC/CXX early so that we use the correct compiler for 
18812563Sgabeblack@google.com# to test for dependencies/versions/libraries/includes
1899239Sandreas.hansson@arm.comif ARGUMENTS.get('CC', None):
1909239Sandreas.hansson@arm.com    env['CC'] = ARGUMENTS.get('CC')
191955SN/A
192955SN/Aif ARGUMENTS.get('CXX', None):
1932632Sstever@eecs.umich.edu    env['CXX'] = ARGUMENTS.get('CXX')
1942632Sstever@eecs.umich.edu
195955SN/Aenv.SConsignFile(joinpath(build_root,"sconsign"))
196955SN/A
197955SN/A# Default duplicate option is to use hard links, but this messes up
198955SN/A# when you use emacs to edit a file in the target dir, as emacs moves
1998878Ssteve.reinhardt@amd.com# file to file~ then copies to file, breaking the link.  Symbolic
200955SN/A# (soft) links work better.
2012632Sstever@eecs.umich.eduenv.SetOption('duplicate', 'soft-copy')
2022632Sstever@eecs.umich.edu
2032632Sstever@eecs.umich.edu# I waffle on this setting... it does avoid a few painful but
2042632Sstever@eecs.umich.edu# unnecessary builds, but it also seems to make trivial builds take
2052632Sstever@eecs.umich.edu# noticeably longer.
2062632Sstever@eecs.umich.eduif False:
2072632Sstever@eecs.umich.edu    env.TargetSignatures('content')
2088268Ssteve.reinhardt@amd.com
2098268Ssteve.reinhardt@amd.com# M5_PLY is used by isa_parser.py to find the PLY package.
2108268Ssteve.reinhardt@amd.comenv.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
2118268Ssteve.reinhardt@amd.comenv['GCC'] = False
2128268Ssteve.reinhardt@amd.comenv['SUNCC'] = False
2138268Ssteve.reinhardt@amd.comenv['ICC'] = False
2148268Ssteve.reinhardt@amd.comenv['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True, 
2152632Sstever@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2162632Sstever@eecs.umich.edu        close_fds=True).communicate()[0].find('GCC') >= 0
2172632Sstever@eecs.umich.eduenv['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
2182632Sstever@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2198268Ssteve.reinhardt@amd.com        close_fds=True).communicate()[0].find('Sun C++') >= 0
2202632Sstever@eecs.umich.eduenv['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
2218268Ssteve.reinhardt@amd.com        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2228268Ssteve.reinhardt@amd.com        close_fds=True).communicate()[0].find('Intel') >= 0
2238268Ssteve.reinhardt@amd.comif env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
2248268Ssteve.reinhardt@amd.com    print 'Error: How can we have two at the same time?'
2253718Sstever@eecs.umich.edu    Exit(1)
2262634Sstever@eecs.umich.edu
2272634Sstever@eecs.umich.edu
2285863Snate@binkert.org# Set up default C++ compiler flags
2292638Sstever@eecs.umich.eduif env['GCC']:
2308268Ssteve.reinhardt@amd.com    env.Append(CCFLAGS='-pipe')
2312632Sstever@eecs.umich.edu    env.Append(CCFLAGS='-fno-strict-aliasing')
2322632Sstever@eecs.umich.edu    env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
2332632Sstever@eecs.umich.eduelif env['ICC']:
2342632Sstever@eecs.umich.edu    pass #Fix me... add warning flags once we clean up icc warnings
23512563Sgabeblack@google.comelif env['SUNCC']:
2361858SN/A    env.Append(CCFLAGS='-Qoption ccfe')
2373716Sstever@eecs.umich.edu    env.Append(CCFLAGS='-features=gcc')
2382638Sstever@eecs.umich.edu    env.Append(CCFLAGS='-features=extensions')
2392638Sstever@eecs.umich.edu    env.Append(CCFLAGS='-library=stlport4')
2402638Sstever@eecs.umich.edu    env.Append(CCFLAGS='-xar')
2412638Sstever@eecs.umich.edu#    env.Append(CCFLAGS='-instances=semiexplicit')
24212563Sgabeblack@google.comelse:
24312563Sgabeblack@google.com    print 'Error: Don\'t know what compiler options to use for your compiler.'
2442638Sstever@eecs.umich.edu    print '       Please fix SConstruct and src/SConscript and try again.'
2455863Snate@binkert.org    Exit(1)
2465863Snate@binkert.org
2475863Snate@binkert.orgif sys.platform == 'cygwin':
248955SN/A    # cygwin has some header file issues...
2495341Sstever@gmail.com    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
2505341Sstever@gmail.comenv.Append(CPPPATH=[Dir('ext/dnet')])
2515863Snate@binkert.org
2527756SAli.Saidi@ARM.com# Check for SWIG
2535341Sstever@gmail.comif not env.has_key('SWIG'):
2546121Snate@binkert.org    print 'Error: SWIG utility not found.'
2554494Ssaidi@eecs.umich.edu    print '       Please install (see http://www.swig.org) and retry.'
2566121Snate@binkert.org    Exit(1)
2571105SN/A
2582667Sstever@eecs.umich.edu# Check for appropriate SWIG version
2592667Sstever@eecs.umich.eduswig_version = os.popen('swig -version').read().split()
2602667Sstever@eecs.umich.edu# First 3 words should be "SWIG Version x.y.z"
2612667Sstever@eecs.umich.eduif swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
2626121Snate@binkert.org    print 'Error determining SWIG version.'
2632667Sstever@eecs.umich.edu    Exit(1)
2645341Sstever@gmail.com
2655863Snate@binkert.orgmin_swig_version = '1.3.28'
2665341Sstever@gmail.comif compare_versions(swig_version[2], min_swig_version) < 0:
2675341Sstever@gmail.com    print 'Error: SWIG version', min_swig_version, 'or newer required.'
2685341Sstever@gmail.com    print '       Installed version:', swig_version[2]
2698120Sgblack@eecs.umich.edu    Exit(1)
2705341Sstever@gmail.com
2718120Sgblack@eecs.umich.edu# Set up SWIG flags & scanner
2725341Sstever@gmail.comenv.Append(SWIGFLAGS=Split('-c++ -python -modern $_CPPINCFLAGS'))
2738120Sgblack@eecs.umich.edu
2746121Snate@binkert.orgimport SCons.Scanner
2756121Snate@binkert.org
2769396Sandreas.hansson@arm.comswig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
2775397Ssaidi@eecs.umich.edu
2785397Ssaidi@eecs.umich.eduswig_scanner = SCons.Scanner.ClassicCPP("SwigScan", ".i", "CPPPATH",
2797727SAli.Saidi@ARM.com                                        swig_inc_re)
2808268Ssteve.reinhardt@amd.com
2816168Snate@binkert.orgenv.Append(SCANNERS = swig_scanner)
2825341Sstever@gmail.com
2838120Sgblack@eecs.umich.edu# Platform-specific configuration.  Note again that we assume that all
2848120Sgblack@eecs.umich.edu# builds under a given build root run on the same host platform.
2858120Sgblack@eecs.umich.educonf = Configure(env,
2866814Sgblack@eecs.umich.edu                 conf_dir = joinpath(build_root, '.scons_config'),
2875863Snate@binkert.org                 log_file = joinpath(build_root, 'scons_config.log'))
2888120Sgblack@eecs.umich.edu
2895341Sstever@gmail.com# Find Python include and library directories for embedding the
2905863Snate@binkert.org# interpreter.  For consistency, we will use the same Python
2918268Ssteve.reinhardt@amd.com# installation used to run scons (and thus this script).  If you want
2926121Snate@binkert.org# to link in an alternate version, see above for instructions on how
2936121Snate@binkert.org# to invoke scons with a different copy of the Python interpreter.
2948268Ssteve.reinhardt@amd.com
2955742Snate@binkert.org# Get brief Python version name (e.g., "python2.4") for locating
2965742Snate@binkert.org# include & library files
2975341Sstever@gmail.compy_version_name = 'python' + sys.version[:3]
2985742Snate@binkert.org
2995742Snate@binkert.org# include path, e.g. /usr/local/include/python2.4
3005341Sstever@gmail.compy_header_path = joinpath(sys.exec_prefix, 'include', py_version_name)
3016017Snate@binkert.orgenv.Append(CPPPATH = py_header_path)
3026121Snate@binkert.org# verify that it works
3036017Snate@binkert.orgif not conf.CheckHeader('Python.h', '<>'):
30412158Sandreas.sandberg@arm.com    print "Error: can't find Python.h header in", py_header_path
30512158Sandreas.sandberg@arm.com    Exit(1)
30612158Sandreas.sandberg@arm.com
3078120Sgblack@eecs.umich.edu# add library path too if it's not in the default place
3087756SAli.Saidi@ARM.compy_lib_path = None
3097756SAli.Saidi@ARM.comif sys.exec_prefix != '/usr':
3107756SAli.Saidi@ARM.com    py_lib_path = joinpath(sys.exec_prefix, 'lib')
3117756SAli.Saidi@ARM.comelif sys.platform == 'cygwin':
3127816Ssteve.reinhardt@amd.com    # cygwin puts the .dll in /bin for some reason
3137816Ssteve.reinhardt@amd.com    py_lib_path = '/bin'
3147816Ssteve.reinhardt@amd.comif py_lib_path:
3157816Ssteve.reinhardt@amd.com    env.Append(LIBPATH = py_lib_path)
3167816Ssteve.reinhardt@amd.com    print 'Adding', py_lib_path, 'to LIBPATH for', py_version_name
31711979Sgabeblack@google.comif not conf.CheckLib(py_version_name):
3187816Ssteve.reinhardt@amd.com    print "Error: can't find Python library", py_version_name
3197816Ssteve.reinhardt@amd.com    Exit(1)
3207816Ssteve.reinhardt@amd.com
3217816Ssteve.reinhardt@amd.com# On Solaris you need to use libsocket for socket ops
3227756SAli.Saidi@ARM.comif not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
3237756SAli.Saidi@ARM.com   if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'):
3249227Sandreas.hansson@arm.com       print "Can't find library with socket calls (e.g. accept())"
3259227Sandreas.hansson@arm.com       Exit(1)
3269227Sandreas.hansson@arm.com
3279227Sandreas.hansson@arm.com# Check for zlib.  If the check passes, libz will be automatically
3289590Sandreas@sandberg.pp.se# added to the LIBS environment variable.
3299590Sandreas@sandberg.pp.seif not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
3309590Sandreas@sandberg.pp.se    print 'Error: did not find needed zlib compression library '\
3319590Sandreas@sandberg.pp.se          'and/or zlib.h header file.'
3329590Sandreas@sandberg.pp.se    print '       Please install zlib and try again.'
3339590Sandreas@sandberg.pp.se    Exit(1)
3346654Snate@binkert.org
3356654Snate@binkert.org# Check for <fenv.h> (C99 FP environment control)
3365871Snate@binkert.orghave_fenv = conf.CheckHeader('fenv.h', '<>')
3376121Snate@binkert.orgif not have_fenv:
3388946Sandreas.hansson@arm.com    print "Warning: Header file <fenv.h> not found."
3399419Sandreas.hansson@arm.com    print "         This host has no IEEE FP rounding mode control."
34012563Sgabeblack@google.com
3413918Ssaidi@eecs.umich.edu# Check for mysql.
3423918Ssaidi@eecs.umich.edumysql_config = WhereIs('mysql_config')
3431858SN/Ahave_mysql = mysql_config != None
3449556Sandreas.hansson@arm.com
3459556Sandreas.hansson@arm.com# Check MySQL version.
3469556Sandreas.hansson@arm.comif have_mysql:
3479556Sandreas.hansson@arm.com    mysql_version = os.popen(mysql_config + ' --version').read()
34811294Sandreas.hansson@arm.com    min_mysql_version = '4.1'
34911294Sandreas.hansson@arm.com    if compare_versions(mysql_version, min_mysql_version) < 0:
35011294Sandreas.hansson@arm.com        print 'Warning: MySQL', min_mysql_version, 'or newer required.'
35111294Sandreas.hansson@arm.com        print '         Version', mysql_version, 'detected.'
35210878Sandreas.hansson@arm.com        have_mysql = False
35310878Sandreas.hansson@arm.com
35411811Sbaz21@cam.ac.uk# Set up mysql_config commands.
35511811Sbaz21@cam.ac.ukif have_mysql:
35611811Sbaz21@cam.ac.uk    mysql_config_include = mysql_config + ' --include'
35711982Sgabeblack@google.com    if os.system(mysql_config_include + ' > /dev/null') != 0:
35811982Sgabeblack@google.com        # older mysql_config versions don't support --include, use
35911982Sgabeblack@google.com        # --cflags instead
36011982Sgabeblack@google.com        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
36111992Sgabeblack@google.com    # This seems to work in all versions
36211982Sgabeblack@google.com    mysql_config_libs = mysql_config + ' --libs'
36311982Sgabeblack@google.com
36412305Sgabeblack@google.comenv = conf.Finish()
36512305Sgabeblack@google.com
36612305Sgabeblack@google.com# Define the universe of supported ISAs
36712305Sgabeblack@google.comall_isa_list = [ ]
36812305Sgabeblack@google.comExport('all_isa_list')
36912305Sgabeblack@google.com
37012305Sgabeblack@google.com# Define the universe of supported CPU models
3719556Sandreas.hansson@arm.comall_cpu_list = [ ]
37212563Sgabeblack@google.comdefault_cpus = [ ]
37312563Sgabeblack@google.comExport('all_cpu_list', 'default_cpus')
37412563Sgabeblack@google.com
37512563Sgabeblack@google.com# Sticky options get saved in the options file so they persist from
3769556Sandreas.hansson@arm.com# one invocation to the next (unless overridden, in which case the new
37712563Sgabeblack@google.com# value becomes sticky).
37812563Sgabeblack@google.comsticky_opts = Options(args=ARGUMENTS)
3799556Sandreas.hansson@arm.comExport('sticky_opts')
38012563Sgabeblack@google.com
38112563Sgabeblack@google.com# Non-sticky options only apply to the current build.
38212563Sgabeblack@google.comnonsticky_opts = Options(args=ARGUMENTS)
38312563Sgabeblack@google.comExport('nonsticky_opts')
38412563Sgabeblack@google.com
38512563Sgabeblack@google.com# Walk the tree and execute all SConsopts scripts that wil add to the
38612563Sgabeblack@google.com# above options
38712563Sgabeblack@google.comfor root, dirs, files in os.walk('.'):
3889556Sandreas.hansson@arm.com    if 'SConsopts' in files:
3899556Sandreas.hansson@arm.com        SConscript(os.path.join(root, 'SConsopts'))
3906121Snate@binkert.org
39111500Sandreas.hansson@arm.comall_isa_list.sort()
39210238Sandreas.hansson@arm.comall_cpu_list.sort()
39310878Sandreas.hansson@arm.comdefault_cpus.sort()
3949420Sandreas.hansson@arm.com
39511500Sandreas.hansson@arm.comsticky_opts.AddOptions(
39612563Sgabeblack@google.com    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
39712563Sgabeblack@google.com    BoolOption('FULL_SYSTEM', 'Full-system support', False),
3989420Sandreas.hansson@arm.com    # There's a bug in scons 0.96.1 that causes ListOptions with list
3999420Sandreas.hansson@arm.com    # values (more than one value) not to be able to be restored from
4009420Sandreas.hansson@arm.com    # a saved option file.  If this causes trouble then upgrade to
4019420Sandreas.hansson@arm.com    # scons 0.96.90 or later.
40212063Sgabeblack@google.com    ListOption('CPU_MODELS', 'CPU models', default_cpus, all_cpu_list),
40312063Sgabeblack@google.com    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
40412063Sgabeblack@google.com    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
40512063Sgabeblack@google.com               False),
40612063Sgabeblack@google.com    BoolOption('SS_COMPATIBLE_FP',
40712063Sgabeblack@google.com               'Make floating-point results compatible with SimpleScalar',
40812063Sgabeblack@google.com               False),
40912063Sgabeblack@google.com    BoolOption('USE_SSE2',
41012063Sgabeblack@google.com               'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts',
41112063Sgabeblack@google.com               False),
41212063Sgabeblack@google.com    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
41312063Sgabeblack@google.com    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
41412063Sgabeblack@google.com    BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False),
41512063Sgabeblack@google.com    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
41612063Sgabeblack@google.com    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
41712063Sgabeblack@google.com    BoolOption('BATCH', 'Use batch pool for build and tests', False),
41812063Sgabeblack@google.com    ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
41912063Sgabeblack@google.com    ('PYTHONHOME',
42012063Sgabeblack@google.com     'Override the default PYTHONHOME for this system (use with caution)',
42112063Sgabeblack@google.com     '%s:%s' % (sys.prefix, sys.exec_prefix))
42212063Sgabeblack@google.com    )
42312063Sgabeblack@google.com
42410264Sandreas.hansson@arm.comnonsticky_opts.AddOptions(
42510264Sandreas.hansson@arm.com    BoolOption('update_ref', 'Update test reference outputs', False)
42610264Sandreas.hansson@arm.com    )
42710264Sandreas.hansson@arm.com
42811925Sgabeblack@google.com# These options get exported to #defines in config/*.hh (see src/SConscript).
42911925Sgabeblack@google.comenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
43011500Sandreas.hansson@arm.com                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
43110264Sandreas.hansson@arm.com                     'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA']
43211500Sandreas.hansson@arm.com
43311500Sandreas.hansson@arm.com# Define a handy 'no-op' action
43411500Sandreas.hansson@arm.comdef no_action(target, source, env):
43511500Sandreas.hansson@arm.com    return 0
43610866Sandreas.hansson@arm.com
43711500Sandreas.hansson@arm.comenv.NoAction = Action(no_action, None)
43812563Sgabeblack@google.com
43912563Sgabeblack@google.com###################################################
44012563Sgabeblack@google.com#
44112563Sgabeblack@google.com# Define a SCons builder for configuration flag headers.
44212563Sgabeblack@google.com#
44312563Sgabeblack@google.com###################################################
44410264Sandreas.hansson@arm.com
44510457Sandreas.hansson@arm.com# This function generates a config header file that #defines the
44610457Sandreas.hansson@arm.com# option symbol to the current option setting (0 or 1).  The source
44710457Sandreas.hansson@arm.com# operands are the name of the option and a Value node containing the
44810457Sandreas.hansson@arm.com# value of the option.
44910457Sandreas.hansson@arm.comdef build_config_file(target, source, env):
45012563Sgabeblack@google.com    (option, value) = [s.get_contents() for s in source]
45112563Sgabeblack@google.com    f = file(str(target[0]), 'w')
45212563Sgabeblack@google.com    print >> f, '#define', option, value
45310457Sandreas.hansson@arm.com    f.close()
45412063Sgabeblack@google.com    return None
45512063Sgabeblack@google.com
45612063Sgabeblack@google.com# Generate the message to be printed when building the config file.
45712563Sgabeblack@google.comdef build_config_file_string(target, source, env):
45812563Sgabeblack@google.com    (option, value) = [s.get_contents() for s in source]
45912563Sgabeblack@google.com    return "Defining %s as %s in %s." % (option, value, target[0])
46012563Sgabeblack@google.com
46112563Sgabeblack@google.com# Combine the two functions into a scons Action object.
46212563Sgabeblack@google.comconfig_action = Action(build_config_file, build_config_file_string)
46312063Sgabeblack@google.com
46412063Sgabeblack@google.com# The emitter munges the source & target node lists to reflect what
46510238Sandreas.hansson@arm.com# we're really doing.
46610238Sandreas.hansson@arm.comdef config_emitter(target, source, env):
46710238Sandreas.hansson@arm.com    # extract option name from Builder arg
46812063Sgabeblack@google.com    option = str(target[0])
46910238Sandreas.hansson@arm.com    # True target is config header file
47010238Sandreas.hansson@arm.com    target = joinpath('config', option.lower() + '.hh')
47110416Sandreas.hansson@arm.com    val = env[option]
47210238Sandreas.hansson@arm.com    if isinstance(val, bool):
4739227Sandreas.hansson@arm.com        # Force value to 0/1
47410238Sandreas.hansson@arm.com        val = int(val)
47510416Sandreas.hansson@arm.com    elif isinstance(val, str):
47610416Sandreas.hansson@arm.com        val = '"' + val + '"'
4779227Sandreas.hansson@arm.com        
4789590Sandreas@sandberg.pp.se    # Sources are option name & value (packaged in SCons Value nodes)
4799590Sandreas@sandberg.pp.se    return ([target], [Value(option), Value(val)])
4809590Sandreas@sandberg.pp.se
48111497SMatteo.Andreozzi@arm.comconfig_builder = Builder(emitter = config_emitter, action = config_action)
48211497SMatteo.Andreozzi@arm.com
48311497SMatteo.Andreozzi@arm.comenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
48411497SMatteo.Andreozzi@arm.com
48512304Sgabeblack@google.com###################################################
48612304Sgabeblack@google.com#
48712304Sgabeblack@google.com# Define a SCons builder for copying files.  This is used by the
48812304Sgabeblack@google.com# Python zipfile code in src/python/SConscript, but is placed up here
48912304Sgabeblack@google.com# since it's potentially more generally applicable.
49012304Sgabeblack@google.com#
49112304Sgabeblack@google.com###################################################
49212304Sgabeblack@google.com
49312304Sgabeblack@google.comcopy_builder = Builder(action = Copy("$TARGET", "$SOURCE"))
49412304Sgabeblack@google.com
49512304Sgabeblack@google.comenv.Append(BUILDERS = { 'CopyFile' : copy_builder })
49612304Sgabeblack@google.com
49712304Sgabeblack@google.com###################################################
49812304Sgabeblack@google.com#
49912304Sgabeblack@google.com# Define a simple SCons builder to concatenate files.
50012304Sgabeblack@google.com#
50112304Sgabeblack@google.com# Used to append the Python zip archive to the executable.
50212304Sgabeblack@google.com#
50312304Sgabeblack@google.com###################################################
5048737Skoansin.tan@gmail.com
50510878Sandreas.hansson@arm.comconcat_builder = Builder(action = Action(['cat $SOURCES > $TARGET',
50611500Sandreas.hansson@arm.com                                          'chmod +x $TARGET']))
5079420Sandreas.hansson@arm.com
5088737Skoansin.tan@gmail.comenv.Append(BUILDERS = { 'Concat' : concat_builder })
50910106SMitch.Hayenga@arm.com
5108737Skoansin.tan@gmail.com
5118737Skoansin.tan@gmail.com# base help text
51210878Sandreas.hansson@arm.comhelp_text = '''
51312563Sgabeblack@google.comUsage: scons [scons options] [build options] [target(s)]
51412563Sgabeblack@google.com
5158737Skoansin.tan@gmail.com'''
5168737Skoansin.tan@gmail.com
51712563Sgabeblack@google.com# libelf build is shared across all configs in the build root.
5188737Skoansin.tan@gmail.comenv.SConscript('ext/libelf/SConscript',
5198737Skoansin.tan@gmail.com               build_dir = joinpath(build_root, 'libelf'),
52011294Sandreas.hansson@arm.com               exports = 'env')
5219556Sandreas.hansson@arm.com
5229556Sandreas.hansson@arm.com###################################################
5239556Sandreas.hansson@arm.com#
52411294Sandreas.hansson@arm.com# This function is used to set up a directory with switching headers
52510278SAndreas.Sandberg@ARM.com#
52610278SAndreas.Sandberg@ARM.com###################################################
52710278SAndreas.Sandberg@ARM.com
52810278SAndreas.Sandberg@ARM.comenv['ALL_ISA_LIST'] = all_isa_list
52910278SAndreas.Sandberg@ARM.comdef make_switching_dir(dirname, switch_headers, env):
53010278SAndreas.Sandberg@ARM.com    # Generate the header.  target[0] is the full path of the output
5319556Sandreas.hansson@arm.com    # header to generate.  'source' is a dummy variable, since we get the
5329590Sandreas@sandberg.pp.se    # list of ISAs from env['ALL_ISA_LIST'].
5339590Sandreas@sandberg.pp.se    def gen_switch_hdr(target, source, env):
5349420Sandreas.hansson@arm.com	fname = str(target[0])
5359846Sandreas.hansson@arm.com	basename = os.path.basename(fname)
5369846Sandreas.hansson@arm.com	f = open(fname, 'w')
5379846Sandreas.hansson@arm.com	f.write('#include "arch/isa_specific.hh"\n')
5389846Sandreas.hansson@arm.com	cond = '#if'
5398946Sandreas.hansson@arm.com	for isa in all_isa_list:
54011811Sbaz21@cam.ac.uk	    f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
54111811Sbaz21@cam.ac.uk		    % (cond, isa.upper(), dirname, isa, basename))
54211811Sbaz21@cam.ac.uk	    cond = '#elif'
54311811Sbaz21@cam.ac.uk	f.write('#else\n#error "THE_ISA not set"\n#endif\n')
54412304Sgabeblack@google.com	f.close()
54512304Sgabeblack@google.com	return 0
54612304Sgabeblack@google.com
54712304Sgabeblack@google.com    # String to print when generating header
54812304Sgabeblack@google.com    def gen_switch_hdr_string(target, source, env):
54912304Sgabeblack@google.com	return "Generating switch header " + str(target[0])
55012304Sgabeblack@google.com
55112304Sgabeblack@google.com    # Build SCons Action object. 'varlist' specifies env vars that this
55212304Sgabeblack@google.com    # action depends on; when env['ALL_ISA_LIST'] changes these actions
55312304Sgabeblack@google.com    # should get re-executed.
55412304Sgabeblack@google.com    switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
55512304Sgabeblack@google.com                               varlist=['ALL_ISA_LIST'])
55612304Sgabeblack@google.com
55712304Sgabeblack@google.com    # Instantiate actions for each header
55812304Sgabeblack@google.com    for hdr in switch_headers:
55912304Sgabeblack@google.com        env.Command(hdr, [], switch_hdr_action)
5603918Ssaidi@eecs.umich.eduExport('make_switching_dir')
56112563Sgabeblack@google.com
56212563Sgabeblack@google.com###################################################
56312563Sgabeblack@google.com#
56412563Sgabeblack@google.com# Define build environments for selected configurations.
5659068SAli.Saidi@ARM.com#
56612563Sgabeblack@google.com###################################################
56712563Sgabeblack@google.com
5689068SAli.Saidi@ARM.com# rename base env
56912563Sgabeblack@google.combase_env = env
57012563Sgabeblack@google.com
57112563Sgabeblack@google.comfor build_path in build_paths:
57212563Sgabeblack@google.com    print "Building in", build_path
57312563Sgabeblack@google.com    # build_dir is the tail component of build path, and is used to
57412563Sgabeblack@google.com    # determine the build parameters (e.g., 'ALPHA_SE')
57512563Sgabeblack@google.com    (build_root, build_dir) = os.path.split(build_path)
57612563Sgabeblack@google.com    # Make a copy of the build-root environment to use for this config.
5773918Ssaidi@eecs.umich.edu    env = base_env.Copy()
5783918Ssaidi@eecs.umich.edu
5796157Snate@binkert.org    # Set env options according to the build directory config.
5806157Snate@binkert.org    sticky_opts.files = []
5816157Snate@binkert.org    # Options for $BUILD_ROOT/$BUILD_DIR are stored in
5826157Snate@binkert.org    # $BUILD_ROOT/options/$BUILD_DIR so you can nuke
5835397Ssaidi@eecs.umich.edu    # $BUILD_ROOT/$BUILD_DIR without losing your options settings.
5845397Ssaidi@eecs.umich.edu    current_opts_file = joinpath(build_root, 'options', build_dir)
5856121Snate@binkert.org    if os.path.isfile(current_opts_file):
5866121Snate@binkert.org        sticky_opts.files.append(current_opts_file)
5876121Snate@binkert.org        print "Using saved options file %s" % current_opts_file
5886121Snate@binkert.org    else:
5896121Snate@binkert.org        # Build dir-specific options file doesn't exist.
5906121Snate@binkert.org
5915397Ssaidi@eecs.umich.edu        # Make sure the directory is there so we can create it later
5921851SN/A        opt_dir = os.path.dirname(current_opts_file)
5931851SN/A        if not os.path.isdir(opt_dir):
5947739Sgblack@eecs.umich.edu            os.mkdir(opt_dir)
595955SN/A
5969396Sandreas.hansson@arm.com        # Get default build options from source tree.  Options are
5979396Sandreas.hansson@arm.com        # normally determined by name of $BUILD_DIR, but can be
5989396Sandreas.hansson@arm.com        # overriden by 'default=' arg on command line.
5999396Sandreas.hansson@arm.com        default_opts_file = joinpath('build_opts',
6009396Sandreas.hansson@arm.com                                     ARGUMENTS.get('default', build_dir))
6019396Sandreas.hansson@arm.com        if os.path.isfile(default_opts_file):
60212563Sgabeblack@google.com            sticky_opts.files.append(default_opts_file)
60312563Sgabeblack@google.com            print "Options file %s not found,\n  using defaults in %s" \
60412563Sgabeblack@google.com                  % (current_opts_file, default_opts_file)
60512563Sgabeblack@google.com        else:
6069396Sandreas.hansson@arm.com            print "Error: cannot find options file %s or %s" \
6079396Sandreas.hansson@arm.com                  % (current_opts_file, default_opts_file)
6089396Sandreas.hansson@arm.com            Exit(1)
6099396Sandreas.hansson@arm.com
6109396Sandreas.hansson@arm.com    # Apply current option settings to env
6119396Sandreas.hansson@arm.com    sticky_opts.Update(env)
61212563Sgabeblack@google.com    nonsticky_opts.Update(env)
61312563Sgabeblack@google.com
61412563Sgabeblack@google.com    help_text += "Sticky options for %s:\n" % build_dir \
61512563Sgabeblack@google.com                 + sticky_opts.GenerateHelpText(env) \
61612563Sgabeblack@google.com                 + "\nNon-sticky options for %s:\n" % build_dir \
6179477Sandreas.hansson@arm.com                 + nonsticky_opts.GenerateHelpText(env)
6189477Sandreas.hansson@arm.com
6199477Sandreas.hansson@arm.com    # Process option settings.
6209477Sandreas.hansson@arm.com
6219477Sandreas.hansson@arm.com    if not have_fenv and env['USE_FENV']:
6229477Sandreas.hansson@arm.com        print "Warning: <fenv.h> not available; " \
6239477Sandreas.hansson@arm.com              "forcing USE_FENV to False in", build_dir + "."
6249477Sandreas.hansson@arm.com        env['USE_FENV'] = False
6259477Sandreas.hansson@arm.com
6269477Sandreas.hansson@arm.com    if not env['USE_FENV']:
6279477Sandreas.hansson@arm.com        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
6289477Sandreas.hansson@arm.com        print "         FP results may deviate slightly from other platforms."
6299477Sandreas.hansson@arm.com
6309477Sandreas.hansson@arm.com    if env['EFENCE']:
63112563Sgabeblack@google.com        env.Append(LIBS=['efence'])
63212563Sgabeblack@google.com
63312563Sgabeblack@google.com    if env['USE_MYSQL']:
6349396Sandreas.hansson@arm.com        if not have_mysql:
6352667Sstever@eecs.umich.edu            print "Warning: MySQL not available; " \
63610710Sandreas.hansson@arm.com                  "forcing USE_MYSQL to False in", build_dir + "."
63710710Sandreas.hansson@arm.com            env['USE_MYSQL'] = False
63810710Sandreas.hansson@arm.com        else:
63911811Sbaz21@cam.ac.uk            print "Compiling in", build_dir, "with MySQL support."
64011811Sbaz21@cam.ac.uk            env.ParseConfig(mysql_config_libs)
64111811Sbaz21@cam.ac.uk            env.ParseConfig(mysql_config_include)
64211811Sbaz21@cam.ac.uk
64311811Sbaz21@cam.ac.uk    # Save sticky option settings back to current options file
64411811Sbaz21@cam.ac.uk    sticky_opts.Save(current_opts_file, env)
64510710Sandreas.hansson@arm.com
64610710Sandreas.hansson@arm.com    # Do this after we save setting back, or else we'll tack on an
64710710Sandreas.hansson@arm.com    # extra 'qdo' every time we run scons.
64810710Sandreas.hansson@arm.com    if env['BATCH']:
64910384SCurtis.Dunham@arm.com        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
6509986Sandreas@sandberg.pp.se        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
6519986Sandreas@sandberg.pp.se
6529986Sandreas@sandberg.pp.se    if env['USE_SSE2']:
6539986Sandreas@sandberg.pp.se        env.Append(CCFLAGS='-msse2')
6549986Sandreas@sandberg.pp.se
6559986Sandreas@sandberg.pp.se    # The src/SConscript file sets up the build rules in 'env' according
6569986Sandreas@sandberg.pp.se    # to the configured options.  It returns a list of environments,
6579986Sandreas@sandberg.pp.se    # one for each variant build (debug, opt, etc.)
6589986Sandreas@sandberg.pp.se    envList = SConscript('src/SConscript', build_dir = build_path,
6599986Sandreas@sandberg.pp.se                         exports = 'env')
6609986Sandreas@sandberg.pp.se
6619986Sandreas@sandberg.pp.se    # Set up the regression tests for each build.
6629986Sandreas@sandberg.pp.se    for e in envList:
6639986Sandreas@sandberg.pp.se        SConscript('tests/SConscript',
6649986Sandreas@sandberg.pp.se                   build_dir = joinpath(build_path, 'tests', e.Label),
6659986Sandreas@sandberg.pp.se                   exports = { 'env' : e }, duplicate = False)
6669986Sandreas@sandberg.pp.se
6679986Sandreas@sandberg.pp.seHelp(help_text)
6689986Sandreas@sandberg.pp.se
6699986Sandreas@sandberg.pp.se
6702638Sstever@eecs.umich.edu###################################################
6712638Sstever@eecs.umich.edu#
6726121Snate@binkert.org# Let SCons do its thing.  At this point SCons will use the defined
6733716Sstever@eecs.umich.edu# build environments to build the requested targets.
6745522Snate@binkert.org#
6759986Sandreas@sandberg.pp.se###################################################
6769986Sandreas@sandberg.pp.se
6779986Sandreas@sandberg.pp.se