SConstruct revision 2139
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 < 4 or (mysql_major == 4 and mysql_minor < 1): 2065871Snate@binkert.org print "Warning: MySQL v4.1 or newer required." 2075871Snate@binkert.org have_mysql = False 2085871Snate@binkert.org 2095871Snate@binkert.org# Set up mysql_config commands. 2106121Snate@binkert.orgif have_mysql: 2116121Snate@binkert.org mysql_config_include = mysql_config + ' --include' 2125863Snate@binkert.org if os.system(mysql_config_include + ' > /dev/null') != 0: 213955SN/A # older mysql_config versions don't support --include, use 214955SN/A # --cflags instead 2152632Sstever@eecs.umich.edu mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g' 2162632Sstever@eecs.umich.edu # This seems to work in all versions 217955SN/A mysql_config_libs = mysql_config + ' --libs' 218955SN/A 219955SN/Aenv = conf.Finish() 220955SN/A 2215863Snate@binkert.org# Define the universe of supported ISAs 222955SN/Aenv['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips'] 2232632Sstever@eecs.umich.edu 2242632Sstever@eecs.umich.edu# Sticky options get saved in the options file so they persist from 2252632Sstever@eecs.umich.edu# one invocation to the next (unless overridden, in which case the new 2262632Sstever@eecs.umich.edu# value becomes sticky). 2272632Sstever@eecs.umich.edusticky_opts = Options(args=ARGUMENTS) 2282632Sstever@eecs.umich.edusticky_opts.AddOptions( 2292632Sstever@eecs.umich.edu EnumOption('TARGET_ISA', 'Target ISA', 'alpha', env['ALL_ISA_LIST']), 2302632Sstever@eecs.umich.edu BoolOption('FULL_SYSTEM', 'Full-system support', False), 2312632Sstever@eecs.umich.edu BoolOption('ALPHA_TLASER', 2322632Sstever@eecs.umich.edu 'Model Alpha TurboLaser platform (vs. Tsunami)', False), 2332632Sstever@eecs.umich.edu BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False), 2342632Sstever@eecs.umich.edu BoolOption('EFENCE', 'Link with Electric Fence malloc debugger', 2352632Sstever@eecs.umich.edu False), 2363718Sstever@eecs.umich.edu BoolOption('SS_COMPATIBLE_FP', 2373718Sstever@eecs.umich.edu 'Make floating-point results compatible with SimpleScalar', 2383718Sstever@eecs.umich.edu False), 2393718Sstever@eecs.umich.edu BoolOption('USE_SSE2', 2403718Sstever@eecs.umich.edu 'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts', 2415863Snate@binkert.org False), 2425863Snate@binkert.org BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql), 2433718Sstever@eecs.umich.edu BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), 2443718Sstever@eecs.umich.edu BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 2456121Snate@binkert.org ('CC', 'C compiler', os.environ.get('CC', env['CC'])), 2465863Snate@binkert.org ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])), 2473718Sstever@eecs.umich.edu BoolOption('BATCH', 'Use batch pool for build and tests', False), 2483718Sstever@eecs.umich.edu ('BATCH_CMD', 'Batch pool submission command name', 'qdo') 2492634Sstever@eecs.umich.edu ) 2502634Sstever@eecs.umich.edu 2515863Snate@binkert.org# Non-sticky options only apply to the current build. 2522638Sstever@eecs.umich.edunonsticky_opts = Options(args=ARGUMENTS) 2532632Sstever@eecs.umich.edunonsticky_opts.AddOptions( 2542632Sstever@eecs.umich.edu BoolOption('update_ref', 'Update test reference outputs', False) 2552632Sstever@eecs.umich.edu ) 2562632Sstever@eecs.umich.edu 2572632Sstever@eecs.umich.edu# These options get exported to #defines in config/*.hh (see m5/SConscript). 2582632Sstever@eecs.umich.eduenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ 2591858SN/A 'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \ 2603716Sstever@eecs.umich.edu 'STATS_BINNING'] 2612638Sstever@eecs.umich.edu 2622638Sstever@eecs.umich.edu# Define a handy 'no-op' action 2632638Sstever@eecs.umich.edudef no_action(target, source, env): 2642638Sstever@eecs.umich.edu return 0 2652638Sstever@eecs.umich.edu 2662638Sstever@eecs.umich.eduenv.NoAction = Action(no_action, None) 2672638Sstever@eecs.umich.edu 2685863Snate@binkert.org# libelf build is described in its own SConscript file. 2695863Snate@binkert.org# SConscript-global is the build in build/libelf shared among all 2705863Snate@binkert.org# configs. 271955SN/Aenv.SConscript('m5/libelf/SConscript-global', exports = 'env') 2725341Sstever@gmail.com 2735341Sstever@gmail.com################################################### 2745863Snate@binkert.org# 2755341Sstever@gmail.com# Define a SCons builder for configuration flag headers. 2766121Snate@binkert.org# 2774494Ssaidi@eecs.umich.edu################################################### 2786121Snate@binkert.org 2791105SN/A# This function generates a config header file that #defines the 2802667Sstever@eecs.umich.edu# option symbol to the current option setting (0 or 1). The source 2812667Sstever@eecs.umich.edu# operands are the name of the option and a Value node containing the 2822667Sstever@eecs.umich.edu# value of the option. 2832667Sstever@eecs.umich.edudef build_config_file(target, source, env): 2846121Snate@binkert.org (option, value) = [s.get_contents() for s in source] 2852667Sstever@eecs.umich.edu f = file(str(target[0]), 'w') 2865341Sstever@gmail.com print >> f, '#define', option, value 2875863Snate@binkert.org f.close() 2885341Sstever@gmail.com return None 2895341Sstever@gmail.com 2905341Sstever@gmail.com# Generate the message to be printed when building the config file. 2915863Snate@binkert.orgdef build_config_file_string(target, source, env): 2925341Sstever@gmail.com (option, value) = [s.get_contents() for s in source] 2935341Sstever@gmail.com return "Defining %s as %s in %s." % (option, value, target[0]) 2945341Sstever@gmail.com 2955863Snate@binkert.org# Combine the two functions into a scons Action object. 2965341Sstever@gmail.comconfig_action = Action(build_config_file, build_config_file_string) 2975341Sstever@gmail.com 2985341Sstever@gmail.com# The emitter munges the source & target node lists to reflect what 2995341Sstever@gmail.com# we're really doing. 3005341Sstever@gmail.comdef config_emitter(target, source, env): 3015341Sstever@gmail.com # extract option name from Builder arg 3025341Sstever@gmail.com option = str(target[0]) 3035341Sstever@gmail.com # True target is config header file 3045341Sstever@gmail.com target = os.path.join('config', option.lower() + '.hh') 3055341Sstever@gmail.com # Force value to 0/1 even if it's a Python bool 3065863Snate@binkert.org val = int(eval(str(env[option]))) 3075341Sstever@gmail.com # Sources are option name & value (packaged in SCons Value nodes) 3085863Snate@binkert.org return ([target], [Value(option), Value(val)]) 3095341Sstever@gmail.com 3105863Snate@binkert.orgconfig_builder = Builder(emitter = config_emitter, action = config_action) 3116121Snate@binkert.org 3126121Snate@binkert.orgenv.Append(BUILDERS = { 'ConfigFile' : config_builder }) 3135397Ssaidi@eecs.umich.edu 3145397Ssaidi@eecs.umich.edu################################################### 3155341Sstever@gmail.com# 3166168Snate@binkert.org# Define build environments for selected configurations. 3176168Snate@binkert.org# 3186168Snate@binkert.org################################################### 3195341Sstever@gmail.com 3205341Sstever@gmail.com# rename base env 3215341Sstever@gmail.combase_env = env 3225341Sstever@gmail.com 3235341Sstever@gmail.comfor build_dir in build_dirs: 3245863Snate@binkert.org # Make a copy of the default environment to use for this config. 3255341Sstever@gmail.com env = base_env.Copy() 3265341Sstever@gmail.com 3276121Snate@binkert.org # Record what build_dir was in the environment 3286121Snate@binkert.org env.Append(BUILD_DIR=build_dir); 3295341Sstever@gmail.com 3306814Sgblack@eecs.umich.edu # Set env according to the build directory config. 3316814Sgblack@eecs.umich.edu 3325863Snate@binkert.org sticky_opts.files = [] 3336121Snate@binkert.org # Name of default options file is taken from 'default=' on command 3345341Sstever@gmail.com # line if set, otherwise name of build dir. 3355863Snate@binkert.org default_options_file = os.path.join('build_options', 'default', 3365341Sstever@gmail.com ARGUMENTS.get('default', build_dir)) 3376121Snate@binkert.org if os.path.isfile(default_options_file): 3386121Snate@binkert.org sticky_opts.files.append(default_options_file) 3396121Snate@binkert.org current_options_file = os.path.join('build_options', 'current', build_dir) 3405742Snate@binkert.org if os.path.isfile(current_options_file): 3415742Snate@binkert.org sticky_opts.files.append(current_options_file) 3425341Sstever@gmail.com else: 3435742Snate@binkert.org # if file doesn't exist, make sure at least the directory is there 3445742Snate@binkert.org # so we can create it later 3455341Sstever@gmail.com opt_dir = os.path.dirname(current_options_file) 3466017Snate@binkert.org if not os.path.isdir(opt_dir): 3476121Snate@binkert.org os.mkdir(opt_dir) 3486017Snate@binkert.org if not sticky_opts.files: 3496654Snate@binkert.org print "%s: No options file found in build_options, using defaults." \ 3506654Snate@binkert.org % build_dir 3515871Snate@binkert.org 3526121Snate@binkert.org # Apply current option settings to env 3536121Snate@binkert.org sticky_opts.Update(env) 3546121Snate@binkert.org nonsticky_opts.Update(env) 3556121Snate@binkert.org 3563940Ssaidi@eecs.umich.edu # Process option settings. 3573918Ssaidi@eecs.umich.edu 3583918Ssaidi@eecs.umich.edu if not have_fenv and env['USE_FENV']: 3591858SN/A print "Warning: <fenv.h> not available; " \ 3606121Snate@binkert.org "forcing USE_FENV to False in", build_dir + "." 3616121Snate@binkert.org env['USE_FENV'] = False 3626121Snate@binkert.org 3636143Snate@binkert.org if not env['USE_FENV']: 3646121Snate@binkert.org print "Warning: No IEEE FP rounding mode control in", build_dir + "." 3656121Snate@binkert.org print " FP results may deviate slightly from other platforms." 3663940Ssaidi@eecs.umich.edu 3676121Snate@binkert.org if env['EFENCE']: 3686121Snate@binkert.org env.Append(LIBS=['efence']) 3696121Snate@binkert.org 3706121Snate@binkert.org if env['USE_MYSQL']: 3716121Snate@binkert.org if not have_mysql: 3726121Snate@binkert.org print "Warning: MySQL not available; " \ 3736121Snate@binkert.org "forcing USE_MYSQL to False in", build_dir + "." 3743918Ssaidi@eecs.umich.edu env['USE_MYSQL'] = False 3753918Ssaidi@eecs.umich.edu else: 3763940Ssaidi@eecs.umich.edu print "Compiling in", build_dir, "with MySQL support." 3773918Ssaidi@eecs.umich.edu env.ParseConfig(mysql_config_libs) 3783918Ssaidi@eecs.umich.edu env.ParseConfig(mysql_config_include) 3796157Snate@binkert.org 3806157Snate@binkert.org # Save sticky option settings back to current options file 3816157Snate@binkert.org sticky_opts.Save(current_options_file, env) 3826157Snate@binkert.org 3835397Ssaidi@eecs.umich.edu # Do this after we save setting back, or else we'll tack on an 3845397Ssaidi@eecs.umich.edu # extra 'qdo' every time we run scons. 3856121Snate@binkert.org if env['BATCH']: 3866121Snate@binkert.org env['CC'] = env['BATCH_CMD'] + ' ' + env['CC'] 3876121Snate@binkert.org env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX'] 3886121Snate@binkert.org 3896121Snate@binkert.org if env['USE_SSE2']: 3906121Snate@binkert.org env.Append(CCFLAGS='-msse2') 3915397Ssaidi@eecs.umich.edu 3921851SN/A # The m5/SConscript file sets up the build rules in 'env' according 3931851SN/A # to the configured options. It returns a list of environments, 3946655Snate@binkert.org # one for each variant build (debug, opt, etc.) 395955SN/A envList = SConscript('m5/SConscript', build_dir = build_dir, 3963053Sstever@eecs.umich.edu exports = 'env', duplicate = False) 3976121Snate@binkert.org 3983053Sstever@eecs.umich.edu # Set up the regression tests for each build. 3993053Sstever@eecs.umich.edu for e in envList: 4003053Sstever@eecs.umich.edu SConscript('m5-test/SConscript', 4013053Sstever@eecs.umich.edu build_dir = os.path.join(build_dir, 'test', e.Label), 4023053Sstever@eecs.umich.edu exports = { 'env' : e }, duplicate = False) 4036654Snate@binkert.org 4043053Sstever@eecs.umich.edu################################################### 4054742Sstever@eecs.umich.edu# 4064742Sstever@eecs.umich.edu# Let SCons do its thing. At this point SCons will use the defined 4073053Sstever@eecs.umich.edu# build environments to build the requested targets. 4083053Sstever@eecs.umich.edu# 4093053Sstever@eecs.umich.edu################################################### 4103053Sstever@eecs.umich.edu 4116654Snate@binkert.org