SConstruct revision 1888
1955SN/A# -*- mode:python -*-
2955SN/A
35871Snate@binkert.org# Copyright (c) 2004-2005 The Regents of The University of Michigan
41762SN/A# All rights reserved.
5955SN/A#
6955SN/A# Redistribution and use in source and binary forms, with or without
7955SN/A# modification, are permitted provided that the following conditions are
8955SN/A# met: redistributions of source code must retain the above copyright
9955SN/A# notice, this list of conditions and the following disclaimer;
10955SN/A# redistributions in binary form must reproduce the above copyright
11955SN/A# notice, this list of conditions and the following disclaimer in the
12955SN/A# documentation and/or other materials provided with the distribution;
13955SN/A# neither the name of the copyright holders nor the names of its
14955SN/A# contributors may be used to endorse or promote products derived from
15955SN/A# this software without specific prior written permission.
16955SN/A#
17955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19955SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20955SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21955SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22955SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23955SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24955SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25955SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26955SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27955SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28955SN/A
292665Ssaidi@eecs.umich.edu###################################################
302665Ssaidi@eecs.umich.edu#
315863Snate@binkert.org# SCons top-level build description (SConstruct) file.
32955SN/A#
33955SN/A# To build M5, you need a directory with three things:
34955SN/A# 1. A copy of this file (named SConstruct).
35955SN/A# 2. A link named 'm5' to the top of the M5 simulator source tree.
36955SN/A# 3. A link named 'ext' to the top of the M5 external source tree.
372632Sstever@eecs.umich.edu#
382632Sstever@eecs.umich.edu# Then type 'scons' to build the default configuration (see below), or
392632Sstever@eecs.umich.edu# 'scons <CONFIG>/<binary>' to build some other configuration (e.g.,
402632Sstever@eecs.umich.edu# 'ALPHA_FS/m5.opt' for the optimized full-system version).
41955SN/A#
422632Sstever@eecs.umich.edu###################################################
432632Sstever@eecs.umich.edu
442761Sstever@eecs.umich.edu# Python library imports
452632Sstever@eecs.umich.eduimport sys
462632Sstever@eecs.umich.eduimport os
472632Sstever@eecs.umich.edu
482761Sstever@eecs.umich.edu# Check for recent-enough Python and SCons versions
492761Sstever@eecs.umich.eduEnsurePythonVersion(2,3)
502761Sstever@eecs.umich.eduEnsureSConsVersion(0,96)
512632Sstever@eecs.umich.edu
522632Sstever@eecs.umich.edu# The absolute path to the current directory (where this file lives).
532761Sstever@eecs.umich.eduROOT = Dir('.').abspath
542761Sstever@eecs.umich.edu
552761Sstever@eecs.umich.edu# Paths to the M5 and external source trees (local symlinks).
562761Sstever@eecs.umich.eduSRCDIR = os.path.join(ROOT, 'm5')
572761Sstever@eecs.umich.eduEXT_SRCDIR = os.path.join(ROOT, 'ext')
582632Sstever@eecs.umich.edu
592632Sstever@eecs.umich.edu# Check for 'm5' and 'ext' links, die if they don't exist.
602632Sstever@eecs.umich.eduif not os.path.isdir(SRCDIR):
612632Sstever@eecs.umich.edu    print "Error: '%s' must be a link to the M5 source tree." % SRCDIR
622632Sstever@eecs.umich.edu    Exit(1)
632632Sstever@eecs.umich.edu
642632Sstever@eecs.umich.eduif not os.path.isdir('ext'):
65955SN/A    print "Error: '%s' must be a link to the M5 external source tree." \
66955SN/A          % EXT_SRCDIR
67955SN/A    Exit(1)
685863Snate@binkert.org
695863Snate@binkert.org# tell python where to find m5 python code
705863Snate@binkert.orgsys.path.append(os.path.join(SRCDIR, 'python'))
715863Snate@binkert.org
725863Snate@binkert.org###################################################
735863Snate@binkert.org#
745863Snate@binkert.org# Figure out which configurations to set up.
755863Snate@binkert.org#
765863Snate@binkert.org#
775863Snate@binkert.org# It's prohibitive to do all the combinations of base configurations
785863Snate@binkert.org# and options, so we have to infer which ones the user wants.
795863Snate@binkert.org#
805863Snate@binkert.org# 1. If there are command-line targets, the configuration(s) are inferred
815863Snate@binkert.org#    from the directories of those targets.  If scons was invoked from a
825863Snate@binkert.org#    subdirectory (using 'scons -u'), those targets have to be
835863Snate@binkert.org#    interpreted relative to that subdirectory.
845863Snate@binkert.org#
855863Snate@binkert.org# 2. If there are no command-line targets, and scons was invoked from a
865863Snate@binkert.org#    subdirectory (using 'scons -u'), the configuration is inferred from
875863Snate@binkert.org#    the name of the subdirectory.
885863Snate@binkert.org#
895863Snate@binkert.org# 3. If there are no command-line targets and scons was invoked from
905863Snate@binkert.org#    the root build directory, a default configuration is used.  The
915863Snate@binkert.org#    built-in default is ALPHA_SE, but this can be overridden by setting the
925863Snate@binkert.org#    M5_DEFAULT_CONFIG shell environment veriable.
935863Snate@binkert.org#
945863Snate@binkert.org# In cases 2 & 3, the specific file target defaults to 'm5.debug', but
955863Snate@binkert.org# this can be overridden by setting the M5_DEFAULT_BINARY shell
965863Snate@binkert.org# environment veriable.
975863Snate@binkert.org#
985863Snate@binkert.org###################################################
996654Snate@binkert.org
100955SN/A# Find default configuration & binary.
1015396Ssaidi@eecs.umich.edudefault_config = os.environ.get('M5_DEFAULT_CONFIG', 'ALPHA_SE')
1025863Snate@binkert.orgdefault_binary = os.environ.get('M5_DEFAULT_BINARY', 'm5.debug')
1035863Snate@binkert.org
1044202Sbinkertn@umich.edu# Ask SCons which directory it was invoked from.  If you invoke SCons
1055863Snate@binkert.org# from a subdirectory you must use the '-u' flag.
1065863Snate@binkert.orglaunch_dir = GetLaunchDir()
1075863Snate@binkert.org
1085863Snate@binkert.org# Build a list 'my_targets' of all the targets relative to ROOT.
109955SN/Aif launch_dir == ROOT:
1106654Snate@binkert.org    # invoked from root build dir
1115273Sstever@gmail.com    if len(COMMAND_LINE_TARGETS) != 0:
1125871Snate@binkert.org        # easy: use specified targets as is
1135273Sstever@gmail.com        my_targets = COMMAND_LINE_TARGETS
1146655Snate@binkert.org    else:
1156655Snate@binkert.org        # default target (ALPHA_SE/m5.debug, unless overridden)
1166655Snate@binkert.org        target = os.path.join(default_config, default_binary)
1176655Snate@binkert.org        my_targets = [target]
1186655Snate@binkert.org        Default(target)
1196655Snate@binkert.orgelse:
1205871Snate@binkert.org    # invoked from subdirectory
1216654Snate@binkert.org    if not launch_dir.startswith(ROOT):
1225396Ssaidi@eecs.umich.edu        print "Error: launch dir (%s) not a subdirectory of ROOT (%s)!" \
1235871Snate@binkert.org              (launch_dir, ROOT)
1245871Snate@binkert.org        Exit(1)
1256121Snate@binkert.org    # make launch_dir relative to ROOT (strip ROOT plus slash off front)
1265871Snate@binkert.org    launch_dir = launch_dir[len(ROOT)+1:]
1275871Snate@binkert.org    if len(COMMAND_LINE_TARGETS) != 0:
1286003Snate@binkert.org        # make specified targets relative to ROOT
1296655Snate@binkert.org        my_targets = map(lambda x: os.path.join(launch_dir, x),
130955SN/A                         COMMAND_LINE_TARGETS)
1315871Snate@binkert.org    else:
1325871Snate@binkert.org        # build default binary (m5.debug, unless overridden) using the
1335871Snate@binkert.org        # config inferred by the invocation directory (the first
1345871Snate@binkert.org        # subdirectory after ROOT)
135955SN/A        target = os.path.join(launch_dir.split('/')[0], default_binary)
1366121Snate@binkert.org        my_targets = [target]
1376121Snate@binkert.org        Default(target)
1386121Snate@binkert.org
1391533SN/A# Normalize target paths (gets rid of '..' in the middle, etc.)
1406655Snate@binkert.orgmy_targets = map(os.path.normpath, my_targets)
1416655Snate@binkert.org
1426655Snate@binkert.org# Generate a list of the unique configs that the collected targets reference.
1436655Snate@binkert.orgbuild_dirs = []
1445871Snate@binkert.orgfor t in my_targets:
1455871Snate@binkert.org    dir = t.split('/')[0]
1465863Snate@binkert.org    if dir not in build_dirs:
1475871Snate@binkert.org        build_dirs.append(dir)
1485871Snate@binkert.org
1495871Snate@binkert.org###################################################
1505871Snate@binkert.org#
1515871Snate@binkert.org# Set up the default build environment.  This environment is copied
1525863Snate@binkert.org# and modified according to each selected configuration.
1536121Snate@binkert.org#
1545863Snate@binkert.org###################################################
1555871Snate@binkert.org
1564678Snate@binkert.orgenv = Environment(ENV = os.environ,  # inherit user's environment vars
1574678Snate@binkert.org                  ROOT = ROOT,
1584678Snate@binkert.org                  SRCDIR = SRCDIR,
1594678Snate@binkert.org                  EXT_SRCDIR = EXT_SRCDIR)
1604678Snate@binkert.org
1614678Snate@binkert.orgenv.SConsignFile("sconsign")
1624678Snate@binkert.org
1634678Snate@binkert.org# I waffle on this setting... it does avoid a few painful but
1644678Snate@binkert.org# unnecessary builds, but it also seems to make trivial builds take
1654678Snate@binkert.org# noticeably longer.
1664678Snate@binkert.orgif False:
1674678Snate@binkert.org    env.TargetSignatures('content')
1686121Snate@binkert.org
1694678Snate@binkert.org# M5_EXT is used by isa_parser.py to find the PLY package.
1705871Snate@binkert.orgenv.Append(ENV = { 'M5_EXT' : EXT_SRCDIR })
1715871Snate@binkert.org
1725871Snate@binkert.org# Set up default C++ compiler flags
1735871Snate@binkert.orgenv.Append(CCFLAGS='-pipe')
1745871Snate@binkert.orgenv.Append(CCFLAGS='-fno-strict-aliasing')
1755871Snate@binkert.orgenv.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
1765871Snate@binkert.orgif sys.platform == 'cygwin':
1775871Snate@binkert.org    # cygwin has some header file issues...
1785871Snate@binkert.org    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
1795871Snate@binkert.orgenv.Append(CPPPATH=[os.path.join(EXT_SRCDIR + '/dnet')])
1805871Snate@binkert.org
1815871Snate@binkert.org# Default libraries
1825871Snate@binkert.orgenv.Append(LIBS=['z'])
1835990Ssaidi@eecs.umich.edu
1845871Snate@binkert.org# Platform-specific configuration
1855871Snate@binkert.orgconf = Configure(env)
1865871Snate@binkert.org
1874678Snate@binkert.org# Check for <fenv.h> (C99 FP environment control)
1886654Snate@binkert.orghave_fenv = conf.CheckHeader('fenv.h', '<>')
1895871Snate@binkert.orgif not have_fenv:
1905871Snate@binkert.org    print "Warning: Header file <fenv.h> not found."
1915871Snate@binkert.org    print "         This host has no IEEE FP rounding mode control."
1925871Snate@binkert.org
1935871Snate@binkert.org# Check for mysql.
1945871Snate@binkert.orgmysql_config = WhereIs('mysql_config')
1955871Snate@binkert.orghave_mysql = mysql_config != None
1965871Snate@binkert.org
1975871Snate@binkert.org# Check MySQL version.
1984678Snate@binkert.orgif have_mysql:
1995871Snate@binkert.org    mysql_version = os.popen(mysql_config + ' --version').read()
2004678Snate@binkert.org    mysql_version = mysql_version.split('.')
2015871Snate@binkert.org    mysql_major = int(mysql_version[0])
2025871Snate@binkert.org    mysql_minor = int(mysql_version[1])
2035871Snate@binkert.org    # This version check is probably overly conservative, but it deals
2045871Snate@binkert.org    # with the versions we have installed.
2055871Snate@binkert.org    if mysql_major < 3 or \
2065871Snate@binkert.org           mysql_major == 3 and mysql_minor < 23 or \
2075871Snate@binkert.org           mysql_major == 4 and mysql_minor < 1:
2085871Snate@binkert.org        print "Warning: MySQL v3.23 or v4.1 or newer required."
2095871Snate@binkert.org        have_mysql = False
2106121Snate@binkert.org
2116121Snate@binkert.org# Set up mysql_config commands.
2125863Snate@binkert.orgif have_mysql:
213955SN/A    mysql_config_include = mysql_config + ' --include'
214955SN/A    if os.system(mysql_config_include + ' > /dev/null') != 0:
2152632Sstever@eecs.umich.edu        # older mysql_config versions don't support --include, use
2162632Sstever@eecs.umich.edu        # --cflags instead
217955SN/A        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
218955SN/A    # This seems to work in all versions
219955SN/A    mysql_config_libs = mysql_config + ' --libs'
220955SN/A
2215863Snate@binkert.orgenv = conf.Finish()
222955SN/A
2232632Sstever@eecs.umich.edu# Sticky options get saved in the options file so they persist from
2242632Sstever@eecs.umich.edu# one invocation to the next (unless overridden, in which case the new
2252632Sstever@eecs.umich.edu# value becomes sticky).
2262632Sstever@eecs.umich.edusticky_opts = Options(args=ARGUMENTS)
2272632Sstever@eecs.umich.edusticky_opts.AddOptions(
2282632Sstever@eecs.umich.edu    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', ('alpha')),
2292632Sstever@eecs.umich.edu    BoolOption('FULL_SYSTEM', 'Full-system support', False),
2302632Sstever@eecs.umich.edu    BoolOption('ALPHA_TLASER',
2312632Sstever@eecs.umich.edu               'Model Alpha TurboLaser platform (vs. Tsunami)', False),
2322632Sstever@eecs.umich.edu    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
2332632Sstever@eecs.umich.edu    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
2342632Sstever@eecs.umich.edu               False),
2352632Sstever@eecs.umich.edu    BoolOption('SS_COMPATIBLE_FP',
2363718Sstever@eecs.umich.edu               'Make floating-point results compatible with SimpleScalar',
2373718Sstever@eecs.umich.edu               False),
2383718Sstever@eecs.umich.edu    BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql),
2393718Sstever@eecs.umich.edu    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
2403718Sstever@eecs.umich.edu    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
2415863Snate@binkert.org    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
2425863Snate@binkert.org    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
2433718Sstever@eecs.umich.edu    BoolOption('BATCH', 'Use batch pool for build and tests', False),
2443718Sstever@eecs.umich.edu    ('BATCH_CMD', 'Batch pool submission command name', 'qdo')
2456121Snate@binkert.org    )
2465863Snate@binkert.org
2473718Sstever@eecs.umich.edu# Non-sticky options only apply to the current build.
2483718Sstever@eecs.umich.edunonsticky_opts = Options(args=ARGUMENTS)
2492634Sstever@eecs.umich.edunonsticky_opts.AddOptions(
2502634Sstever@eecs.umich.edu    BoolOption('update_ref', 'Update test reference outputs', False)
2515863Snate@binkert.org    )
2522638Sstever@eecs.umich.edu
2532632Sstever@eecs.umich.edu# These options get exported to #defines in config/*.hh (see m5/SConscript).
2542632Sstever@eecs.umich.eduenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
2552632Sstever@eecs.umich.edu                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
2562632Sstever@eecs.umich.edu                     'STATS_BINNING']
2572632Sstever@eecs.umich.edu
2582632Sstever@eecs.umich.edu# Define a handy 'no-op' action
2591858SN/Adef no_action(target, source, env):
2603716Sstever@eecs.umich.edu    return 0
2612638Sstever@eecs.umich.edu
2622638Sstever@eecs.umich.eduenv.NoAction = Action(no_action, None)
2632638Sstever@eecs.umich.edu
2642638Sstever@eecs.umich.edu# libelf build is described in its own SConscript file.
2652638Sstever@eecs.umich.edu# SConscript-global is the build in build/libelf shared among all
2662638Sstever@eecs.umich.edu# configs.
2672638Sstever@eecs.umich.eduenv.SConscript('m5/libelf/SConscript-global', exports = 'env')
2685863Snate@binkert.org
2695863Snate@binkert.org###################################################
2705863Snate@binkert.org#
271955SN/A# Define a SCons builder for configuration flag headers.
2725341Sstever@gmail.com#
2735341Sstever@gmail.com###################################################
2745863Snate@binkert.org
2755341Sstever@gmail.com# This function generates a config header file that #defines the
2766121Snate@binkert.org# option symbol to the current option setting (0 or 1).  The source
2774494Ssaidi@eecs.umich.edu# operands are the name of the option and a Value node containing the
2786121Snate@binkert.org# value of the option.
2791105SN/Adef build_config_file(target, source, env):
2802667Sstever@eecs.umich.edu    (option, value) = [s.get_contents() for s in source]
2812667Sstever@eecs.umich.edu    f = file(str(target[0]), 'w')
2822667Sstever@eecs.umich.edu    print >> f, '#define', option, value
2832667Sstever@eecs.umich.edu    f.close()
2846121Snate@binkert.org    return None
2852667Sstever@eecs.umich.edu
2865341Sstever@gmail.com# Generate the message to be printed when building the config file.
2875863Snate@binkert.orgdef build_config_file_string(target, source, env):
2885341Sstever@gmail.com    (option, value) = [s.get_contents() for s in source]
2895341Sstever@gmail.com    return "Defining %s as %s in %s." % (option, value, target[0])
2905341Sstever@gmail.com
2915863Snate@binkert.org# Combine the two functions into a scons Action object.
2925341Sstever@gmail.comconfig_action = Action(build_config_file, build_config_file_string)
2935341Sstever@gmail.com
2945341Sstever@gmail.com# The emitter munges the source & target node lists to reflect what
2955863Snate@binkert.org# we're really doing.
2965341Sstever@gmail.comdef config_emitter(target, source, env):
2975341Sstever@gmail.com    # extract option name from Builder arg
2985341Sstever@gmail.com    option = str(target[0])
2995341Sstever@gmail.com    # True target is config header file
3005341Sstever@gmail.com    target = os.path.join('config', option.lower() + '.hh')
3015341Sstever@gmail.com    # Force value to 0/1 even if it's a Python bool
3025341Sstever@gmail.com    val = int(eval(str(env[option])))
3035341Sstever@gmail.com    # Sources are option name & value (packaged in SCons Value nodes)
3045341Sstever@gmail.com    return ([target], [Value(option), Value(val)])
3055341Sstever@gmail.com
3065863Snate@binkert.orgconfig_builder = Builder(emitter = config_emitter, action = config_action)
3075341Sstever@gmail.com
3085863Snate@binkert.orgenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
3095341Sstever@gmail.com
3105863Snate@binkert.org###################################################
3116121Snate@binkert.org#
3126121Snate@binkert.org# Define build environments for selected configurations.
3135397Ssaidi@eecs.umich.edu#
3145397Ssaidi@eecs.umich.edu###################################################
3157727SAli.Saidi@ARM.com
3165341Sstever@gmail.com# rename base env
3176168Snate@binkert.orgbase_env = env
3186168Snate@binkert.org
3195341Sstever@gmail.comfor build_dir in build_dirs:
3205341Sstever@gmail.com    # Make a copy of the default environment to use for this config.
3215341Sstever@gmail.com    env = base_env.Copy()
3225341Sstever@gmail.com    # Set env according to the build directory config.
3235341Sstever@gmail.com
3245863Snate@binkert.org    sticky_opts.files = []
3255341Sstever@gmail.com    default_options_file = os.path.join('build_options', 'default', build_dir)
3265341Sstever@gmail.com    if os.path.isfile(default_options_file):
3276121Snate@binkert.org        sticky_opts.files.append(default_options_file)
3286121Snate@binkert.org    current_options_file = os.path.join('build_options', 'current', build_dir)
3295341Sstever@gmail.com    if os.path.isfile(current_options_file):
3306814Sgblack@eecs.umich.edu        sticky_opts.files.append(current_options_file)
3316814Sgblack@eecs.umich.edu    if not sticky_opts.files:
3325863Snate@binkert.org        print "%s: No options file found in build_options, using defaults." \
3336121Snate@binkert.org              % build_dir
3345341Sstever@gmail.com
3355863Snate@binkert.org    # Apply current option settings to env
3365341Sstever@gmail.com    sticky_opts.Update(env)
3376121Snate@binkert.org    nonsticky_opts.Update(env)
3386121Snate@binkert.org
3396121Snate@binkert.org    # Process option settings.
3405742Snate@binkert.org
3415742Snate@binkert.org    if not have_fenv and env['USE_FENV']:
3425341Sstever@gmail.com        print "Warning: <fenv.h> not available; " \
3435742Snate@binkert.org              "forcing USE_FENV to False in", build_dir + "."
3445742Snate@binkert.org        env['USE_FENV'] = False
3455341Sstever@gmail.com
3466017Snate@binkert.org    if not env['USE_FENV']:
3476121Snate@binkert.org        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
3486017Snate@binkert.org        print "         FP results may deviate slightly from other platforms."
3496654Snate@binkert.org
3506654Snate@binkert.org    if env['EFENCE']:
3515871Snate@binkert.org        env.Append(LIBS=['efence'])
3526121Snate@binkert.org
3536121Snate@binkert.org    if env['USE_MYSQL']:
3546121Snate@binkert.org        if not have_mysql:
3556121Snate@binkert.org            print "Warning: MySQL not available; " \
3563940Ssaidi@eecs.umich.edu                  "forcing USE_MYSQL to False in", build_dir + "."
3573918Ssaidi@eecs.umich.edu            env['USE_MYSQL'] = False
3583918Ssaidi@eecs.umich.edu        else:
3591858SN/A            print "Compiling in", build_dir, "with MySQL support."
3606121Snate@binkert.org            env.ParseConfig(mysql_config_libs)
3616121Snate@binkert.org            env.ParseConfig(mysql_config_include)
3626121Snate@binkert.org
3636143Snate@binkert.org    # Save sticky option settings back to current options file
3646121Snate@binkert.org    sticky_opts.Save(current_options_file, env)
3657618SAli.Saidi@arm.com
3667618SAli.Saidi@arm.com    # Do this after we save setting back, or else we'll tack on an
3677618SAli.Saidi@arm.com    # extra 'qdo' every time we run scons.
3687618SAli.Saidi@arm.com    if env['BATCH']:
3697618SAli.Saidi@arm.com        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
3707618SAli.Saidi@arm.com        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
3717618SAli.Saidi@arm.com
3727618SAli.Saidi@arm.com    # The m5/SConscript file sets up the build rules in 'env' according
3736121Snate@binkert.org    # to the configured options.  It returns a list of environments,
3743940Ssaidi@eecs.umich.edu    # one for each variant build (debug, opt, etc.)
3756121Snate@binkert.org    envList = SConscript('m5/SConscript', build_dir = build_dir,
3766121Snate@binkert.org                         exports = 'env', duplicate = False)
3776121Snate@binkert.org
3786121Snate@binkert.org    # Set up the regression tests for each build.
3796121Snate@binkert.org    for e in envList:
3806121Snate@binkert.org        SConscript('m5-test/SConscript',
3816121Snate@binkert.org                   build_dir = os.path.join(build_dir, 'test', e.Label),
3823918Ssaidi@eecs.umich.edu                   exports = { 'env' : e }, duplicate = False)
3833918Ssaidi@eecs.umich.edu
3843940Ssaidi@eecs.umich.edu###################################################
3853918Ssaidi@eecs.umich.edu#
3863918Ssaidi@eecs.umich.edu# Let SCons do its thing.  At this point SCons will use the defined
3876157Snate@binkert.org# build environments to build the requested targets.
3886157Snate@binkert.org#
3896157Snate@binkert.org###################################################
3906157Snate@binkert.org
3915397Ssaidi@eecs.umich.edu