SConstruct revision 3918
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.edu# Python library imports
672761Sstever@eecs.umich.eduimport sys
682761Sstever@eecs.umich.eduimport os
692761Sstever@eecs.umich.eduimport subprocess
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
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).
928878Ssteve.reinhardt@amd.comROOT = Dir('.').abspath
935863Snate@binkert.org
945863Snate@binkert.org# Path to the M5 source tree.
955863Snate@binkert.orgSRCDIR = joinpath(ROOT, 'src')
9612178Sprosenfeld@micron.com
975863Snate@binkert.org# tell python where to find m5 python code
9812178Sprosenfeld@micron.comsys.path.append(joinpath(ROOT, 'src/python'))
995863Snate@binkert.org
1005863Snate@binkert.org###################################################
1015863Snate@binkert.org#
1029812Sandreas.hansson@arm.com# Figure out which configurations to set up based on the path(s) of
1039812Sandreas.hansson@arm.com# the target(s).
1045863Snate@binkert.org#
1055863Snate@binkert.org###################################################
1068878Ssteve.reinhardt@amd.com
1075863Snate@binkert.org# Find default configuration & binary.
1085863Snate@binkert.orgDefault(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
1095863Snate@binkert.org
1106654Snate@binkert.org# helper function: find last occurrence of element in list
11110196SCurtis.Dunham@arm.comdef rfind(l, elt, offs = -1):
112955SN/A    for i in range(len(l)+offs, 0, -1):
1135396Ssaidi@eecs.umich.edu        if l[i] == elt:
11411401Sandreas.sandberg@arm.com            return i
1155863Snate@binkert.org    raise ValueError, "element not found"
1165863Snate@binkert.org
1174202Sbinkertn@umich.edu# helper function: compare dotted version numbers.
1185863Snate@binkert.org# E.g., compare_version('1.3.25', '1.4.1')
1195863Snate@binkert.org# returns -1, 0, 1 if v1 is <, ==, > v2
1205863Snate@binkert.orgdef compare_versions(v1, v2):
1215863Snate@binkert.org    # Convert dotted strings to lists
122955SN/A    v1 = map(int, v1.split('.'))
1236654Snate@binkert.org    v2 = map(int, v2.split('.'))
1245273Sstever@gmail.com    # Compare corresponding elements of lists
1255871Snate@binkert.org    for n1,n2 in zip(v1, v2):
1265273Sstever@gmail.com        if n1 < n2: return -1
1276655Snate@binkert.org        if n1 > n2: return  1
1288878Ssteve.reinhardt@amd.com    # all corresponding values are equal... see if one has extra values
1296655Snate@binkert.org    if len(v1) < len(v2): return -1
1306655Snate@binkert.org    if len(v1) > len(v2): return  1
1319219Spower.jg@gmail.com    return 0
1326655Snate@binkert.org
1335871Snate@binkert.org# Each target must have 'build' in the interior of the path; the
1346654Snate@binkert.org# directory below this will determine the build parameters.  For
1358947Sandreas.hansson@arm.com# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
1365396Ssaidi@eecs.umich.edu# recognize that ALPHA_SE specifies the configuration because it
1378120Sgblack@eecs.umich.edu# follow 'build' in the bulid path.
1388120Sgblack@eecs.umich.edu
1398120Sgblack@eecs.umich.edu# Generate absolute paths to targets so we can see where the build dir is
1408120Sgblack@eecs.umich.eduif COMMAND_LINE_TARGETS:
1418120Sgblack@eecs.umich.edu    # Ask SCons which directory it was invoked from
1428120Sgblack@eecs.umich.edu    launch_dir = GetLaunchDir()
1438120Sgblack@eecs.umich.edu    # Make targets relative to invocation directory
1448120Sgblack@eecs.umich.edu    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
1488879Ssteve.reinhardt@amd.com    abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))),
1498879Ssteve.reinhardt@amd.com                      DEFAULT_TARGETS)
1508879Ssteve.reinhardt@amd.com
1518879Ssteve.reinhardt@amd.com
1528879Ssteve.reinhardt@amd.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:
1578879Ssteve.reinhardt@amd.com    path_dirs = t.split('/')
1588120Sgblack@eecs.umich.edu    try:
1598120Sgblack@eecs.umich.edu        build_top = rfind(path_dirs, 'build', -2)
1608120Sgblack@eecs.umich.edu    except:
1618120Sgblack@eecs.umich.edu        print "Error: no non-leaf 'build' dir found on target path", t
1628120Sgblack@eecs.umich.edu        Exit(1)
1638120Sgblack@eecs.umich.edu    this_build_root = joinpath('/',*path_dirs[:build_top+1])
1648120Sgblack@eecs.umich.edu    if not build_root:
1658120Sgblack@eecs.umich.edu        build_root = this_build_root
1668120Sgblack@eecs.umich.edu    else:
1678120Sgblack@eecs.umich.edu        if this_build_root != build_root:
1688120Sgblack@eecs.umich.edu            print "Error: build targets not under same build root\n"\
1698120Sgblack@eecs.umich.edu                  "  %s\n  %s" % (build_root, this_build_root)
1708120Sgblack@eecs.umich.edu            Exit(1)
1718120Sgblack@eecs.umich.edu    build_path = joinpath('/',*path_dirs[:build_top+2])
1728879Ssteve.reinhardt@amd.com    if build_path not in build_paths:
1738879Ssteve.reinhardt@amd.com        build_paths.append(build_path)
1748879Ssteve.reinhardt@amd.com
1758879Ssteve.reinhardt@amd.com###################################################
17610458Sandreas.hansson@arm.com#
17710458Sandreas.hansson@arm.com# Set up the default build environment.  This environment is copied
17810458Sandreas.hansson@arm.com# and modified according to each selected configuration.
1798879Ssteve.reinhardt@amd.com#
1808879Ssteve.reinhardt@amd.com###################################################
1818879Ssteve.reinhardt@amd.com
1828879Ssteve.reinhardt@amd.comenv = Environment(ENV = os.environ,  # inherit user's environment vars
1839227Sandreas.hansson@arm.com                  ROOT = ROOT,
1849227Sandreas.hansson@arm.com                  SRCDIR = SRCDIR)
18512063Sgabeblack@google.com
18612063Sgabeblack@google.com#Parse CC/CXX early so that we use the correct compiler for 
18712063Sgabeblack@google.com# to test for dependencies/versions/libraries/includes
1888879Ssteve.reinhardt@amd.comif ARGUMENTS.get('CC', None):
1898879Ssteve.reinhardt@amd.com    env['CC'] = ARGUMENTS.get('CC')
1908879Ssteve.reinhardt@amd.com
1918879Ssteve.reinhardt@amd.comif ARGUMENTS.get('CXX', None):
19210453SAndrew.Bardsley@arm.com    env['CXX'] = ARGUMENTS.get('CXX')
19310453SAndrew.Bardsley@arm.com
19410453SAndrew.Bardsley@arm.comenv.SConsignFile(joinpath(build_root,"sconsign"))
19510456SCurtis.Dunham@arm.com
19610456SCurtis.Dunham@arm.com# Default duplicate option is to use hard links, but this messes up
19710456SCurtis.Dunham@arm.com# when you use emacs to edit a file in the target dir, as emacs moves
19810457Sandreas.hansson@arm.com# file to file~ then copies to file, breaking the link.  Symbolic
19910457Sandreas.hansson@arm.com# (soft) links work better.
20011342Sandreas.hansson@arm.comenv.SetOption('duplicate', 'soft-copy')
20111342Sandreas.hansson@arm.com
2028120Sgblack@eecs.umich.edu# I waffle on this setting... it does avoid a few painful but
20312063Sgabeblack@google.com# unnecessary builds, but it also seems to make trivial builds take
20412063Sgabeblack@google.com# noticeably longer.
20512063Sgabeblack@google.comif False:
20612063Sgabeblack@google.com    env.TargetSignatures('content')
2078947Sandreas.hansson@arm.com
2087816Ssteve.reinhardt@amd.com# M5_PLY is used by isa_parser.py to find the PLY package.
2095871Snate@binkert.orgenv.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
2105871Snate@binkert.orgenv['GCC'] = False
2116121Snate@binkert.orgenv['SUNCC'] = False
2125871Snate@binkert.orgenv['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True, 
2135871Snate@binkert.org        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2149926Sstan.czerniawski@arm.com        close_fds=True).communicate()[0].find('GCC') >= 0
2159926Sstan.czerniawski@arm.comenv['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
2169119Sandreas.hansson@arm.com        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
21710068Sandreas.hansson@arm.com        close_fds=True).communicate()[0].find('Sun C++') >= 0
21811989Sandreas.sandberg@arm.comif (env['GCC'] and env['SUNCC']):
219955SN/A    print 'Error: How can we have both g++ and Sun C++ at the same time?'
2209416SAndreas.Sandberg@ARM.com    Exit(1)
22111342Sandreas.hansson@arm.com
22211212Sjoseph.gross@amd.com
22311212Sjoseph.gross@amd.com# Set up default C++ compiler flags
22411212Sjoseph.gross@amd.comif env['GCC']:
22511212Sjoseph.gross@amd.com    env.Append(CCFLAGS='-pipe')
22611212Sjoseph.gross@amd.com    env.Append(CCFLAGS='-fno-strict-aliasing')
2279416SAndreas.Sandberg@ARM.com    env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
2289416SAndreas.Sandberg@ARM.comelif env['SUNCC']:
2295871Snate@binkert.org    env.Append(CCFLAGS='-Qoption ccfe')
23010584Sandreas.hansson@arm.com    env.Append(CCFLAGS='-features=gcc')
2319416SAndreas.Sandberg@ARM.com    env.Append(CCFLAGS='-features=extensions')
2329416SAndreas.Sandberg@ARM.com    env.Append(CCFLAGS='-library=stlport4')
2335871Snate@binkert.org    env.Append(CCFLAGS='-xar')
234955SN/A#    env.Append(CCFLAGS='-instances=semiexplicit')
23510671Sandreas.hansson@arm.comelse:
23610671Sandreas.hansson@arm.com    print 'Error: Don\'t know what compiler options to use for your compiler.'
23710671Sandreas.hansson@arm.com    print '       Please fix SConstruct and try again.'
23810671Sandreas.hansson@arm.com    Exit(1)
2398881Smarc.orr@gmail.com
2406121Snate@binkert.orgif sys.platform == 'cygwin':
2416121Snate@binkert.org    # cygwin has some header file issues...
2421533SN/A    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
2439239Sandreas.hansson@arm.comenv.Append(CPPPATH=[Dir('ext/dnet')])
2449239Sandreas.hansson@arm.com
2459239Sandreas.hansson@arm.com# Check for SWIG
2469239Sandreas.hansson@arm.comif not env.has_key('SWIG'):
2479239Sandreas.hansson@arm.com    print 'Error: SWIG utility not found.'
2489239Sandreas.hansson@arm.com    print '       Please install (see http://www.swig.org) and retry.'
2499239Sandreas.hansson@arm.com    Exit(1)
2506655Snate@binkert.org
2516655Snate@binkert.org# Check for appropriate SWIG version
2526655Snate@binkert.orgswig_version = os.popen('swig -version').read().split()
2536655Snate@binkert.org# First 3 words should be "SWIG Version x.y.z"
2545871Snate@binkert.orgif swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
2555871Snate@binkert.org    print 'Error determining SWIG version.'
2565863Snate@binkert.org    Exit(1)
2575871Snate@binkert.org
2588878Ssteve.reinhardt@amd.commin_swig_version = '1.3.28'
2595871Snate@binkert.orgif compare_versions(swig_version[2], min_swig_version) < 0:
2605871Snate@binkert.org    print 'Error: SWIG version', min_swig_version, 'or newer required.'
2615871Snate@binkert.org    print '       Installed version:', swig_version[2]
2625863Snate@binkert.org    Exit(1)
2636121Snate@binkert.org
2645863Snate@binkert.org# Set up SWIG flags & scanner
26511408Sandreas.sandberg@arm.comenv.Append(SWIGFLAGS=Split('-c++ -python -modern $_CPPINCFLAGS'))
26611408Sandreas.sandberg@arm.com
2678336Ssteve.reinhardt@amd.comimport SCons.Scanner
26811469SCurtis.Dunham@arm.com
26911469SCurtis.Dunham@arm.comswig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
2708336Ssteve.reinhardt@amd.com
2714678Snate@binkert.orgswig_scanner = SCons.Scanner.ClassicCPP("SwigScan", ".i", "CPPPATH",
27211887Sandreas.sandberg@arm.com                                        swig_inc_re)
27311887Sandreas.sandberg@arm.com
27411887Sandreas.sandberg@arm.comenv.Append(SCANNERS = swig_scanner)
27511887Sandreas.sandberg@arm.com
27611887Sandreas.sandberg@arm.com# Platform-specific configuration.  Note again that we assume that all
27711887Sandreas.sandberg@arm.com# builds under a given build root run on the same host platform.
27811887Sandreas.sandberg@arm.comconf = Configure(env,
27911887Sandreas.sandberg@arm.com                 conf_dir = joinpath(build_root, '.scons_config'),
28011887Sandreas.sandberg@arm.com                 log_file = joinpath(build_root, 'scons_config.log'))
28111887Sandreas.sandberg@arm.com
28211887Sandreas.sandberg@arm.com# Find Python include and library directories for embedding the
28311408Sandreas.sandberg@arm.com# interpreter.  For consistency, we will use the same Python
28411401Sandreas.sandberg@arm.com# installation used to run scons (and thus this script).  If you want
28511401Sandreas.sandberg@arm.com# to link in an alternate version, see above for instructions on how
28611401Sandreas.sandberg@arm.com# to invoke scons with a different copy of the Python interpreter.
28711401Sandreas.sandberg@arm.com
28811401Sandreas.sandberg@arm.com# Get brief Python version name (e.g., "python2.4") for locating
28911401Sandreas.sandberg@arm.com# include & library files
2908336Ssteve.reinhardt@amd.compy_version_name = 'python' + sys.version[:3]
2918336Ssteve.reinhardt@amd.com
2928336Ssteve.reinhardt@amd.com# include path, e.g. /usr/local/include/python2.4
2934678Snate@binkert.orgpy_header_path = joinpath(sys.exec_prefix, 'include', py_version_name)
29411401Sandreas.sandberg@arm.comenv.Append(CPPPATH = py_header_path)
2954678Snate@binkert.org# verify that it works
2964678Snate@binkert.orgif not conf.CheckHeader('Python.h', '<>'):
29711401Sandreas.sandberg@arm.com    print "Error: can't find Python.h header in", py_header_path
29811401Sandreas.sandberg@arm.com    Exit(1)
2998336Ssteve.reinhardt@amd.com
3004678Snate@binkert.org# add library path too if it's not in the default place
3018336Ssteve.reinhardt@amd.compy_lib_path = None
3028336Ssteve.reinhardt@amd.comif sys.exec_prefix != '/usr':
3038336Ssteve.reinhardt@amd.com    py_lib_path = joinpath(sys.exec_prefix, 'lib')
3048336Ssteve.reinhardt@amd.comelif sys.platform == 'cygwin':
3058336Ssteve.reinhardt@amd.com    # cygwin puts the .dll in /bin for some reason
3068336Ssteve.reinhardt@amd.com    py_lib_path = '/bin'
3075871Snate@binkert.orgif py_lib_path:
3085871Snate@binkert.org    env.Append(LIBPATH = py_lib_path)
3098336Ssteve.reinhardt@amd.com    print 'Adding', py_lib_path, 'to LIBPATH for', py_version_name
31011408Sandreas.sandberg@arm.comif not conf.CheckLib(py_version_name):
31111408Sandreas.sandberg@arm.com    print "Error: can't find Python library", py_version_name
31211408Sandreas.sandberg@arm.com    Exit(1)
31311408Sandreas.sandberg@arm.com
31411408Sandreas.sandberg@arm.com# On Solaris you need to use libsocket for socket ops
31511408Sandreas.sandberg@arm.comif not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
31611408Sandreas.sandberg@arm.com   if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'):
3178336Ssteve.reinhardt@amd.com       print "Can't find library with socket calls (e.g. accept())"
31811401Sandreas.sandberg@arm.com       Exit(1)
31911401Sandreas.sandberg@arm.com
32011401Sandreas.sandberg@arm.com# Check for zlib.  If the check passes, libz will be automatically
3215871Snate@binkert.org# added to the LIBS environment variable.
3228336Ssteve.reinhardt@amd.comif not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
3238336Ssteve.reinhardt@amd.com    print 'Error: did not find needed zlib compression library '\
32411401Sandreas.sandberg@arm.com          'and/or zlib.h header file.'
32511401Sandreas.sandberg@arm.com    print '       Please install zlib and try again.'
32611401Sandreas.sandberg@arm.com    Exit(1)
32711401Sandreas.sandberg@arm.com
32811401Sandreas.sandberg@arm.com# Check for <fenv.h> (C99 FP environment control)
3294678Snate@binkert.orghave_fenv = conf.CheckHeader('fenv.h', '<>')
3305871Snate@binkert.orgif not have_fenv:
3314678Snate@binkert.org    print "Warning: Header file <fenv.h> not found."
33211401Sandreas.sandberg@arm.com    print "         This host has no IEEE FP rounding mode control."
33311401Sandreas.sandberg@arm.com
33411401Sandreas.sandberg@arm.com# Check for mysql.
33511401Sandreas.sandberg@arm.commysql_config = WhereIs('mysql_config')
33611401Sandreas.sandberg@arm.comhave_mysql = mysql_config != None
33711401Sandreas.sandberg@arm.com
33811401Sandreas.sandberg@arm.com# Check MySQL version.
33911401Sandreas.sandberg@arm.comif have_mysql:
34011401Sandreas.sandberg@arm.com    mysql_version = os.popen(mysql_config + ' --version').read()
34111401Sandreas.sandberg@arm.com    min_mysql_version = '4.1'
34211401Sandreas.sandberg@arm.com    if compare_versions(mysql_version, min_mysql_version) < 0:
34311401Sandreas.sandberg@arm.com        print 'Warning: MySQL', min_mysql_version, 'or newer required.'
34411450Sandreas.sandberg@arm.com        print '         Version', mysql_version, 'detected.'
34511450Sandreas.sandberg@arm.com        have_mysql = False
34611450Sandreas.sandberg@arm.com
34711450Sandreas.sandberg@arm.com# Set up mysql_config commands.
34811450Sandreas.sandberg@arm.comif have_mysql:
34911450Sandreas.sandberg@arm.com    mysql_config_include = mysql_config + ' --include'
35011450Sandreas.sandberg@arm.com    if os.system(mysql_config_include + ' > /dev/null') != 0:
35111450Sandreas.sandberg@arm.com        # older mysql_config versions don't support --include, use
35211450Sandreas.sandberg@arm.com        # --cflags instead
35311450Sandreas.sandberg@arm.com        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
35411450Sandreas.sandberg@arm.com    # This seems to work in all versions
35511401Sandreas.sandberg@arm.com    mysql_config_libs = mysql_config + ' --libs'
35611450Sandreas.sandberg@arm.com
35711450Sandreas.sandberg@arm.comenv = conf.Finish()
35811450Sandreas.sandberg@arm.com
35911401Sandreas.sandberg@arm.com# Define the universe of supported ISAs
36011450Sandreas.sandberg@arm.comenv['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips']
36111401Sandreas.sandberg@arm.com
3628336Ssteve.reinhardt@amd.com# Define the universe of supported CPU models
3638336Ssteve.reinhardt@amd.comenv['ALL_CPU_LIST'] = ['AtomicSimpleCPU', 'TimingSimpleCPU',
3648336Ssteve.reinhardt@amd.com                       'O3CPU', 'OzoneCPU']
3658336Ssteve.reinhardt@amd.com
3668336Ssteve.reinhardt@amd.comif os.path.isdir(joinpath(SRCDIR, 'encumbered/cpu/full')):
3678336Ssteve.reinhardt@amd.com    env['ALL_CPU_LIST'] += ['FullCPU']
3688336Ssteve.reinhardt@amd.com
3698336Ssteve.reinhardt@amd.com# Sticky options get saved in the options file so they persist from
3708336Ssteve.reinhardt@amd.com# one invocation to the next (unless overridden, in which case the new
3718336Ssteve.reinhardt@amd.com# value becomes sticky).
37211401Sandreas.sandberg@arm.comsticky_opts = Options(args=ARGUMENTS)
37311401Sandreas.sandberg@arm.comsticky_opts.AddOptions(
3748336Ssteve.reinhardt@amd.com    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', env['ALL_ISA_LIST']),
3758336Ssteve.reinhardt@amd.com    BoolOption('FULL_SYSTEM', 'Full-system support', False),
3768336Ssteve.reinhardt@amd.com    # There's a bug in scons 0.96.1 that causes ListOptions with list
3775871Snate@binkert.org    # values (more than one value) not to be able to be restored from
37811476Sandreas.sandberg@arm.com    # a saved option file.  If this causes trouble then upgrade to
37911476Sandreas.sandberg@arm.com    # scons 0.96.90 or later.
38011476Sandreas.sandberg@arm.com    ListOption('CPU_MODELS', 'CPU models', 'AtomicSimpleCPU,TimingSimpleCPU,O3CPU',
38111476Sandreas.sandberg@arm.com               env['ALL_CPU_LIST']),
38211476Sandreas.sandberg@arm.com    BoolOption('ALPHA_TLASER',
38311476Sandreas.sandberg@arm.com               'Model Alpha TurboLaser platform (vs. Tsunami)', False),
38411476Sandreas.sandberg@arm.com    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
38511476Sandreas.sandberg@arm.com    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
38611476Sandreas.sandberg@arm.com               False),
38711887Sandreas.sandberg@arm.com    BoolOption('SS_COMPATIBLE_FP',
38811887Sandreas.sandberg@arm.com               'Make floating-point results compatible with SimpleScalar',
38911887Sandreas.sandberg@arm.com               False),
39011408Sandreas.sandberg@arm.com    BoolOption('USE_SSE2',
39111887Sandreas.sandberg@arm.com               'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts',
39211887Sandreas.sandberg@arm.com               False),
39311887Sandreas.sandberg@arm.com    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
39411887Sandreas.sandberg@arm.com    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
39511887Sandreas.sandberg@arm.com    BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False),
39611887Sandreas.sandberg@arm.com    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
39711926Sgabeblack@google.com    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
39811926Sgabeblack@google.com    BoolOption('BATCH', 'Use batch pool for build and tests', False),
39911926Sgabeblack@google.com    ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
40011926Sgabeblack@google.com    ('PYTHONHOME',
40111887Sandreas.sandberg@arm.com     'Override the default PYTHONHOME for this system (use with caution)',
40211887Sandreas.sandberg@arm.com     '%s:%s' % (sys.prefix, sys.exec_prefix))
40311944Sandreas.sandberg@arm.com    )
40411887Sandreas.sandberg@arm.com
40511927Sgabeblack@google.com# Non-sticky options only apply to the current build.
40611927Sgabeblack@google.comnonsticky_opts = Options(args=ARGUMENTS)
40711927Sgabeblack@google.comnonsticky_opts.AddOptions(
40811927Sgabeblack@google.com    BoolOption('update_ref', 'Update test reference outputs', False)
40911927Sgabeblack@google.com    )
41011927Sgabeblack@google.com
41111887Sandreas.sandberg@arm.com# These options get exported to #defines in config/*.hh (see src/SConscript).
41211928Sgabeblack@google.comenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
41311928Sgabeblack@google.com                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
41411887Sandreas.sandberg@arm.com                     'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA']
41511887Sandreas.sandberg@arm.com
41611887Sandreas.sandberg@arm.com# Define a handy 'no-op' action
41711887Sandreas.sandberg@arm.comdef no_action(target, source, env):
41811887Sandreas.sandberg@arm.com    return 0
41911887Sandreas.sandberg@arm.com
42011887Sandreas.sandberg@arm.comenv.NoAction = Action(no_action, None)
42111887Sandreas.sandberg@arm.com
42211887Sandreas.sandberg@arm.com###################################################
42311887Sandreas.sandberg@arm.com#
42411476Sandreas.sandberg@arm.com# Define a SCons builder for configuration flag headers.
42511476Sandreas.sandberg@arm.com#
42611408Sandreas.sandberg@arm.com###################################################
42711408Sandreas.sandberg@arm.com
42811408Sandreas.sandberg@arm.com# This function generates a config header file that #defines the
42911408Sandreas.sandberg@arm.com# option symbol to the current option setting (0 or 1).  The source
43011408Sandreas.sandberg@arm.com# operands are the name of the option and a Value node containing the
43111408Sandreas.sandberg@arm.com# value of the option.
43211408Sandreas.sandberg@arm.comdef build_config_file(target, source, env):
43311887Sandreas.sandberg@arm.com    (option, value) = [s.get_contents() for s in source]
43411887Sandreas.sandberg@arm.com    f = file(str(target[0]), 'w')
43511476Sandreas.sandberg@arm.com    print >> f, '#define', option, value
43611887Sandreas.sandberg@arm.com    f.close()
43711887Sandreas.sandberg@arm.com    return None
43811476Sandreas.sandberg@arm.com
43911476Sandreas.sandberg@arm.com# Generate the message to be printed when building the config file.
44011476Sandreas.sandberg@arm.comdef build_config_file_string(target, source, env):
44111476Sandreas.sandberg@arm.com    (option, value) = [s.get_contents() for s in source]
4426121Snate@binkert.org    return "Defining %s as %s in %s." % (option, value, target[0])
443955SN/A
444955SN/A# Combine the two functions into a scons Action object.
4452632Sstever@eecs.umich.educonfig_action = Action(build_config_file, build_config_file_string)
4462632Sstever@eecs.umich.edu
447955SN/A# The emitter munges the source & target node lists to reflect what
448955SN/A# we're really doing.
449955SN/Adef config_emitter(target, source, env):
450955SN/A    # extract option name from Builder arg
4518878Ssteve.reinhardt@amd.com    option = str(target[0])
452955SN/A    # True target is config header file
4532632Sstever@eecs.umich.edu    target = joinpath('config', option.lower() + '.hh')
4542632Sstever@eecs.umich.edu    val = env[option]
4552632Sstever@eecs.umich.edu    if isinstance(val, bool):
4562632Sstever@eecs.umich.edu        # Force value to 0/1
4572632Sstever@eecs.umich.edu        val = int(val)
4582632Sstever@eecs.umich.edu    elif isinstance(val, str):
4592632Sstever@eecs.umich.edu        val = '"' + val + '"'
4608268Ssteve.reinhardt@amd.com        
4618268Ssteve.reinhardt@amd.com    # Sources are option name & value (packaged in SCons Value nodes)
4628268Ssteve.reinhardt@amd.com    return ([target], [Value(option), Value(val)])
4638268Ssteve.reinhardt@amd.com
4648268Ssteve.reinhardt@amd.comconfig_builder = Builder(emitter = config_emitter, action = config_action)
4658268Ssteve.reinhardt@amd.com
4668268Ssteve.reinhardt@amd.comenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
4672632Sstever@eecs.umich.edu
4682632Sstever@eecs.umich.edu###################################################
4692632Sstever@eecs.umich.edu#
4702632Sstever@eecs.umich.edu# Define a SCons builder for copying files.  This is used by the
4718268Ssteve.reinhardt@amd.com# Python zipfile code in src/python/SConscript, but is placed up here
4722632Sstever@eecs.umich.edu# since it's potentially more generally applicable.
4738268Ssteve.reinhardt@amd.com#
4748268Ssteve.reinhardt@amd.com###################################################
4758268Ssteve.reinhardt@amd.com
4768268Ssteve.reinhardt@amd.comcopy_builder = Builder(action = Copy("$TARGET", "$SOURCE"))
4773718Sstever@eecs.umich.edu
4782634Sstever@eecs.umich.eduenv.Append(BUILDERS = { 'CopyFile' : copy_builder })
4792634Sstever@eecs.umich.edu
4805863Snate@binkert.org###################################################
4812638Sstever@eecs.umich.edu#
4828268Ssteve.reinhardt@amd.com# Define a simple SCons builder to concatenate files.
4832632Sstever@eecs.umich.edu#
4842632Sstever@eecs.umich.edu# Used to append the Python zip archive to the executable.
4852632Sstever@eecs.umich.edu#
4862632Sstever@eecs.umich.edu###################################################
4872632Sstever@eecs.umich.edu
4881858SN/Aconcat_builder = Builder(action = Action(['cat $SOURCES > $TARGET',
4893716Sstever@eecs.umich.edu                                          'chmod +x $TARGET']))
4902638Sstever@eecs.umich.edu
4912638Sstever@eecs.umich.eduenv.Append(BUILDERS = { 'Concat' : concat_builder })
4922638Sstever@eecs.umich.edu
4932638Sstever@eecs.umich.edu
4942638Sstever@eecs.umich.edu# base help text
4952638Sstever@eecs.umich.eduhelp_text = '''
4962638Sstever@eecs.umich.eduUsage: scons [scons options] [build options] [target(s)]
4975863Snate@binkert.org
4985863Snate@binkert.org'''
4995863Snate@binkert.org
500955SN/A# libelf build is shared across all configs in the build root.
5015341Sstever@gmail.comenv.SConscript('ext/libelf/SConscript',
5025341Sstever@gmail.com               build_dir = joinpath(build_root, 'libelf'),
5035863Snate@binkert.org               exports = 'env')
5047756SAli.Saidi@ARM.com
5055341Sstever@gmail.com###################################################
5066121Snate@binkert.org#
5074494Ssaidi@eecs.umich.edu# This function is used to set up a directory with switching headers
5086121Snate@binkert.org#
5091105SN/A###################################################
5102667Sstever@eecs.umich.edu
5112667Sstever@eecs.umich.edudef make_switching_dir(dirname, switch_headers, env):
5122667Sstever@eecs.umich.edu    # Generate the header.  target[0] is the full path of the output
5132667Sstever@eecs.umich.edu    # header to generate.  'source' is a dummy variable, since we get the
5146121Snate@binkert.org    # list of ISAs from env['ALL_ISA_LIST'].
5152667Sstever@eecs.umich.edu    def gen_switch_hdr(target, source, env):
5165341Sstever@gmail.com	fname = str(target[0])
5175863Snate@binkert.org	basename = os.path.basename(fname)
5185341Sstever@gmail.com	f = open(fname, 'w')
5195341Sstever@gmail.com	f.write('#include "arch/isa_specific.hh"\n')
5205341Sstever@gmail.com	cond = '#if'
5218120Sgblack@eecs.umich.edu	for isa in env['ALL_ISA_LIST']:
5225341Sstever@gmail.com	    f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
5238120Sgblack@eecs.umich.edu		    % (cond, isa.upper(), dirname, isa, basename))
5245341Sstever@gmail.com	    cond = '#elif'
5258120Sgblack@eecs.umich.edu	f.write('#else\n#error "THE_ISA not set"\n#endif\n')
5266121Snate@binkert.org	f.close()
5276121Snate@binkert.org	return 0
5289396Sandreas.hansson@arm.com
5295397Ssaidi@eecs.umich.edu    # String to print when generating header
5305397Ssaidi@eecs.umich.edu    def gen_switch_hdr_string(target, source, env):
5317727SAli.Saidi@ARM.com	return "Generating switch header " + str(target[0])
5328268Ssteve.reinhardt@amd.com
5336168Snate@binkert.org    # Build SCons Action object. 'varlist' specifies env vars that this
5345341Sstever@gmail.com    # action depends on; when env['ALL_ISA_LIST'] changes these actions
5358120Sgblack@eecs.umich.edu    # should get re-executed.
5368120Sgblack@eecs.umich.edu    switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
5378120Sgblack@eecs.umich.edu                               varlist=['ALL_ISA_LIST'])
5386814Sgblack@eecs.umich.edu
5395863Snate@binkert.org    # Instantiate actions for each header
5408120Sgblack@eecs.umich.edu    for hdr in switch_headers:
5415341Sstever@gmail.com        env.Command(hdr, [], switch_hdr_action)
5425863Snate@binkert.org
5438268Ssteve.reinhardt@amd.comenv.make_switching_dir = make_switching_dir
5446121Snate@binkert.org
5456121Snate@binkert.org###################################################
5468268Ssteve.reinhardt@amd.com#
5475742Snate@binkert.org# Define build environments for selected configurations.
5485742Snate@binkert.org#
5495341Sstever@gmail.com###################################################
5505742Snate@binkert.org
5515742Snate@binkert.org# rename base env
5525341Sstever@gmail.combase_env = env
5536017Snate@binkert.org
5546121Snate@binkert.orgfor build_path in build_paths:
5556017Snate@binkert.org    print "Building in", build_path
55612158Sandreas.sandberg@arm.com    # build_dir is the tail component of build path, and is used to
55712158Sandreas.sandberg@arm.com    # determine the build parameters (e.g., 'ALPHA_SE')
55812158Sandreas.sandberg@arm.com    (build_root, build_dir) = os.path.split(build_path)
5597816Ssteve.reinhardt@amd.com    # Make a copy of the build-root environment to use for this config.
5607756SAli.Saidi@ARM.com    env = base_env.Copy()
5617756SAli.Saidi@ARM.com
5627756SAli.Saidi@ARM.com    # Set env options according to the build directory config.
5637756SAli.Saidi@ARM.com    sticky_opts.files = []
5647756SAli.Saidi@ARM.com    # Options for $BUILD_ROOT/$BUILD_DIR are stored in
5657756SAli.Saidi@ARM.com    # $BUILD_ROOT/options/$BUILD_DIR so you can nuke
5667756SAli.Saidi@ARM.com    # $BUILD_ROOT/$BUILD_DIR without losing your options settings.
5677756SAli.Saidi@ARM.com    current_opts_file = joinpath(build_root, 'options', build_dir)
5687816Ssteve.reinhardt@amd.com    if os.path.isfile(current_opts_file):
5697816Ssteve.reinhardt@amd.com        sticky_opts.files.append(current_opts_file)
5707816Ssteve.reinhardt@amd.com        print "Using saved options file %s" % current_opts_file
5717816Ssteve.reinhardt@amd.com    else:
5727816Ssteve.reinhardt@amd.com        # Build dir-specific options file doesn't exist.
5737816Ssteve.reinhardt@amd.com
5747816Ssteve.reinhardt@amd.com        # Make sure the directory is there so we can create it later
5757816Ssteve.reinhardt@amd.com        opt_dir = os.path.dirname(current_opts_file)
5767816Ssteve.reinhardt@amd.com        if not os.path.isdir(opt_dir):
5777816Ssteve.reinhardt@amd.com            os.mkdir(opt_dir)
5787756SAli.Saidi@ARM.com
5797816Ssteve.reinhardt@amd.com        # Get default build options from source tree.  Options are
5807816Ssteve.reinhardt@amd.com        # normally determined by name of $BUILD_DIR, but can be
5817816Ssteve.reinhardt@amd.com        # overriden by 'default=' arg on command line.
5827816Ssteve.reinhardt@amd.com        default_opts_file = joinpath('build_opts',
5837816Ssteve.reinhardt@amd.com                                     ARGUMENTS.get('default', build_dir))
5847816Ssteve.reinhardt@amd.com        if os.path.isfile(default_opts_file):
5857816Ssteve.reinhardt@amd.com            sticky_opts.files.append(default_opts_file)
5867816Ssteve.reinhardt@amd.com            print "Options file %s not found,\n  using defaults in %s" \
5877816Ssteve.reinhardt@amd.com                  % (current_opts_file, default_opts_file)
5887816Ssteve.reinhardt@amd.com        else:
5897816Ssteve.reinhardt@amd.com            print "Error: cannot find options file %s or %s" \
5907816Ssteve.reinhardt@amd.com                  % (current_opts_file, default_opts_file)
5917816Ssteve.reinhardt@amd.com            Exit(1)
5927816Ssteve.reinhardt@amd.com
5937816Ssteve.reinhardt@amd.com    # Apply current option settings to env
5947816Ssteve.reinhardt@amd.com    sticky_opts.Update(env)
5957816Ssteve.reinhardt@amd.com    nonsticky_opts.Update(env)
5967816Ssteve.reinhardt@amd.com
5977816Ssteve.reinhardt@amd.com    help_text += "Sticky options for %s:\n" % build_dir \
5987816Ssteve.reinhardt@amd.com                 + sticky_opts.GenerateHelpText(env) \
5997816Ssteve.reinhardt@amd.com                 + "\nNon-sticky options for %s:\n" % build_dir \
6007816Ssteve.reinhardt@amd.com                 + nonsticky_opts.GenerateHelpText(env)
6017816Ssteve.reinhardt@amd.com
6027816Ssteve.reinhardt@amd.com    # Process option settings.
6037816Ssteve.reinhardt@amd.com
6047816Ssteve.reinhardt@amd.com    if not have_fenv and env['USE_FENV']:
6057816Ssteve.reinhardt@amd.com        print "Warning: <fenv.h> not available; " \
6067816Ssteve.reinhardt@amd.com              "forcing USE_FENV to False in", build_dir + "."
6077816Ssteve.reinhardt@amd.com        env['USE_FENV'] = False
6087816Ssteve.reinhardt@amd.com
6097816Ssteve.reinhardt@amd.com    if not env['USE_FENV']:
6107816Ssteve.reinhardt@amd.com        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
6117816Ssteve.reinhardt@amd.com        print "         FP results may deviate slightly from other platforms."
6127816Ssteve.reinhardt@amd.com
6137816Ssteve.reinhardt@amd.com    if env['EFENCE']:
6147816Ssteve.reinhardt@amd.com        env.Append(LIBS=['efence'])
6157816Ssteve.reinhardt@amd.com
6167816Ssteve.reinhardt@amd.com    if env['USE_MYSQL']:
6177816Ssteve.reinhardt@amd.com        if not have_mysql:
6187816Ssteve.reinhardt@amd.com            print "Warning: MySQL not available; " \
6197816Ssteve.reinhardt@amd.com                  "forcing USE_MYSQL to False in", build_dir + "."
6207816Ssteve.reinhardt@amd.com            env['USE_MYSQL'] = False
6217816Ssteve.reinhardt@amd.com        else:
6227816Ssteve.reinhardt@amd.com            print "Compiling in", build_dir, "with MySQL support."
6237816Ssteve.reinhardt@amd.com            env.ParseConfig(mysql_config_libs)
6247816Ssteve.reinhardt@amd.com            env.ParseConfig(mysql_config_include)
6257816Ssteve.reinhardt@amd.com
6267816Ssteve.reinhardt@amd.com    # Save sticky option settings back to current options file
6277816Ssteve.reinhardt@amd.com    sticky_opts.Save(current_opts_file, env)
6287816Ssteve.reinhardt@amd.com
6297816Ssteve.reinhardt@amd.com    # Do this after we save setting back, or else we'll tack on an
6307816Ssteve.reinhardt@amd.com    # extra 'qdo' every time we run scons.
6317816Ssteve.reinhardt@amd.com    if env['BATCH']:
6327816Ssteve.reinhardt@amd.com        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
6337816Ssteve.reinhardt@amd.com        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
6347816Ssteve.reinhardt@amd.com
6357816Ssteve.reinhardt@amd.com    if env['USE_SSE2']:
6367816Ssteve.reinhardt@amd.com        env.Append(CCFLAGS='-msse2')
6377816Ssteve.reinhardt@amd.com
6387816Ssteve.reinhardt@amd.com    # The src/SConscript file sets up the build rules in 'env' according
6397816Ssteve.reinhardt@amd.com    # to the configured options.  It returns a list of environments,
6408947Sandreas.hansson@arm.com    # one for each variant build (debug, opt, etc.)
6418947Sandreas.hansson@arm.com    envList = SConscript('src/SConscript', build_dir = build_path,
6427756SAli.Saidi@ARM.com                         exports = 'env')
6438120Sgblack@eecs.umich.edu
6447756SAli.Saidi@ARM.com    # Set up the regression tests for each build.
6457756SAli.Saidi@ARM.com    for e in envList:
6467756SAli.Saidi@ARM.com        SConscript('tests/SConscript',
6477756SAli.Saidi@ARM.com                   build_dir = joinpath(build_path, 'tests', e.Label),
6487816Ssteve.reinhardt@amd.com                   exports = { 'env' : e }, duplicate = False)
6497816Ssteve.reinhardt@amd.com
6507816Ssteve.reinhardt@amd.comHelp(help_text)
6517816Ssteve.reinhardt@amd.com
6527816Ssteve.reinhardt@amd.com
65311979Sgabeblack@google.com###################################################
6547816Ssteve.reinhardt@amd.com#
6557816Ssteve.reinhardt@amd.com# Let SCons do its thing.  At this point SCons will use the defined
6567816Ssteve.reinhardt@amd.com# build environments to build the requested targets.
6577816Ssteve.reinhardt@amd.com#
6587756SAli.Saidi@ARM.com###################################################
6597756SAli.Saidi@ARM.com
6609227Sandreas.hansson@arm.com