SConstruct revision 2638:b419cc6a4419
12810SN/A# -*- mode:python -*-
22810SN/A
37636Ssteve.reinhardt@amd.com# Copyright (c) 2004-2005 The Regents of The University of Michigan
42810SN/A# All rights reserved.
52810SN/A#
62810SN/A# Redistribution and use in source and binary forms, with or without
72810SN/A# modification, are permitted provided that the following conditions are
82810SN/A# met: redistributions of source code must retain the above copyright
92810SN/A# notice, this list of conditions and the following disclaimer;
102810SN/A# redistributions in binary form must reproduce the above copyright
112810SN/A# notice, this list of conditions and the following disclaimer in the
122810SN/A# documentation and/or other materials provided with the distribution;
132810SN/A# neither the name of the copyright holders nor the names of its
142810SN/A# contributors may be used to endorse or promote products derived from
152810SN/A# this software without specific prior written permission.
162810SN/A#
172810SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182810SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192810SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202810SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212810SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222810SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232810SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242810SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252810SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262810SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272810SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282810SN/A
292810SN/A###################################################
302810SN/A#
312810SN/A# SCons top-level build description (SConstruct) file.
322810SN/A#
332810SN/A# While in this directory ('m5'), just type 'scons' to build the default
342810SN/A# configuration (see below), or type 'scons build/<CONFIG>/<binary>'
352810SN/A# to build some other configuration (e.g., 'build/ALPHA_FS/m5.opt' for
362810SN/A# the optimized full-system version).
372810SN/A#
386216Snate@binkert.org# You can build M5 in a different directory as long as there is a
396216Snate@binkert.org# 'build/<CONFIG>' somewhere along the target path.  The build system
402810SN/A# expdects that all configs under the same build directory are being
412810SN/A# built for the same host system.
422810SN/A#
436216Snate@binkert.org# Examples:
446216Snate@binkert.org#   These two commands are equivalent.  The '-u' option tells scons to
458232Snate@binkert.org#   search up the directory tree for this SConstruct file.
466216Snate@binkert.org#   % cd <path-to-src>/m5 ; scons build/ALPHA_FS/m5.debug
475338Sstever@gmail.com#   % cd <path-to-src>/m5/build/ALPHA_FS; scons -u m5.debug
486216Snate@binkert.org#   These two commands are equivalent and demonstrate building in a
492810SN/A#   directory outside of the source tree.  The '-C' option tells scons
502810SN/A#   to chdir to the specified directory to find this SConstruct file.
512810SN/A#   % cd <path-to-src>/m5 ; scons /local/foo/build/ALPHA_FS/m5.debug
522810SN/A#   % cd /local/foo/build/ALPHA_FS; scons -C <path-to-src>/m5 m5.debug
532810SN/A#
542810SN/A# You can use 'scons -H' to print scons options.  If you're in this
552810SN/A# 'm5' directory (or use -u or -C to tell scons where to find this
566221Snate@binkert.org# file), you can use 'scons -h' to print all the M5-specific build
574903SN/A# options as well.
584903SN/A#
592810SN/A###################################################
602810SN/A
614903SN/A# Python library imports
624903SN/Aimport sys
634903SN/Aimport os
644903SN/A
654903SN/A# Check for recent-enough Python and SCons versions
664903SN/AEnsurePythonVersion(2,3)
674903SN/AEnsureSConsVersion(0,96,91)
684908SN/A
695875Ssteve.reinhardt@amd.com# The absolute path to the current directory (where this file lives).
704903SN/AROOT = Dir('.').abspath
715875Ssteve.reinhardt@amd.com
724903SN/A# Paths to the M5 and external source trees.
734903SN/ASRCDIR = os.path.join(ROOT, 'src')
744903SN/A
754903SN/A# tell python where to find m5 python code
767669Ssteve.reinhardt@amd.comsys.path.append(os.path.join(ROOT, 'src/python'))
777669Ssteve.reinhardt@amd.com
787669Ssteve.reinhardt@amd.com###################################################
797669Ssteve.reinhardt@amd.com#
804903SN/A# Figure out which configurations to set up based on the path(s) of
814903SN/A# the target(s).
825318SN/A#
834908SN/A###################################################
845318SN/A
854908SN/A# Find default configuration & binary.
864908SN/ADefault(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
874908SN/A
884908SN/A# Ask SCons which directory it was invoked from.
894908SN/Alaunch_dir = GetLaunchDir()
904903SN/A
914903SN/A# Make targets relative to invocation directory
925875Ssteve.reinhardt@amd.comabs_targets = map(lambda x: os.path.normpath(os.path.join(launch_dir, str(x))),
934903SN/A                  BUILD_TARGETS)
944903SN/A
954903SN/A# helper function: find last occurrence of element in list
967667Ssteve.reinhardt@amd.comdef rfind(l, elt, offs = -1):
977667Ssteve.reinhardt@amd.com    for i in range(len(l)+offs, 0, -1):
987667Ssteve.reinhardt@amd.com        if l[i] == elt:
997667Ssteve.reinhardt@amd.com            return i
1007667Ssteve.reinhardt@amd.com    raise ValueError, "element not found"
1017667Ssteve.reinhardt@amd.com
1027667Ssteve.reinhardt@amd.com# Each target must have 'build' in the interior of the path; the
1037667Ssteve.reinhardt@amd.com# directory below this will determine the build parameters.  For
1047667Ssteve.reinhardt@amd.com# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
1057669Ssteve.reinhardt@amd.com# recognize that ALPHA_SE specifies the configuration because it
1067669Ssteve.reinhardt@amd.com# follow 'build' in the bulid path.
1077669Ssteve.reinhardt@amd.com
1087667Ssteve.reinhardt@amd.com# Generate a list of the unique build roots and configs that the
1097667Ssteve.reinhardt@amd.com# collected targets reference.
1107667Ssteve.reinhardt@amd.combuild_paths = []
1117667Ssteve.reinhardt@amd.combuild_root = None
1124903SN/Afor t in abs_targets:
1134903SN/A    path_dirs = t.split('/')
1144903SN/A    try:
1154903SN/A        build_top = rfind(path_dirs, 'build', -2)
1164903SN/A    except:
1174903SN/A        print "Error: no non-leaf 'build' dir found on target path", t
1184903SN/A        Exit(1)
1194903SN/A    this_build_root = os.path.join('/',*path_dirs[:build_top+1])
1207667Ssteve.reinhardt@amd.com    if not build_root:
1214903SN/A        build_root = this_build_root
1224903SN/A    else:
1234903SN/A        if this_build_root != build_root:
1244903SN/A            print "Error: build targets not under same build root\n"\
1254903SN/A                  "  %s\n  %s" % (build_root, this_build_root)
1264903SN/A            Exit(1)
1272810SN/A    build_path = os.path.join('/',*path_dirs[:build_top+2])
1284908SN/A    if build_path not in build_paths:
1294908SN/A        build_paths.append(build_path)
1304908SN/A
1314908SN/A###################################################
1325318SN/A#
1335318SN/A# Set up the default build environment.  This environment is copied
1345318SN/A# and modified according to each selected configuration.
1355318SN/A#
1365318SN/A###################################################
1374908SN/A
1384908SN/Aenv = Environment(ENV = os.environ,  # inherit user's environment vars
1394908SN/A                  ROOT = ROOT,
1404908SN/A                  SRCDIR = SRCDIR)
1414908SN/A
1424920SN/Aenv.SConsignFile("sconsign")
1434920SN/A
1444920SN/A# I waffle on this setting... it does avoid a few painful but
1454920SN/A# unnecessary builds, but it also seems to make trivial builds take
1464920SN/A# noticeably longer.
1474920SN/Aif False:
1484920SN/A    env.TargetSignatures('content')
1494920SN/A
1504920SN/A# M5_PLY is used by isa_parser.py to find the PLY package.
1514920SN/Aenv.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
1524920SN/A
1534920SN/A# Set up default C++ compiler flags
1544920SN/Aenv.Append(CCFLAGS='-pipe')
1554920SN/Aenv.Append(CCFLAGS='-fno-strict-aliasing')
1564908SN/Aenv.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
1575314SN/Aif sys.platform == 'cygwin':
1585314SN/A    # cygwin has some header file issues...
1595314SN/A    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
1605314SN/Aenv.Append(CPPPATH=[Dir('ext/dnet')])
1615314SN/A
1625875Ssteve.reinhardt@amd.com# Default libraries
1635875Ssteve.reinhardt@amd.comenv.Append(LIBS=['z'])
1645875Ssteve.reinhardt@amd.com
1655875Ssteve.reinhardt@amd.com# Platform-specific configuration.  Note again that we assume that all
1665875Ssteve.reinhardt@amd.com# builds under a given build root run on the same host platform.
1675875Ssteve.reinhardt@amd.comconf = Configure(env,
1685875Ssteve.reinhardt@amd.com                 conf_dir = os.path.join(build_root, '.scons_config'),
1695875Ssteve.reinhardt@amd.com                 log_file = os.path.join(build_root, 'scons_config.log'))
1705314SN/A
1715314SN/A# Check for <fenv.h> (C99 FP environment control)
1725314SN/Ahave_fenv = conf.CheckHeader('fenv.h', '<>')
1735314SN/Aif not have_fenv:
1745314SN/A    print "Warning: Header file <fenv.h> not found."
1755314SN/A    print "         This host has no IEEE FP rounding mode control."
1764666SN/A
1774871SN/A# Check for mysql.
1782810SN/Amysql_config = WhereIs('mysql_config')
1792885SN/Ahave_mysql = mysql_config != None
1804626SN/A
1814871SN/A# Check MySQL version.
1824666SN/Aif have_mysql:
1834626SN/A    mysql_version = os.popen(mysql_config + ' --version').read()
1845730SSteve.Reinhardt@amd.com    mysql_version = mysql_version.split('.')
1854626SN/A    mysql_major = int(mysql_version[0])
1864626SN/A    mysql_minor = int(mysql_version[1])
1874908SN/A    # This version check is probably overly conservative, but it deals
1884626SN/A    # with the versions we have installed.
1894626SN/A    if mysql_major < 4 or (mysql_major == 4 and mysql_minor < 1):
1905875Ssteve.reinhardt@amd.com        print "Warning: MySQL v4.1 or newer required."
1914626SN/A        have_mysql = False
1925875Ssteve.reinhardt@amd.com
1935875Ssteve.reinhardt@amd.com# Set up mysql_config commands.
1945875Ssteve.reinhardt@amd.comif have_mysql:
1955875Ssteve.reinhardt@amd.com    mysql_config_include = mysql_config + ' --include'
1964903SN/A    if os.system(mysql_config_include + ' > /dev/null') != 0:
1974668SN/A        # older mysql_config versions don't support --include, use
1982810SN/A        # --cflags instead
1992810SN/A        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
2004908SN/A    # This seems to work in all versions
2015318SN/A    mysql_config_libs = mysql_config + ' --libs'
2025318SN/A
2035318SN/Aenv = conf.Finish()
2045318SN/A
2055318SN/A# Define the universe of supported ISAs
2065318SN/Aenv['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips']
2075318SN/A
2085318SN/A# Define the universe of supported CPU models
2095318SN/Aenv['ALL_CPU_LIST'] = ['AtomicSimpleCPU', 'TimingSimpleCPU',
2105318SN/A                       'FullCPU', 'AlphaFullCPU']
2114908SN/A
2127667Ssteve.reinhardt@amd.com# Sticky options get saved in the options file so they persist from
2134908SN/A# one invocation to the next (unless overridden, in which case the new
2144908SN/A# value becomes sticky).
2155730SSteve.Reinhardt@amd.comsticky_opts = Options(args=ARGUMENTS)
2164908SN/Asticky_opts.AddOptions(
2174908SN/A    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', env['ALL_ISA_LIST']),
2184908SN/A    BoolOption('FULL_SYSTEM', 'Full-system support', False),
2194908SN/A    # There's a bug in scons 0.96.1 that causes ListOptions with list
2204908SN/A    # values (more than one value) not to be able to be restored from
2214908SN/A    # a saved option file.  If this causes trouble then upgrade to
2224908SN/A    # scons 0.96.90 or later.
2237667Ssteve.reinhardt@amd.com    ListOption('CPU_MODELS', 'CPU models', 'AtomicSimpleCPU,TimingSimpleCPU',
2247667Ssteve.reinhardt@amd.com               env['ALL_CPU_LIST']),
2257667Ssteve.reinhardt@amd.com    BoolOption('ALPHA_TLASER',
2267667Ssteve.reinhardt@amd.com               'Model Alpha TurboLaser platform (vs. Tsunami)', False),
2274908SN/A    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
2284908SN/A    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
2294908SN/A               False),
2304908SN/A    BoolOption('SS_COMPATIBLE_FP',
2314908SN/A               'Make floating-point results compatible with SimpleScalar',
2324908SN/A               False),
2334908SN/A    BoolOption('USE_SSE2',
2344908SN/A               'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts',
2354908SN/A               False),
2362810SN/A    BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql),
2372810SN/A    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
2382810SN/A    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
2394903SN/A    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
2404903SN/A    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
2414903SN/A    BoolOption('BATCH', 'Use batch pool for build and tests', False),
2422810SN/A    ('BATCH_CMD', 'Batch pool submission command name', 'qdo')
2432810SN/A    )
2442810SN/A
2452810SN/A# Non-sticky options only apply to the current build.
2462810SN/Anonsticky_opts = Options(args=ARGUMENTS)
2472810SN/Anonsticky_opts.AddOptions(
2482810SN/A    BoolOption('update_ref', 'Update test reference outputs', False)
2492810SN/A    )
2504903SN/A
2512810SN/A# These options get exported to #defines in config/*.hh (see m5/SConscript).
2524903SN/Aenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
2534903SN/A                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
2544903SN/A                     'STATS_BINNING']
2554903SN/A
2564903SN/A# Define a handy 'no-op' action
2574903SN/Adef no_action(target, source, env):
2587667Ssteve.reinhardt@amd.com    return 0
2597667Ssteve.reinhardt@amd.com
2607667Ssteve.reinhardt@amd.comenv.NoAction = Action(no_action, None)
2617667Ssteve.reinhardt@amd.com
2625875Ssteve.reinhardt@amd.com###################################################
2635875Ssteve.reinhardt@amd.com#
2645875Ssteve.reinhardt@amd.com# Define a SCons builder for configuration flag headers.
2655875Ssteve.reinhardt@amd.com#
2665875Ssteve.reinhardt@amd.com###################################################
2674903SN/A
2687667Ssteve.reinhardt@amd.com# This function generates a config header file that #defines the
2697667Ssteve.reinhardt@amd.com# option symbol to the current option setting (0 or 1).  The source
2707667Ssteve.reinhardt@amd.com# operands are the name of the option and a Value node containing the
2714903SN/A# value of the option.
2727667Ssteve.reinhardt@amd.comdef build_config_file(target, source, env):
2737667Ssteve.reinhardt@amd.com    (option, value) = [s.get_contents() for s in source]
2745875Ssteve.reinhardt@amd.com    f = file(str(target[0]), 'w')
2754665SN/A    print >> f, '#define', option, value
2765318SN/A    f.close()
2775318SN/A    return None
2785318SN/A
2795318SN/A# Generate the message to be printed when building the config file.
2805875Ssteve.reinhardt@amd.comdef build_config_file_string(target, source, env):
2812810SN/A    (option, value) = [s.get_contents() for s in source]
2822810SN/A    return "Defining %s as %s in %s." % (option, value, target[0])
2832810SN/A
2844665SN/A# Combine the two functions into a scons Action object.
2854665SN/Aconfig_action = Action(build_config_file, build_config_file_string)
2864902SN/A
2874902SN/A# The emitter munges the source & target node lists to reflect what
2884665SN/A# we're really doing.
2894910SN/Adef config_emitter(target, source, env):
2904903SN/A    # extract option name from Builder arg
2914903SN/A    option = str(target[0])
2924903SN/A    # True target is config header file
2934903SN/A    target = os.path.join('config', option.lower() + '.hh')
2944903SN/A    # Force value to 0/1 even if it's a Python bool
2954903SN/A    val = int(eval(str(env[option])))
2964903SN/A    # Sources are option name & value (packaged in SCons Value nodes)
2974903SN/A    return ([target], [Value(option), Value(val)])
2984903SN/A
2994903SN/Aconfig_builder = Builder(emitter = config_emitter, action = config_action)
3004903SN/A
3014903SN/Aenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
3024903SN/A
3034903SN/A# base help text
3044903SN/Ahelp_text = '''
3054903SN/AUsage: scons [scons options] [build options] [target(s)]
3064903SN/A
3074903SN/A'''
3084902SN/A
3094902SN/A# libelf build is shared across all configs in the build root.
3104665SN/Aenv.SConscript('ext/libelf/SConscript',
3114903SN/A               build_dir = os.path.join(build_root, 'libelf'),
3124903SN/A               exports = 'env')
3134903SN/A
3144903SN/A###################################################
3154903SN/A#
3164903SN/A# Define build environments for selected configurations.
3174903SN/A#
3184903SN/A###################################################
3197667Ssteve.reinhardt@amd.com
3204665SN/A# rename base env
3214903SN/Abase_env = env
3224903SN/A
3234902SN/Afor build_path in build_paths:
3244665SN/A    print "Building in", build_path
3254665SN/A    # build_dir is the tail component of build path, and is used to
3267667Ssteve.reinhardt@amd.com    # determine the build parameters (e.g., 'ALPHA_SE')
3277667Ssteve.reinhardt@amd.com    (build_root, build_dir) = os.path.split(build_path)
3287667Ssteve.reinhardt@amd.com    # Make a copy of the build-root environment to use for this config.
3297667Ssteve.reinhardt@amd.com    env = base_env.Copy()
3307667Ssteve.reinhardt@amd.com
3317667Ssteve.reinhardt@amd.com    # Set env options according to the build directory config.
3327667Ssteve.reinhardt@amd.com    sticky_opts.files = []
3337667Ssteve.reinhardt@amd.com    # Options for $BUILD_ROOT/$BUILD_DIR are stored in
3347667Ssteve.reinhardt@amd.com    # $BUILD_ROOT/options/$BUILD_DIR so you can nuke
3357667Ssteve.reinhardt@amd.com    # $BUILD_ROOT/$BUILD_DIR without losing your options settings.
3364970SN/A    current_opts_file = os.path.join(build_root, 'options', build_dir)
3377823Ssteve.reinhardt@amd.com    if os.path.isfile(current_opts_file):
3385318SN/A        sticky_opts.files.append(current_opts_file)
3394670SN/A        print "Using saved options file %s" % current_opts_file
3404670SN/A    else:
3417667Ssteve.reinhardt@amd.com        # Build dir-specific options file doesn't exist.
3424670SN/A
3434916SN/A        # Make sure the directory is there so we can create it later
3444670SN/A        opt_dir = os.path.dirname(current_opts_file)
3454670SN/A        if not os.path.isdir(opt_dir):
3464670SN/A            os.mkdir(opt_dir)
3474670SN/A
3487667Ssteve.reinhardt@amd.com        # Get default build options from source tree.  Options are
3494670SN/A        # normally determined by name of $BUILD_DIR, but can be
3507667Ssteve.reinhardt@amd.com        # overriden by 'default=' arg on command line.
3517667Ssteve.reinhardt@amd.com        default_opts_file = os.path.join('build_opts',
3527667Ssteve.reinhardt@amd.com                                         ARGUMENTS.get('default', build_dir))
3537667Ssteve.reinhardt@amd.com        if os.path.isfile(default_opts_file):
3547667Ssteve.reinhardt@amd.com            sticky_opts.files.append(default_opts_file)
3557667Ssteve.reinhardt@amd.com            print "Options file %s not found,\n  using defaults in %s" \
3564670SN/A                  % (current_opts_file, default_opts_file)
3574667SN/A        else:
3584902SN/A            print "Error: cannot find options file %s or %s" \
3594902SN/A                  % (current_opts_file, default_opts_file)
3604665SN/A            Exit(1)
3614665SN/A
3624665SN/A    # Apply current option settings to env
3634665SN/A    sticky_opts.Update(env)
3644665SN/A    nonsticky_opts.Update(env)
3654665SN/A
3664903SN/A    help_text += "Sticky options for %s:\n" % build_dir \
3674903SN/A                 + sticky_opts.GenerateHelpText(env) \
3684665SN/A                 + "\nNon-sticky options for %s:\n" % build_dir \
3694665SN/A                 + nonsticky_opts.GenerateHelpText(env)
3704665SN/A
3714903SN/A    # Process option settings.
3724903SN/A
3734665SN/A    if not have_fenv and env['USE_FENV']:
3744903SN/A        print "Warning: <fenv.h> not available; " \
3752810SN/A              "forcing USE_FENV to False in", build_dir + "."
3764903SN/A        env['USE_FENV'] = False
3774903SN/A
3784903SN/A    if not env['USE_FENV']:
3794903SN/A        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
3804903SN/A        print "         FP results may deviate slightly from other platforms."
3814903SN/A
3827823Ssteve.reinhardt@amd.com    if env['EFENCE']:
3834665SN/A        env.Append(LIBS=['efence'])
3844665SN/A
3852810SN/A    if env['USE_MYSQL']:
3862810SN/A        if not have_mysql:
3872810SN/A            print "Warning: MySQL not available; " \
3882810SN/A                  "forcing USE_MYSQL to False in", build_dir + "."
3894670SN/A            env['USE_MYSQL'] = False
3904668SN/A        else:
3917667Ssteve.reinhardt@amd.com            print "Compiling in", build_dir, "with MySQL support."
3927667Ssteve.reinhardt@amd.com            env.ParseConfig(mysql_config_libs)
3935270SN/A            env.ParseConfig(mysql_config_include)
3945270SN/A
3955270SN/A    # Save sticky option settings back to current options file
3965270SN/A    sticky_opts.Save(current_opts_file, env)
3975270SN/A
3985270SN/A    # Do this after we save setting back, or else we'll tack on an
3995270SN/A    # extra 'qdo' every time we run scons.
4005270SN/A    if env['BATCH']:
4015270SN/A        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
4025270SN/A        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
4035270SN/A
4045318SN/A    if env['USE_SSE2']:
4055318SN/A        env.Append(CCFLAGS='-msse2')
4065318SN/A
4075318SN/A    # The m5/SConscript file sets up the build rules in 'env' according
4085270SN/A    # to the configured options.  It returns a list of environments,
4095270SN/A    # one for each variant build (debug, opt, etc.)
4105270SN/A    envList = SConscript('src/SConscript', build_dir = build_path,
4115270SN/A                         exports = 'env', duplicate = False)
4124668SN/A
4134668SN/A    # Set up the regression tests for each build.
4144668SN/A#    for e in envList:
4155314SN/A#        SConscript('m5-test/SConscript',
4165314SN/A#                   build_dir = os.path.join(build_dir, 'test', e.Label),
4175314SN/A#                   exports = { 'env' : e }, duplicate = False)
4185314SN/A
4195314SN/AHelp(help_text)
4205314SN/A
4215314SN/A###################################################
4225314SN/A#
4235314SN/A# Let SCons do its thing.  At this point SCons will use the defined
4245314SN/A# build environments to build the requested targets.
4255314SN/A#
4265314SN/A###################################################
4275314SN/A
4285314SN/A