SConstruct revision 1889
11689SN/A# -*- mode:python -*-
29444SAndreas.Sandberg@ARM.com
37847Sminkyu.jeong@arm.com# Copyright (c) 2004-2005 The Regents of The University of Michigan
47847Sminkyu.jeong@arm.com# All rights reserved.
57847Sminkyu.jeong@arm.com#
67847Sminkyu.jeong@arm.com# Redistribution and use in source and binary forms, with or without
77847Sminkyu.jeong@arm.com# modification, are permitted provided that the following conditions are
87847Sminkyu.jeong@arm.com# met: redistributions of source code must retain the above copyright
97847Sminkyu.jeong@arm.com# notice, this list of conditions and the following disclaimer;
107847Sminkyu.jeong@arm.com# redistributions in binary form must reproduce the above copyright
117847Sminkyu.jeong@arm.com# notice, this list of conditions and the following disclaimer in the
127847Sminkyu.jeong@arm.com# documentation and/or other materials provided with the distribution;
137847Sminkyu.jeong@arm.com# neither the name of the copyright holders nor the names of its
142323SN/A# contributors may be used to endorse or promote products derived from
151689SN/A# this software without specific prior written permission.
161689SN/A#
171689SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
181689SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
191689SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
201689SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
211689SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
221689SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
231689SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
241689SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
251689SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
261689SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
271689SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
281689SN/A
291689SN/A###################################################
301689SN/A#
311689SN/A# SCons top-level build description (SConstruct) file.
321689SN/A#
331689SN/A# To build M5, you need a directory with three things:
341689SN/A# 1. A copy of this file (named SConstruct).
351689SN/A# 2. A link named 'm5' to the top of the M5 simulator source tree.
361689SN/A# 3. A link named 'ext' to the top of the M5 external source tree.
371689SN/A#
381689SN/A# Then type 'scons' to build the default configuration (see below), or
392665Ssaidi@eecs.umich.edu# 'scons <CONFIG>/<binary>' to build some other configuration (e.g.,
402665Ssaidi@eecs.umich.edu# 'ALPHA_FS/m5.opt' for the optimized full-system version).
412756Sksewell@umich.edu#
421689SN/A###################################################
431689SN/A
444551Sbinkertn@umich.edu# Python library imports
454551Sbinkertn@umich.eduimport sys
468733Sgeoffrey.blake@arm.comimport os
478733Sgeoffrey.blake@arm.com
488733Sgeoffrey.blake@arm.com# Check for recent-enough Python and SCons versions
494551Sbinkertn@umich.eduEnsurePythonVersion(2,3)
502037SN/AEnsureSConsVersion(0,96)
518793Sgblack@eecs.umich.edu
522669Sktlim@umich.edu# The absolute path to the current directory (where this file lives).
538793Sgblack@eecs.umich.eduROOT = Dir('.').abspath
546216Snate@binkert.org
556658Snate@binkert.org# Paths to the M5 and external source trees (local symlinks).
568462Sgeoffrey.blake@arm.comSRCDIR = os.path.join(ROOT, 'm5')
578887Sgeoffrey.blake@arm.comEXT_SRCDIR = os.path.join(ROOT, 'ext')
588229Snate@binkert.org
592632Sstever@eecs.umich.edu# Check for 'm5' and 'ext' links, die if they don't exist.
608232Snate@binkert.orgif not os.path.isdir(SRCDIR):
619444SAndreas.Sandberg@ARM.com    print "Error: '%s' must be a link to the M5 source tree." % SRCDIR
628232Snate@binkert.org    Exit(1)
639527SMatt.Horsnell@arm.com
642669Sktlim@umich.eduif not os.path.isdir('ext'):
656216Snate@binkert.org    print "Error: '%s' must be a link to the M5 external source tree." \
662036SN/A          % EXT_SRCDIR
674167Sbinkertn@umich.edu    Exit(1)
688462Sgeoffrey.blake@arm.com
698793Sgblack@eecs.umich.edu# tell python where to find m5 python code
702292SN/Asys.path.append(os.path.join(SRCDIR, 'python'))
712292SN/A
726221Snate@binkert.org###################################################
736221Snate@binkert.org#
741060SN/A# Figure out which configurations to set up.
755529Snate@binkert.org#
764329Sktlim@umich.edu#
772292SN/A# It's prohibitive to do all the combinations of base configurations
782292SN/A# and options, so we have to infer which ones the user wants.
792292SN/A#
802292SN/A# 1. If there are command-line targets, the configuration(s) are inferred
812292SN/A#    from the directories of those targets.  If scons was invoked from a
822696Sktlim@umich.edu#    subdirectory (using 'scons -u'), those targets have to be
836221Snate@binkert.org#    interpreted relative to that subdirectory.
845529Snate@binkert.org#
852292SN/A# 2. If there are no command-line targets, and scons was invoked from a
868462Sgeoffrey.blake@arm.com#    subdirectory (using 'scons -u'), the configuration is inferred from
872632Sstever@eecs.umich.edu#    the name of the subdirectory.
882292SN/A#
895982Sstever@gmail.com# 3. If there are no command-line targets and scons was invoked from
905982Sstever@gmail.com#    the root build directory, a default configuration is used.  The
915982Sstever@gmail.com#    built-in default is ALPHA_SE, but this can be overridden by setting the
928895Sb.grayson@samsung.com#    M5_DEFAULT_CONFIG shell environment veriable.
938895Sb.grayson@samsung.com#
948895Sb.grayson@samsung.com# In cases 2 & 3, the specific file target defaults to 'm5.debug', but
958895Sb.grayson@samsung.com# this can be overridden by setting the M5_DEFAULT_BINARY shell
962632Sstever@eecs.umich.edu# environment veriable.
972980Sgblack@eecs.umich.edu#
982292SN/A###################################################
992292SN/A
1002292SN/A# Find default configuration & binary.
1012292SN/Adefault_config = os.environ.get('M5_DEFAULT_CONFIG', 'ALPHA_SE')
1022292SN/Adefault_binary = os.environ.get('M5_DEFAULT_BINARY', 'm5.debug')
1032292SN/A
1042292SN/A# Ask SCons which directory it was invoked from.  If you invoke SCons
1052292SN/A# from a subdirectory you must use the '-u' flag.
1062831Sksewell@umich.edulaunch_dir = GetLaunchDir()
1072831Sksewell@umich.edu
1082292SN/A# Build a list 'my_targets' of all the targets relative to ROOT.
1092292SN/Aif launch_dir == ROOT:
1102292SN/A    # invoked from root build dir
1112292SN/A    if len(COMMAND_LINE_TARGETS) != 0:
1122292SN/A        # easy: use specified targets as is
1132292SN/A        my_targets = COMMAND_LINE_TARGETS
1142292SN/A    else:
1152292SN/A        # default target (ALPHA_SE/m5.debug, unless overridden)
1162292SN/A        target = os.path.join(default_config, default_binary)
1172292SN/A        my_targets = [target]
1182292SN/A        Default(target)
1192292SN/Aelse:
1202292SN/A    # invoked from subdirectory
1212292SN/A    if not launch_dir.startswith(ROOT):
1222292SN/A        print "Error: launch dir (%s) not a subdirectory of ROOT (%s)!" \
1232292SN/A              (launch_dir, ROOT)
1241060SN/A        Exit(1)
1251060SN/A    # make launch_dir relative to ROOT (strip ROOT plus slash off front)
1262980Sgblack@eecs.umich.edu    launch_dir = launch_dir[len(ROOT)+1:]
1279023Sgblack@eecs.umich.edu    if len(COMMAND_LINE_TARGETS) != 0:
1289152Satgutier@umich.edu        # make specified targets relative to ROOT
1299152Satgutier@umich.edu        my_targets = map(lambda x: os.path.join(launch_dir, x),
1309377Sgblack@eecs.umich.edu                         COMMAND_LINE_TARGETS)
1319152Satgutier@umich.edu    else:
1329480Snilay@cs.wisc.edu        # build default binary (m5.debug, unless overridden) using the
1339480Snilay@cs.wisc.edu        # config inferred by the invocation directory (the first
1342292SN/A        # subdirectory after ROOT)
1351062SN/A        target = os.path.join(launch_dir.split('/')[0], default_binary)
1362292SN/A        my_targets = [target]
1372292SN/A        Default(target)
1382292SN/A
1392292SN/A# Normalize target paths (gets rid of '..' in the middle, etc.)
1402292SN/Amy_targets = map(os.path.normpath, my_targets)
1411062SN/A
1421062SN/A# Generate a list of the unique configs that the collected targets reference.
1431062SN/Abuild_dirs = []
1441062SN/Afor t in my_targets:
1452292SN/A    dir = t.split('/')[0]
1461062SN/A    if dir not in build_dirs:
1471062SN/A        build_dirs.append(dir)
1482348SN/A
1491062SN/A###################################################
1501062SN/A#
1511062SN/A# Set up the default build environment.  This environment is copied
1521062SN/A# and modified according to each selected configuration.
1532348SN/A#
1541062SN/A###################################################
1551062SN/A
1562292SN/Aenv = Environment(ENV = os.environ,  # inherit user's environment vars
1572301SN/A                  ROOT = ROOT,
1582348SN/A                  SRCDIR = SRCDIR,
1592301SN/A                  EXT_SRCDIR = EXT_SRCDIR)
1602301SN/A
1612301SN/Aenv.SConsignFile("sconsign")
1621062SN/A
1632348SN/A# I waffle on this setting... it does avoid a few painful but
1641062SN/A# unnecessary builds, but it also seems to make trivial builds take
1651062SN/A# noticeably longer.
1662292SN/Aif False:
1671062SN/A    env.TargetSignatures('content')
1682348SN/A
1691062SN/A# M5_EXT is used by isa_parser.py to find the PLY package.
1701062SN/Aenv.Append(ENV = { 'M5_EXT' : EXT_SRCDIR })
1711062SN/A
1722292SN/A# Set up default C++ compiler flags
1731062SN/Aenv.Append(CCFLAGS='-pipe')
1742348SN/Aenv.Append(CCFLAGS='-fno-strict-aliasing')
1751062SN/Aenv.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
1761062SN/Aif sys.platform == 'cygwin':
1772292SN/A    # cygwin has some header file issues...
1787849SAli.Saidi@ARM.com    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
1797849SAli.Saidi@ARM.comenv.Append(CPPPATH=[os.path.join(EXT_SRCDIR + '/dnet')])
1807849SAli.Saidi@ARM.com
1817849SAli.Saidi@ARM.com# Default libraries
1827849SAli.Saidi@ARM.comenv.Append(LIBS=['z'])
1832292SN/A
1842348SN/A# Platform-specific configuration
1852292SN/Aconf = Configure(env)
1862292SN/A
1872292SN/A# Check for <fenv.h> (C99 FP environment control)
1881062SN/Ahave_fenv = conf.CheckHeader('fenv.h', '<>')
1892348SN/Aif not have_fenv:
1901062SN/A    print "Warning: Header file <fenv.h> not found."
1911062SN/A    print "         This host has no IEEE FP rounding mode control."
1922292SN/A
1931062SN/A# Check for mysql.
1942348SN/Amysql_config = WhereIs('mysql_config')
1951062SN/Ahave_mysql = mysql_config != None
1961062SN/A
1971062SN/A# Check MySQL version.
1982307SN/Aif have_mysql:
1992348SN/A    mysql_version = os.popen(mysql_config + ' --version').read()
2002307SN/A    mysql_version = mysql_version.split('.')
2012307SN/A    mysql_major = int(mysql_version[0])
2022307SN/A    mysql_minor = int(mysql_version[1])
2032307SN/A    # This version check is probably overly conservative, but it deals
2048462Sgeoffrey.blake@arm.com    # with the versions we have installed.
2058462Sgeoffrey.blake@arm.com    if mysql_major < 3 or \
2068462Sgeoffrey.blake@arm.com           mysql_major == 3 and mysql_minor < 23 or \
2078462Sgeoffrey.blake@arm.com           mysql_major == 4 and mysql_minor < 1:
2088462Sgeoffrey.blake@arm.com        print "Warning: MySQL v3.23 or v4.1 or newer required."
2098462Sgeoffrey.blake@arm.com        have_mysql = False
2108462Sgeoffrey.blake@arm.com
2118462Sgeoffrey.blake@arm.com# Set up mysql_config commands.
2128462Sgeoffrey.blake@arm.comif have_mysql:
2138462Sgeoffrey.blake@arm.com    mysql_config_include = mysql_config + ' --include'
2148462Sgeoffrey.blake@arm.com    if os.system(mysql_config_include + ' > /dev/null') != 0:
2158462Sgeoffrey.blake@arm.com        # older mysql_config versions don't support --include, use
2168462Sgeoffrey.blake@arm.com        # --cflags instead
2178462Sgeoffrey.blake@arm.com        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
2188462Sgeoffrey.blake@arm.com    # This seems to work in all versions
2198462Sgeoffrey.blake@arm.com    mysql_config_libs = mysql_config + ' --libs'
2208462Sgeoffrey.blake@arm.com
2218462Sgeoffrey.blake@arm.comenv = conf.Finish()
2228462Sgeoffrey.blake@arm.com
2238462Sgeoffrey.blake@arm.com# Sticky options get saved in the options file so they persist from
2248462Sgeoffrey.blake@arm.com# one invocation to the next (unless overridden, in which case the new
2258462Sgeoffrey.blake@arm.com# value becomes sticky).
2268462Sgeoffrey.blake@arm.comsticky_opts = Options(args=ARGUMENTS)
2278462Sgeoffrey.blake@arm.comsticky_opts.AddOptions(
2288462Sgeoffrey.blake@arm.com    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', ('alpha')),
2292301SN/A    BoolOption('FULL_SYSTEM', 'Full-system support', False),
2302348SN/A    BoolOption('ALPHA_TLASER',
2312301SN/A               'Model Alpha TurboLaser platform (vs. Tsunami)', False),
2322301SN/A    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
2332301SN/A    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
2348064SAli.Saidi@ARM.com               False),
2358064SAli.Saidi@ARM.com    BoolOption('SS_COMPATIBLE_FP',
2368064SAli.Saidi@ARM.com               'Make floating-point results compatible with SimpleScalar',
2378064SAli.Saidi@ARM.com               False),
2388064SAli.Saidi@ARM.com    BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql),
2392292SN/A    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
2401062SN/A    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
2411062SN/A    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
2421062SN/A    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
2432348SN/A    BoolOption('BATCH', 'Use batch pool for build and tests', False),
2441062SN/A    ('BATCH_CMD', 'Batch pool submission command name', 'qdo')
2452292SN/A    )
2462292SN/A
2472292SN/A# Non-sticky options only apply to the current build.
2482348SN/Anonsticky_opts = Options(args=ARGUMENTS)
2492292SN/Anonsticky_opts.AddOptions(
2502292SN/A    BoolOption('update_ref', 'Update test reference outputs', False)
2512292SN/A    )
2522292SN/A
2532292SN/A# These options get exported to #defines in config/*.hh (see m5/SConscript).
2542348SN/Aenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
2552292SN/A                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
2562292SN/A                     'STATS_BINNING']
2572348SN/A
2582292SN/A# Define a handy 'no-op' action
2592292SN/Adef no_action(target, source, env):
2602348SN/A    return 0
2612292SN/A
2622292SN/Aenv.NoAction = Action(no_action, None)
2632292SN/A
2641060SN/A# libelf build is described in its own SConscript file.
2651060SN/A# SConscript-global is the build in build/libelf shared among all
2661060SN/A# configs.
2671060SN/Aenv.SConscript('m5/libelf/SConscript-global', exports = 'env')
2682292SN/A
2691060SN/A###################################################
2701060SN/A#
2711060SN/A# Define a SCons builder for configuration flag headers.
2721060SN/A#
2731060SN/A###################################################
2741060SN/A
2751060SN/A# This function generates a config header file that #defines the
2761060SN/A# option symbol to the current option setting (0 or 1).  The source
2771060SN/A# operands are the name of the option and a Value node containing the
2781060SN/A# value of the option.
2791060SN/Adef build_config_file(target, source, env):
2801060SN/A    (option, value) = [s.get_contents() for s in source]
2816221Snate@binkert.org    f = file(str(target[0]), 'w')
2821060SN/A    print >> f, '#define', option, value
2832292SN/A    f.close()
2842292SN/A    return None
2852292SN/A
2862292SN/A# Generate the message to be printed when building the config file.
2872292SN/Adef build_config_file_string(target, source, env):
2882292SN/A    (option, value) = [s.get_contents() for s in source]
2892292SN/A    return "Defining %s as %s in %s." % (option, value, target[0])
2901060SN/A
2911060SN/A# Combine the two functions into a scons Action object.
2921060SN/Aconfig_action = Action(build_config_file, build_config_file_string)
2931060SN/A
2941060SN/A# The emitter munges the source & target node lists to reflect what
2951060SN/A# we're really doing.
2962292SN/Adef config_emitter(target, source, env):
2972292SN/A    # extract option name from Builder arg
2989427SAndreas.Sandberg@ARM.com    option = str(target[0])
2992292SN/A    # True target is config header file
3009444SAndreas.Sandberg@ARM.com    target = os.path.join('config', option.lower() + '.hh')
3019444SAndreas.Sandberg@ARM.com    # Force value to 0/1 even if it's a Python bool
3029444SAndreas.Sandberg@ARM.com    val = int(eval(str(env[option])))
3039444SAndreas.Sandberg@ARM.com    # Sources are option name & value (packaged in SCons Value nodes)
3049444SAndreas.Sandberg@ARM.com    return ([target], [Value(option), Value(val)])
3059444SAndreas.Sandberg@ARM.com
3069444SAndreas.Sandberg@ARM.comconfig_builder = Builder(emitter = config_emitter, action = config_action)
3079444SAndreas.Sandberg@ARM.com
3089444SAndreas.Sandberg@ARM.comenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
3099444SAndreas.Sandberg@ARM.com
3109444SAndreas.Sandberg@ARM.com###################################################
3119444SAndreas.Sandberg@ARM.com#
3129444SAndreas.Sandberg@ARM.com# Define build environments for selected configurations.
3139444SAndreas.Sandberg@ARM.com#
3149444SAndreas.Sandberg@ARM.com###################################################
3159444SAndreas.Sandberg@ARM.com
3169444SAndreas.Sandberg@ARM.com# rename base env
3179444SAndreas.Sandberg@ARM.combase_env = env
3182348SN/A
3196221Snate@binkert.orgfor build_dir in build_dirs:
3209444SAndreas.Sandberg@ARM.com    # Make a copy of the default environment to use for this config.
3217720Sgblack@eecs.umich.edu    env = base_env.Copy()
3227764Sgblack@eecs.umich.edu    # Set env according to the build directory config.
3237764Sgblack@eecs.umich.edu
3249444SAndreas.Sandberg@ARM.com    sticky_opts.files = []
3258314Sgeoffrey.blake@arm.com    default_options_file = os.path.join('build_options', 'default', build_dir)
3263730Sktlim@umich.edu    if os.path.isfile(default_options_file):
3273730Sktlim@umich.edu        sticky_opts.files.append(default_options_file)
3284302Sktlim@umich.edu    current_options_file = os.path.join('build_options', 'current', build_dir)
3294302Sktlim@umich.edu    if os.path.isfile(current_options_file):
3304302Sktlim@umich.edu        sticky_opts.files.append(current_options_file)
3314302Sktlim@umich.edu    else:
3329444SAndreas.Sandberg@ARM.com        # if file doesn't exist, make sure at least the directory is there
3339444SAndreas.Sandberg@ARM.com        # so we can create it later
3349444SAndreas.Sandberg@ARM.com        opt_dir = os.path.dirname(current_options_file)
3354302Sktlim@umich.edu        if not os.path.isdir(opt_dir):
3364329Sktlim@umich.edu            os.mkdir(opt_dir)
3379444SAndreas.Sandberg@ARM.com    if not sticky_opts.files:
3389444SAndreas.Sandberg@ARM.com        print "%s: No options file found in build_options, using defaults." \
3394329Sktlim@umich.edu              % build_dir
3409444SAndreas.Sandberg@ARM.com
3419444SAndreas.Sandberg@ARM.com    # Apply current option settings to env
3429444SAndreas.Sandberg@ARM.com    sticky_opts.Update(env)
3439444SAndreas.Sandberg@ARM.com    nonsticky_opts.Update(env)
3449444SAndreas.Sandberg@ARM.com
3459444SAndreas.Sandberg@ARM.com    # Process option settings.
3464302Sktlim@umich.edu
3474302Sktlim@umich.edu    if not have_fenv and env['USE_FENV']:
3484302Sktlim@umich.edu        print "Warning: <fenv.h> not available; " \
3494302Sktlim@umich.edu              "forcing USE_FENV to False in", build_dir + "."
3504302Sktlim@umich.edu        env['USE_FENV'] = False
3514302Sktlim@umich.edu
3528850Sandreas.hansson@arm.com    if not env['USE_FENV']:
3538707Sandreas.hansson@arm.com        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
3544302Sktlim@umich.edu        print "         FP results may deviate slightly from other platforms."
3558850Sandreas.hansson@arm.com
3564302Sktlim@umich.edu    if env['EFENCE']:
3574302Sktlim@umich.edu        env.Append(LIBS=['efence'])
3584302Sktlim@umich.edu
3594302Sktlim@umich.edu    if env['USE_MYSQL']:
3606221Snate@binkert.org        if not have_mysql:
3613730Sktlim@umich.edu            print "Warning: MySQL not available; " \
3629152Satgutier@umich.edu                  "forcing USE_MYSQL to False in", build_dir + "."
3639152Satgutier@umich.edu            env['USE_MYSQL'] = False
3643730Sktlim@umich.edu        else:
3653730Sktlim@umich.edu            print "Compiling in", build_dir, "with MySQL support."
3663730Sktlim@umich.edu            env.ParseConfig(mysql_config_libs)
3672292SN/A            env.ParseConfig(mysql_config_include)
3682292SN/A
3692292SN/A    # Save sticky option settings back to current options file
3702292SN/A    sticky_opts.Save(current_options_file, env)
3712669Sktlim@umich.edu
3722292SN/A    # Do this after we save setting back, or else we'll tack on an
3736221Snate@binkert.org    # extra 'qdo' every time we run scons.
3742292SN/A    if env['BATCH']:
3757857SMatt.Horsnell@arm.com        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
3769444SAndreas.Sandberg@ARM.com        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
3771060SN/A
3781060SN/A    # The m5/SConscript file sets up the build rules in 'env' according
3791060SN/A    # to the configured options.  It returns a list of environments,
3802669Sktlim@umich.edu    # one for each variant build (debug, opt, etc.)
3819444SAndreas.Sandberg@ARM.com    envList = SConscript('m5/SConscript', build_dir = build_dir,
3822301SN/A                         exports = 'env', duplicate = False)
3832678Sktlim@umich.edu
3842669Sktlim@umich.edu    # Set up the regression tests for each build.
3852292SN/A    for e in envList:
3862301SN/A        SConscript('m5-test/SConscript',
3872292SN/A                   build_dir = os.path.join(build_dir, 'test', e.Label),
3884551Sbinkertn@umich.edu                   exports = { 'env' : e }, duplicate = False)
3892906Sktlim@umich.edu
3902894Srdreslin@umich.edu###################################################
3919444SAndreas.Sandberg@ARM.com#
3929444SAndreas.Sandberg@ARM.com# Let SCons do its thing.  At this point SCons will use the defined
3939444SAndreas.Sandberg@ARM.com# build environments to build the requested targets.
3942292SN/A#
3959444SAndreas.Sandberg@ARM.com###################################################
3969444SAndreas.Sandberg@ARM.com
3972292SN/A