SConstruct revision 1871
1955SN/A# -*- mode:python -*-
2955SN/A
39812Sandreas.hansson@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###################################################
30955SN/A#
31955SN/A# 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.
37955SN/A#
38955SN/A# Then type 'scons' to build the default configuration (see below), or
39955SN/A# 'scons <CONFIG>/<binary>' to build some other configuration (e.g.,
40955SN/A# 'ALPHA_FS/m5.opt' for the optimized full-system version).
41955SN/A#
422665Ssaidi@eecs.umich.edu###################################################
432665Ssaidi@eecs.umich.edu
445863Snate@binkert.org# Python library imports
45955SN/Aimport sys
46955SN/Aimport os
47955SN/A
48955SN/A# Check for recent-enough Python and SCons versions
49955SN/AEnsurePythonVersion(2,3)
508878Ssteve.reinhardt@amd.comEnsureSConsVersion(0,96)
512632Sstever@eecs.umich.edu
528878Ssteve.reinhardt@amd.com# The absolute path to the current directory (where this file lives).
532632Sstever@eecs.umich.eduROOT = Dir('.').abspath
54955SN/A
558878Ssteve.reinhardt@amd.com# Paths to the M5 and external source trees (local symlinks).
562632Sstever@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):
612761Sstever@eecs.umich.edu    print "Error: '%s' must be a link to the M5 source tree." % SRCDIR
622761Sstever@eecs.umich.edu    Exit(1)
632761Sstever@eecs.umich.edu
648878Ssteve.reinhardt@amd.comif not os.path.isdir('ext'):
658878Ssteve.reinhardt@amd.com    print "Error: '%s' must be a link to the M5 external source tree." \
662761Sstever@eecs.umich.edu          % EXT_SRCDIR
672761Sstever@eecs.umich.edu    Exit(1)
682761Sstever@eecs.umich.edu
692761Sstever@eecs.umich.edu# tell python where to find m5 python code
702761Sstever@eecs.umich.edusys.path.append(os.path.join(SRCDIR, 'python'))
718878Ssteve.reinhardt@amd.com
728878Ssteve.reinhardt@amd.com###################################################
732632Sstever@eecs.umich.edu#
742632Sstever@eecs.umich.edu# Figure out which configurations to set up.
758878Ssteve.reinhardt@amd.com#
768878Ssteve.reinhardt@amd.com#
772632Sstever@eecs.umich.edu# It's prohibitive to do all the combinations of base configurations
78955SN/A# and options, so we have to infer which ones the user wants.
79955SN/A#
80955SN/A# 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
928878Ssteve.reinhardt@amd.com#    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
969812Sandreas.hansson@arm.com# environment veriable.
979812Sandreas.hansson@arm.com#
985863Snate@binkert.org###################################################
999812Sandreas.hansson@arm.com
1005863Snate@binkert.org# Find default configuration & binary.
1015863Snate@binkert.orgdefault_config = os.environ.get('M5_DEFAULT_CONFIG', 'ALPHA_SE')
1025863Snate@binkert.orgdefault_binary = os.environ.get('M5_DEFAULT_BINARY', 'm5.debug')
1039812Sandreas.hansson@arm.com
1049812Sandreas.hansson@arm.com# 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()
1078878Ssteve.reinhardt@amd.com
1085863Snate@binkert.org# Build a list 'my_targets' of all the targets relative to ROOT.
1095863Snate@binkert.orgif launch_dir == ROOT:
1105863Snate@binkert.org    # invoked from root build dir
1116654Snate@binkert.org    if len(COMMAND_LINE_TARGETS) != 0:
11210196SCurtis.Dunham@arm.com        # easy: use specified targets as is
113955SN/A        my_targets = COMMAND_LINE_TARGETS
1145396Ssaidi@eecs.umich.edu    else:
1155863Snate@binkert.org        # default target (ALPHA_SE/m5.debug, unless overridden)
1165863Snate@binkert.org        target = os.path.join(default_config, default_binary)
1174202Sbinkertn@umich.edu        my_targets = [target]
1185863Snate@binkert.org        Default(target)
1195863Snate@binkert.orgelse:
1205863Snate@binkert.org    # invoked from subdirectory
1215863Snate@binkert.org    if not launch_dir.startswith(ROOT):
122955SN/A        print "Error: launch dir (%s) not a subdirectory of ROOT (%s)!" \
1236654Snate@binkert.org              (launch_dir, ROOT)
1245273Sstever@gmail.com        Exit(1)
1255871Snate@binkert.org    # make launch_dir relative to ROOT (strip ROOT plus slash off front)
1265273Sstever@gmail.com    launch_dir = launch_dir[len(ROOT)+1:]
1276655Snate@binkert.org    if len(COMMAND_LINE_TARGETS) != 0:
1288878Ssteve.reinhardt@amd.com        # make specified targets relative to ROOT
1296655Snate@binkert.org        my_targets = map(lambda x: os.path.join(launch_dir, x),
1306655Snate@binkert.org                         COMMAND_LINE_TARGETS)
1319219Spower.jg@gmail.com    else:
1326655Snate@binkert.org        # build default binary (m5.debug, unless overridden) using the
1335871Snate@binkert.org        # config inferred by the invocation directory (the first
1346654Snate@binkert.org        # subdirectory after ROOT)
1358947Sandreas.hansson@arm.com        target = os.path.join(launch_dir.split('/')[0], default_binary)
1365396Ssaidi@eecs.umich.edu        my_targets = [target]
1378120Sgblack@eecs.umich.edu        Default(target)
1388120Sgblack@eecs.umich.edu
1398120Sgblack@eecs.umich.edu# Normalize target paths (gets rid of '..' in the middle, etc.)
1408120Sgblack@eecs.umich.edumy_targets = map(os.path.normpath, my_targets)
1418120Sgblack@eecs.umich.edu
1428120Sgblack@eecs.umich.edu# Generate a list of the unique configs that the collected targets reference.
1438120Sgblack@eecs.umich.edubuild_dirs = []
1448120Sgblack@eecs.umich.edufor t in my_targets:
1458879Ssteve.reinhardt@amd.com    dir = t.split('/')[0]
1468879Ssteve.reinhardt@amd.com    if dir not in build_dirs:
1478879Ssteve.reinhardt@amd.com        build_dirs.append(dir)
1488879Ssteve.reinhardt@amd.com
1498879Ssteve.reinhardt@amd.com###################################################
1508879Ssteve.reinhardt@amd.com#
1518879Ssteve.reinhardt@amd.com# Set up the default build environment.  This environment is copied
1528879Ssteve.reinhardt@amd.com# and modified according to each selected configuration.
1538879Ssteve.reinhardt@amd.com#
1548879Ssteve.reinhardt@amd.com###################################################
1558879Ssteve.reinhardt@amd.com
1568879Ssteve.reinhardt@amd.comenv = Environment(ENV = os.environ,  # inherit user's environment vars
1578879Ssteve.reinhardt@amd.com                  ROOT = ROOT,
1588120Sgblack@eecs.umich.edu                  SRCDIR = SRCDIR,
1598120Sgblack@eecs.umich.edu                  EXT_SRCDIR = EXT_SRCDIR)
1608120Sgblack@eecs.umich.edu
1618120Sgblack@eecs.umich.eduenv.SConsignFile("sconsign")
1628120Sgblack@eecs.umich.edu
1638120Sgblack@eecs.umich.edu# I waffle on this setting... it does avoid a few painful but
1648120Sgblack@eecs.umich.edu# unnecessary builds, but it also seems to make trivial builds take
1658120Sgblack@eecs.umich.edu# noticeably longer.
1668120Sgblack@eecs.umich.eduif False:
1678120Sgblack@eecs.umich.edu    env.TargetSignatures('content')
1688120Sgblack@eecs.umich.edu
1698120Sgblack@eecs.umich.edu# M5_EXT is used by isa_parser.py to find the PLY package.
1708120Sgblack@eecs.umich.eduenv.Append(ENV = { 'M5_EXT' : EXT_SRCDIR })
1718120Sgblack@eecs.umich.edu
1728879Ssteve.reinhardt@amd.com# Set up default C++ compiler flags
1738879Ssteve.reinhardt@amd.comenv.Append(CCFLAGS='-pipe')
1748879Ssteve.reinhardt@amd.comenv.Append(CCFLAGS='-fno-strict-aliasing')
1758879Ssteve.reinhardt@amd.comenv.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
1768879Ssteve.reinhardt@amd.comif sys.platform == 'cygwin':
1778879Ssteve.reinhardt@amd.com    # cygwin has some header file issues...
1788879Ssteve.reinhardt@amd.com    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
1798879Ssteve.reinhardt@amd.comenv.Append(CPPPATH=[os.path.join(EXT_SRCDIR + '/dnet')])
1809227Sandreas.hansson@arm.com
1819227Sandreas.hansson@arm.com# Default libraries
1828879Ssteve.reinhardt@amd.comenv.Append(LIBS=['z'])
1838879Ssteve.reinhardt@amd.com
1848879Ssteve.reinhardt@amd.com# Platform-specific configuration
1858879Ssteve.reinhardt@amd.comconf = Configure(env)
1868120Sgblack@eecs.umich.edu
1878947Sandreas.hansson@arm.com# Check for <fenv.h> (C99 FP environment control)
1887816Ssteve.reinhardt@amd.comhave_fenv = conf.CheckHeader('fenv.h', '<>')
1895871Snate@binkert.orgif not have_fenv:
1905871Snate@binkert.org    print "Warning: Header file <fenv.h> not found."
1916121Snate@binkert.org    print "         This host has no IEEE FP rounding mode control."
1925871Snate@binkert.org
1935871Snate@binkert.org# Check for mysql.
1949926Sstan.czerniawski@arm.commysql_config = WhereIs('mysql_config')
1959926Sstan.czerniawski@arm.comhave_mysql = mysql_config != None
1969119Sandreas.hansson@arm.com
19710068Sandreas.hansson@arm.com# Check MySQL version.
19810068Sandreas.hansson@arm.comif have_mysql:
199955SN/A    mysql_version = os.popen(mysql_config + ' --version').read()
2009416SAndreas.Sandberg@ARM.com    mysql_version = mysql_version.split('.')
2019416SAndreas.Sandberg@ARM.com    mysql_major = int(mysql_version[0])
2029416SAndreas.Sandberg@ARM.com    mysql_minor = int(mysql_version[1])
2039416SAndreas.Sandberg@ARM.com    # This version check is probably overly conservative, but it deals
2049416SAndreas.Sandberg@ARM.com    # with the versions we have installed.
2059416SAndreas.Sandberg@ARM.com    if mysql_major < 3 or \
2069416SAndreas.Sandberg@ARM.com           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."
2099416SAndreas.Sandberg@ARM.com        have_mysql = False
2109416SAndreas.Sandberg@ARM.com
2115871Snate@binkert.org# Set up mysql_config commands.
212955SN/Aif have_mysql:
2136121Snate@binkert.org    mysql_config_include = mysql_config + ' --include'
2148881Smarc.orr@gmail.com    if os.system(mysql_config_include + ' > /dev/null') != 0:
2156121Snate@binkert.org        # older mysql_config versions don't support --include, use
2166121Snate@binkert.org        # --cflags instead
2171533SN/A        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
2189239Sandreas.hansson@arm.com    # This seems to work in all versions
2199239Sandreas.hansson@arm.com    mysql_config_libs = mysql_config + ' --libs'
2209239Sandreas.hansson@arm.com
2219239Sandreas.hansson@arm.comenv = conf.Finish()
2229239Sandreas.hansson@arm.com
2239239Sandreas.hansson@arm.com# Sticky options get saved in the options file so they persist from
2249239Sandreas.hansson@arm.com# one invocation to the next (unless overridden, in which case the new
2259239Sandreas.hansson@arm.com# value becomes sticky).
2269239Sandreas.hansson@arm.comsticky_opts = Options(args=ARGUMENTS)
2279239Sandreas.hansson@arm.comsticky_opts.AddOptions(
2289239Sandreas.hansson@arm.com    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', ('alpha')),
2299239Sandreas.hansson@arm.com    BoolOption('FULL_SYSTEM', 'Full-system support', False),
2306655Snate@binkert.org    BoolOption('ALPHA_TLASER',
2316655Snate@binkert.org               'Model Alpha TurboLaser platform (vs. Tsunami)', False),
2326655Snate@binkert.org    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
2336655Snate@binkert.org    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
2345871Snate@binkert.org               False),
2355871Snate@binkert.org    BoolOption('SS_COMPATIBLE_FP',
2365863Snate@binkert.org               'Make floating-point results compatible with SimpleScalar',
2375871Snate@binkert.org               False),
2388878Ssteve.reinhardt@amd.com    BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql),
2395871Snate@binkert.org    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
2405871Snate@binkert.org    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
2415871Snate@binkert.org    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
2425863Snate@binkert.org    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX']))
2436121Snate@binkert.org    )
2445863Snate@binkert.org
2455871Snate@binkert.org# Non-sticky options only apply to the current build.
2468336Ssteve.reinhardt@amd.comnonsticky_opts = Options(args=ARGUMENTS)
2478336Ssteve.reinhardt@amd.comnonsticky_opts.AddOptions(
2488336Ssteve.reinhardt@amd.com    BoolOption('update_ref', 'Update test reference outputs', False)
2498336Ssteve.reinhardt@amd.com    )
2504678Snate@binkert.org
2518336Ssteve.reinhardt@amd.com# These options get exported to #defines in config/*.hh (see m5/SConscript).
2528336Ssteve.reinhardt@amd.comenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
2538336Ssteve.reinhardt@amd.com                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
2544678Snate@binkert.org                     'STATS_BINNING']
2554678Snate@binkert.org
2564678Snate@binkert.org# Define a handy 'no-op' action
2574678Snate@binkert.orgdef no_action(target, source, env):
2587827Snate@binkert.org    return 0
2597827Snate@binkert.org
2608336Ssteve.reinhardt@amd.comenv.NoAction = Action(no_action, None)
2614678Snate@binkert.org
2628336Ssteve.reinhardt@amd.com# libelf build is described in its own SConscript file.
2638336Ssteve.reinhardt@amd.com# SConscript-global is the build in build/libelf shared among all
2648336Ssteve.reinhardt@amd.com# configs.
2658336Ssteve.reinhardt@amd.comenv.SConscript('m5/libelf/SConscript-global', exports = 'env')
2668336Ssteve.reinhardt@amd.com
2678336Ssteve.reinhardt@amd.com###################################################
2685871Snate@binkert.org#
2695871Snate@binkert.org# Define a SCons builder for configuration flag headers.
2708336Ssteve.reinhardt@amd.com#
2718336Ssteve.reinhardt@amd.com###################################################
2728336Ssteve.reinhardt@amd.com
2738336Ssteve.reinhardt@amd.com# This function generates a config header file that #defines the
2748336Ssteve.reinhardt@amd.com# option symbol to the current option setting (0 or 1).  The source
2755871Snate@binkert.org# operands are the name of the option and a Value node containing the
2768336Ssteve.reinhardt@amd.com# value of the option.
2778336Ssteve.reinhardt@amd.comdef build_config_file(target, source, env):
2788336Ssteve.reinhardt@amd.com    (option, value) = [s.get_contents() for s in source]
2798336Ssteve.reinhardt@amd.com    f = file(str(target[0]), 'w')
2808336Ssteve.reinhardt@amd.com    print >> f, '#define', option, value
2814678Snate@binkert.org    f.close()
2825871Snate@binkert.org    return None
2834678Snate@binkert.org
2848336Ssteve.reinhardt@amd.com# Generate the message to be printed when building the config file.
2858336Ssteve.reinhardt@amd.comdef build_config_file_string(target, source, env):
2868336Ssteve.reinhardt@amd.com    (option, value) = [s.get_contents() for s in source]
2878336Ssteve.reinhardt@amd.com    return "Defining %s as %s in %s." % (option, value, target[0])
2888336Ssteve.reinhardt@amd.com
2898336Ssteve.reinhardt@amd.com# Combine the two functions into a scons Action object.
2908336Ssteve.reinhardt@amd.comconfig_action = Action(build_config_file, build_config_file_string)
2918336Ssteve.reinhardt@amd.com
2928336Ssteve.reinhardt@amd.com# The emitter munges the source & target node lists to reflect what
2938336Ssteve.reinhardt@amd.com# we're really doing.
2948336Ssteve.reinhardt@amd.comdef config_emitter(target, source, env):
2958336Ssteve.reinhardt@amd.com    # extract option name from Builder arg
2968336Ssteve.reinhardt@amd.com    option = str(target[0])
2978336Ssteve.reinhardt@amd.com    # True target is config header file
2988336Ssteve.reinhardt@amd.com    target = os.path.join('config', option.lower() + '.hh')
2998336Ssteve.reinhardt@amd.com    # Force value to 0/1 even if it's a Python bool
3008336Ssteve.reinhardt@amd.com    val = int(eval(str(env[option])))
3015871Snate@binkert.org    # Sources are option name & value (packaged in SCons Value nodes)
3026121Snate@binkert.org    return ([target], [Value(option), Value(val)])
303955SN/A
304955SN/Aconfig_builder = Builder(emitter = config_emitter, action = config_action)
3052632Sstever@eecs.umich.edu
3062632Sstever@eecs.umich.eduenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
307955SN/A
308955SN/A###################################################
309955SN/A#
310955SN/A# Define build environments for selected configurations.
3118878Ssteve.reinhardt@amd.com#
312955SN/A###################################################
3132632Sstever@eecs.umich.edu
3142632Sstever@eecs.umich.edu# rename base env
3152632Sstever@eecs.umich.edubase_env = env
3162632Sstever@eecs.umich.edu
3172632Sstever@eecs.umich.edufor build_dir in build_dirs:
3182632Sstever@eecs.umich.edu    # Make a copy of the default environment to use for this config.
3192632Sstever@eecs.umich.edu    env = base_env.Copy()
3208268Ssteve.reinhardt@amd.com    # Set env according to the build directory config.
3218268Ssteve.reinhardt@amd.com    options_file = os.path.join('build_options', build_dir)
3228268Ssteve.reinhardt@amd.com    if os.path.isfile(options_file):
3238268Ssteve.reinhardt@amd.com        sticky_opts.files = [options_file]
3248268Ssteve.reinhardt@amd.com    else:
3258268Ssteve.reinhardt@amd.com        print "Options file %s not found, using defaults." % options_file
3268268Ssteve.reinhardt@amd.com
3272632Sstever@eecs.umich.edu    sticky_opts.Update(env)
3282632Sstever@eecs.umich.edu    nonsticky_opts.Update(env)
3292632Sstever@eecs.umich.edu
3302632Sstever@eecs.umich.edu    # Process option settings.
3318268Ssteve.reinhardt@amd.com
3322632Sstever@eecs.umich.edu    if not have_fenv and env['USE_FENV']:
3338268Ssteve.reinhardt@amd.com        print "Warning: <fenv.h> not available; " \
3348268Ssteve.reinhardt@amd.com              "forcing USE_FENV to False in", build_dir + "."
3358268Ssteve.reinhardt@amd.com        env['USE_FENV'] = False
3368268Ssteve.reinhardt@amd.com
3373718Sstever@eecs.umich.edu    if not env['USE_FENV']:
3382634Sstever@eecs.umich.edu        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
3392634Sstever@eecs.umich.edu        print "         FP results may deviate slightly from other platforms."
3405863Snate@binkert.org
3412638Sstever@eecs.umich.edu    if env['EFENCE']:
3428268Ssteve.reinhardt@amd.com        env.Append(LIBS=['efence'])
3432632Sstever@eecs.umich.edu
3442632Sstever@eecs.umich.edu    if env['USE_MYSQL']:
3452632Sstever@eecs.umich.edu        if not have_mysql:
3462632Sstever@eecs.umich.edu            print "Warning: MySQL not available; " \
3472632Sstever@eecs.umich.edu                  "forcing USE_MYSQL to False in", build_dir + "."
3481858SN/A            env['USE_MYSQL'] = False
3493716Sstever@eecs.umich.edu        else:
3502638Sstever@eecs.umich.edu            print "Compiling in", build_dir, "with MySQL support."
3512638Sstever@eecs.umich.edu            env.ParseConfig(mysql_config_libs)
3522638Sstever@eecs.umich.edu            env.ParseConfig(mysql_config_include)
3532638Sstever@eecs.umich.edu
3542638Sstever@eecs.umich.edu    # Save sticky option settings back to file
3552638Sstever@eecs.umich.edu    sticky_opts.Save(options_file, env)
3562638Sstever@eecs.umich.edu
3575863Snate@binkert.org    # The m5/SConscript file sets up the build rules in 'env' according
3585863Snate@binkert.org    # to the configured options.  It returns a list of environments,
3595863Snate@binkert.org    # one for each variant build (debug, opt, etc.)
360955SN/A    envList = SConscript('m5/SConscript', build_dir = build_dir,
3615341Sstever@gmail.com                         exports = 'env', duplicate = False)
3625341Sstever@gmail.com
3635863Snate@binkert.org    # Set up the regression tests for each build.
3647756SAli.Saidi@ARM.com    for e in envList:
3655341Sstever@gmail.com        SConscript('m5-test/SConscript',
3666121Snate@binkert.org                   build_dir = os.path.join(build_dir, 'test', e.Label),
3674494Ssaidi@eecs.umich.edu                   exports = { 'env' : e }, duplicate = False)
3686121Snate@binkert.org
3691105SN/A###################################################
3702667Sstever@eecs.umich.edu#
3712667Sstever@eecs.umich.edu# Let SCons do its thing.  At this point SCons will use the defined
3722667Sstever@eecs.umich.edu# build environments to build the requested targets.
3732667Sstever@eecs.umich.edu#
3746121Snate@binkert.org###################################################
3752667Sstever@eecs.umich.edu
3765341Sstever@gmail.com