SConstruct revision 2635
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# While in this directory ('m5'), just type 'scons' to build the default 34955SN/A# configuration (see below), or type 'scons build/<CONFIG>/<binary>' 35955SN/A# to build some other configuration (e.g., 'build/ALPHA_FS/m5.opt' for 36955SN/A# the optimized full-system version). 372632Sstever@eecs.umich.edu# 382632Sstever@eecs.umich.edu# You can build M5 in a different directory as long as there is a 392632Sstever@eecs.umich.edu# 'build/<CONFIG>' somewhere along the target path. The build system 402632Sstever@eecs.umich.edu# expdects that all configs under the same build directory are being 41955SN/A# built for the same host system. 422632Sstever@eecs.umich.edu# 432632Sstever@eecs.umich.edu# Examples: 442761Sstever@eecs.umich.edu# These two commands are equivalent. The '-u' option tells scons to 452632Sstever@eecs.umich.edu# search up the directory tree for this SConstruct file. 462632Sstever@eecs.umich.edu# % cd <path-to-src>/m5 ; scons build/ALPHA_FS/m5.debug 472632Sstever@eecs.umich.edu# % cd <path-to-src>/m5/build/ALPHA_FS; scons -u m5.debug 482761Sstever@eecs.umich.edu# These two commands are equivalent and demonstrate building in a 492761Sstever@eecs.umich.edu# directory outside of the source tree. The '-C' option tells scons 502761Sstever@eecs.umich.edu# to chdir to the specified directory to find this SConstruct file. 512632Sstever@eecs.umich.edu# % cd <path-to-src>/m5 ; scons /local/foo/build/ALPHA_FS/m5.debug 522632Sstever@eecs.umich.edu# % cd /local/foo/build/ALPHA_FS; scons -C <path-to-src>/m5 m5.debug 532761Sstever@eecs.umich.edu# 542761Sstever@eecs.umich.edu# You can use 'scons -H' to print scons options. If you're in this 552761Sstever@eecs.umich.edu# 'm5' directory (or use -u or -C to tell scons where to find this 562761Sstever@eecs.umich.edu# file), you can use 'scons -h' to print all the M5-specific build 572761Sstever@eecs.umich.edu# options as well. 582632Sstever@eecs.umich.edu# 592632Sstever@eecs.umich.edu################################################### 602632Sstever@eecs.umich.edu 612632Sstever@eecs.umich.edu# Python library imports 622632Sstever@eecs.umich.eduimport sys 632632Sstever@eecs.umich.eduimport os 642632Sstever@eecs.umich.edu 65955SN/A# Check for recent-enough Python and SCons versions 66955SN/AEnsurePythonVersion(2,3) 67955SN/AEnsureSConsVersion(0,96,91) 685863Snate@binkert.org 695863Snate@binkert.org# The absolute path to the current directory (where this file lives). 705863Snate@binkert.orgROOT = Dir('.').abspath 715863Snate@binkert.org 725863Snate@binkert.org# Paths to the M5 and external source trees. 735863Snate@binkert.orgSRCDIR = os.path.join(ROOT, 'src') 745863Snate@binkert.org 755863Snate@binkert.org# tell python where to find m5 python code 765863Snate@binkert.orgsys.path.append(os.path.join(ROOT, 'src/python')) 775863Snate@binkert.org 785863Snate@binkert.org################################################### 795863Snate@binkert.org# 805863Snate@binkert.org# Figure out which configurations to set up based on the path(s) of 815863Snate@binkert.org# the target(s). 825863Snate@binkert.org# 835863Snate@binkert.org################################################### 845863Snate@binkert.org 855863Snate@binkert.org# Find default configuration & binary. 865863Snate@binkert.orgDefault(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug')) 875863Snate@binkert.org 885863Snate@binkert.org# Ask SCons which directory it was invoked from. 895863Snate@binkert.orglaunch_dir = GetLaunchDir() 905863Snate@binkert.org 915863Snate@binkert.org# Make targets relative to invocation directory 925863Snate@binkert.orgabs_targets = map(lambda x: os.path.normpath(os.path.join(launch_dir, str(x))), 935863Snate@binkert.org BUILD_TARGETS) 945863Snate@binkert.org 955863Snate@binkert.org# helper function: find last occurrence of element in list 965863Snate@binkert.orgdef rfind(l, elt, offs = -1): 975863Snate@binkert.org for i in range(len(l)+offs, 0, -1): 985863Snate@binkert.org if l[i] == elt: 99955SN/A return i 1005396Ssaidi@eecs.umich.edu raise ValueError, "element not found" 1015863Snate@binkert.org 1025863Snate@binkert.org# Each target must have 'build' in the interior of the path; the 1034202Sbinkertn@umich.edu# directory below this will determine the build parameters. For 1045863Snate@binkert.org# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we 1055863Snate@binkert.org# recognize that ALPHA_SE specifies the configuration because it 1065863Snate@binkert.org# follow 'build' in the bulid path. 1075863Snate@binkert.org 108955SN/A# Generate a list of the unique build roots and configs that the 1095273Sstever@gmail.com# collected targets reference. 1105871Snate@binkert.orgbuild_paths = [] 1115273Sstever@gmail.combuild_roots = [] 1125871Snate@binkert.orgfor t in abs_targets: 1135863Snate@binkert.org path_dirs = t.split('/') 1145863Snate@binkert.org try: 1155863Snate@binkert.org build_top = rfind(path_dirs, 'build', -2) 1165871Snate@binkert.org except: 1175872Snate@binkert.org print "Error: no non-leaf 'build' dir found on target path", t 1185872Snate@binkert.org Exit(1) 1195872Snate@binkert.org build_root = os.path.join('/',*path_dirs[:build_top+1]) 1205871Snate@binkert.org if build_root not in build_roots: 1215871Snate@binkert.org build_roots.append(build_root) 1225871Snate@binkert.org build_path = os.path.join('/',*path_dirs[:build_top+2]) 1235871Snate@binkert.org if build_path not in build_paths: 1245871Snate@binkert.org build_paths.append(build_path) 1255871Snate@binkert.org 1265871Snate@binkert.org################################################### 1275871Snate@binkert.org# 1285871Snate@binkert.org# Set up the default build environment. This environment is copied 1295871Snate@binkert.org# and modified according to each selected configuration. 1305871Snate@binkert.org# 1315871Snate@binkert.org################################################### 1325871Snate@binkert.org 1335871Snate@binkert.orgenv = Environment(ENV = os.environ, # inherit user's environment vars 1345863Snate@binkert.org ROOT = ROOT, 1355227Ssaidi@eecs.umich.edu SRCDIR = SRCDIR) 1365396Ssaidi@eecs.umich.edu 1375396Ssaidi@eecs.umich.eduenv.SConsignFile("sconsign") 1385396Ssaidi@eecs.umich.edu 1395396Ssaidi@eecs.umich.edu# I waffle on this setting... it does avoid a few painful but 1405396Ssaidi@eecs.umich.edu# unnecessary builds, but it also seems to make trivial builds take 1415396Ssaidi@eecs.umich.edu# noticeably longer. 1425396Ssaidi@eecs.umich.eduif False: 1435396Ssaidi@eecs.umich.edu env.TargetSignatures('content') 1445588Ssaidi@eecs.umich.edu 1455396Ssaidi@eecs.umich.edu# M5_PLY is used by isa_parser.py to find the PLY package. 1465396Ssaidi@eecs.umich.eduenv.Append(ENV = { 'M5_PLY' : Dir('ext/ply') }) 1475396Ssaidi@eecs.umich.edu 1485396Ssaidi@eecs.umich.edu# Set up default C++ compiler flags 1495396Ssaidi@eecs.umich.eduenv.Append(CCFLAGS='-pipe') 1505396Ssaidi@eecs.umich.eduenv.Append(CCFLAGS='-fno-strict-aliasing') 1515396Ssaidi@eecs.umich.eduenv.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef')) 1525396Ssaidi@eecs.umich.eduif sys.platform == 'cygwin': 1535396Ssaidi@eecs.umich.edu # cygwin has some header file issues... 1545396Ssaidi@eecs.umich.edu env.Append(CCFLAGS=Split("-Wno-uninitialized")) 1555396Ssaidi@eecs.umich.eduenv.Append(CPPPATH=[Dir('ext/dnet')]) 1565396Ssaidi@eecs.umich.edu 1575396Ssaidi@eecs.umich.edu# Default libraries 1585396Ssaidi@eecs.umich.eduenv.Append(LIBS=['z']) 1595871Snate@binkert.org 1605871Snate@binkert.org# Platform-specific configuration 1616121Snate@binkert.orgconf = Configure(env) 1625871Snate@binkert.org 1635871Snate@binkert.org# Check for <fenv.h> (C99 FP environment control) 1646003Snate@binkert.orghave_fenv = conf.CheckHeader('fenv.h', '<>') 1656003Snate@binkert.orgif not have_fenv: 166955SN/A print "Warning: Header file <fenv.h> not found." 1675871Snate@binkert.org print " This host has no IEEE FP rounding mode control." 1685871Snate@binkert.org 1695871Snate@binkert.org# Check for mysql. 1705871Snate@binkert.orgmysql_config = WhereIs('mysql_config') 171955SN/Ahave_mysql = mysql_config != None 1726121Snate@binkert.org 1736121Snate@binkert.org# Check MySQL version. 1746121Snate@binkert.orgif have_mysql: 1751533SN/A mysql_version = os.popen(mysql_config + ' --version').read() 1765871Snate@binkert.org mysql_version = mysql_version.split('.') 1775871Snate@binkert.org mysql_major = int(mysql_version[0]) 1785863Snate@binkert.org mysql_minor = int(mysql_version[1]) 1795871Snate@binkert.org # This version check is probably overly conservative, but it deals 1805871Snate@binkert.org # with the versions we have installed. 1815871Snate@binkert.org if mysql_major < 4 or (mysql_major == 4 and mysql_minor < 1): 1825871Snate@binkert.org print "Warning: MySQL v4.1 or newer required." 1835871Snate@binkert.org have_mysql = False 1845863Snate@binkert.org 1856121Snate@binkert.org# Set up mysql_config commands. 1865863Snate@binkert.orgif have_mysql: 1875871Snate@binkert.org mysql_config_include = mysql_config + ' --include' 1884678Snate@binkert.org if os.system(mysql_config_include + ' > /dev/null') != 0: 1894678Snate@binkert.org # older mysql_config versions don't support --include, use 1904678Snate@binkert.org # --cflags instead 1914678Snate@binkert.org mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g' 1924678Snate@binkert.org # This seems to work in all versions 1934678Snate@binkert.org mysql_config_libs = mysql_config + ' --libs' 1944678Snate@binkert.org 1954678Snate@binkert.orgenv = conf.Finish() 1964678Snate@binkert.org 1974678Snate@binkert.org# Define the universe of supported ISAs 1984678Snate@binkert.orgenv['ALL_ISA_LIST'] = ['alpha', 'sparc', 'mips'] 1994678Snate@binkert.org 2006121Snate@binkert.org# Define the universe of supported CPU models 2014678Snate@binkert.orgenv['ALL_CPU_LIST'] = ['AtomicSimpleCPU', 'TimingSimpleCPU', 2025871Snate@binkert.org 'FastCPU', 'FullCPU', 'AlphaFullCPU'] 2035871Snate@binkert.org 2045871Snate@binkert.org# Sticky options get saved in the options file so they persist from 2055871Snate@binkert.org# one invocation to the next (unless overridden, in which case the new 2065871Snate@binkert.org# value becomes sticky). 2075871Snate@binkert.orgsticky_opts = Options(args=ARGUMENTS) 2085871Snate@binkert.orgsticky_opts.AddOptions( 2095871Snate@binkert.org EnumOption('TARGET_ISA', 'Target ISA', 'alpha', env['ALL_ISA_LIST']), 2105871Snate@binkert.org BoolOption('FULL_SYSTEM', 'Full-system support', False), 2115871Snate@binkert.org # There's a bug in scons 0.96.1 that causes ListOptions with list 2125871Snate@binkert.org # values (more than one value) not to be able to be restored from 2135871Snate@binkert.org # a saved option file. If this causes trouble then upgrade to 2145871Snate@binkert.org # scons 0.96.90 or later. 2155990Ssaidi@eecs.umich.edu ListOption('CPU_MODELS', 'CPU models', 'AtomicSimpleCPU,TimingSimpleCPU', 2165871Snate@binkert.org env['ALL_CPU_LIST']), 2175871Snate@binkert.org BoolOption('ALPHA_TLASER', 2185871Snate@binkert.org 'Model Alpha TurboLaser platform (vs. Tsunami)', False), 2194678Snate@binkert.org BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False), 2206121Snate@binkert.org BoolOption('EFENCE', 'Link with Electric Fence malloc debugger', 2215871Snate@binkert.org False), 2225871Snate@binkert.org BoolOption('SS_COMPATIBLE_FP', 2235871Snate@binkert.org 'Make floating-point results compatible with SimpleScalar', 2245871Snate@binkert.org False), 2255871Snate@binkert.org BoolOption('USE_SSE2', 2265871Snate@binkert.org 'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts', 2275871Snate@binkert.org False), 2285871Snate@binkert.org BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql), 2295871Snate@binkert.org BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), 2304678Snate@binkert.org BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 2315871Snate@binkert.org ('CC', 'C compiler', os.environ.get('CC', env['CC'])), 2324678Snate@binkert.org ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])), 2335871Snate@binkert.org BoolOption('BATCH', 'Use batch pool for build and tests', False), 2345871Snate@binkert.org ('BATCH_CMD', 'Batch pool submission command name', 'qdo') 2355871Snate@binkert.org ) 2365871Snate@binkert.org 2375871Snate@binkert.org# Non-sticky options only apply to the current build. 2385871Snate@binkert.orgnonsticky_opts = Options(args=ARGUMENTS) 2395871Snate@binkert.orgnonsticky_opts.AddOptions( 2405871Snate@binkert.org BoolOption('update_ref', 'Update test reference outputs', False) 2415871Snate@binkert.org ) 2426121Snate@binkert.org 2436121Snate@binkert.org# These options get exported to #defines in config/*.hh (see m5/SConscript). 2445863Snate@binkert.orgenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ 245955SN/A 'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \ 246955SN/A 'STATS_BINNING'] 2472632Sstever@eecs.umich.edu 2482632Sstever@eecs.umich.edu# Define a handy 'no-op' action 249955SN/Adef no_action(target, source, env): 250955SN/A return 0 251955SN/A 252955SN/Aenv.NoAction = Action(no_action, None) 2535863Snate@binkert.org 254955SN/A################################################### 2552632Sstever@eecs.umich.edu# 2562632Sstever@eecs.umich.edu# Define a SCons builder for configuration flag headers. 2572632Sstever@eecs.umich.edu# 2582632Sstever@eecs.umich.edu################################################### 2592632Sstever@eecs.umich.edu 2602632Sstever@eecs.umich.edu# This function generates a config header file that #defines the 2612632Sstever@eecs.umich.edu# option symbol to the current option setting (0 or 1). The source 2622632Sstever@eecs.umich.edu# operands are the name of the option and a Value node containing the 2632632Sstever@eecs.umich.edu# value of the option. 2642632Sstever@eecs.umich.edudef build_config_file(target, source, env): 2652632Sstever@eecs.umich.edu (option, value) = [s.get_contents() for s in source] 2662632Sstever@eecs.umich.edu f = file(str(target[0]), 'w') 2672632Sstever@eecs.umich.edu print >> f, '#define', option, value 2683718Sstever@eecs.umich.edu f.close() 2693718Sstever@eecs.umich.edu return None 2703718Sstever@eecs.umich.edu 2713718Sstever@eecs.umich.edu# Generate the message to be printed when building the config file. 2723718Sstever@eecs.umich.edudef build_config_file_string(target, source, env): 2735863Snate@binkert.org (option, value) = [s.get_contents() for s in source] 2745863Snate@binkert.org return "Defining %s as %s in %s." % (option, value, target[0]) 2753718Sstever@eecs.umich.edu 2763718Sstever@eecs.umich.edu# Combine the two functions into a scons Action object. 2776121Snate@binkert.orgconfig_action = Action(build_config_file, build_config_file_string) 2785863Snate@binkert.org 2793718Sstever@eecs.umich.edu# The emitter munges the source & target node lists to reflect what 2803718Sstever@eecs.umich.edu# we're really doing. 2812634Sstever@eecs.umich.edudef config_emitter(target, source, env): 2822634Sstever@eecs.umich.edu # extract option name from Builder arg 2835863Snate@binkert.org option = str(target[0]) 2842638Sstever@eecs.umich.edu # True target is config header file 2852632Sstever@eecs.umich.edu target = os.path.join('config', option.lower() + '.hh') 2862632Sstever@eecs.umich.edu # Force value to 0/1 even if it's a Python bool 2872632Sstever@eecs.umich.edu val = int(eval(str(env[option]))) 2882632Sstever@eecs.umich.edu # Sources are option name & value (packaged in SCons Value nodes) 2892632Sstever@eecs.umich.edu return ([target], [Value(option), Value(val)]) 2902632Sstever@eecs.umich.edu 2911858SN/Aconfig_builder = Builder(emitter = config_emitter, action = config_action) 2923716Sstever@eecs.umich.edu 2932638Sstever@eecs.umich.eduenv.Append(BUILDERS = { 'ConfigFile' : config_builder }) 2942638Sstever@eecs.umich.edu 2952638Sstever@eecs.umich.edu# base help text 2962638Sstever@eecs.umich.eduhelp_text = ''' 2972638Sstever@eecs.umich.eduUsage: scons [scons options] [build options] [target(s)] 2982638Sstever@eecs.umich.edu 2992638Sstever@eecs.umich.edu''' 3005863Snate@binkert.org 3015863Snate@binkert.org################################################### 3025863Snate@binkert.org# 303955SN/A# Define build environments for selected configurations. 3045341Sstever@gmail.com# 3055341Sstever@gmail.com################################################### 3065863Snate@binkert.org 3075341Sstever@gmail.com# rename base env 3086121Snate@binkert.orgbase_env = env 3094494Ssaidi@eecs.umich.edu 3106121Snate@binkert.org# Spme things (just libelf currently) are shared across all configs in 3111105SN/A# a "build root". Need to define how to build these just once for 3122667Sstever@eecs.umich.edu# each referenced root. 3132667Sstever@eecs.umich.edubuild_root_env = {} 3142667Sstever@eecs.umich.edufor build_root in build_roots: 3152667Sstever@eecs.umich.edu env = base_env.Copy() 3166121Snate@binkert.org env.SConscript('ext/libelf/SConscript', 3172667Sstever@eecs.umich.edu build_dir = os.path.join(build_root, 'libelf'), 3185341Sstever@gmail.com exports = 'env') 3195863Snate@binkert.org build_root_env[build_root] = env 3205341Sstever@gmail.com 3215341Sstever@gmail.comfor build_path in build_paths: 3225341Sstever@gmail.com print "Building in", build_path 3235863Snate@binkert.org # build_dir is the tail component of build path, and is used to 3245341Sstever@gmail.com # determine the build parameters (e.g., 'ALPHA_SE') 3255341Sstever@gmail.com (build_root, build_dir) = os.path.split(build_path) 3265341Sstever@gmail.com # Make a copy of the build-root environment to use for this config. 3275863Snate@binkert.org env = build_root_env[build_root].Copy() 3285341Sstever@gmail.com 3295341Sstever@gmail.com # Set env options according to the build directory config. 3305341Sstever@gmail.com sticky_opts.files = [] 3315341Sstever@gmail.com # Options for $BUILD_ROOT/$BUILD_DIR are stored in 3325341Sstever@gmail.com # $BUILD_ROOT/options/$BUILD_DIR so you can nuke 3335341Sstever@gmail.com # $BUILD_ROOT/$BUILD_DIR without losing your options settings. 3345341Sstever@gmail.com current_opts_file = os.path.join(build_root, 'options', build_dir) 3355341Sstever@gmail.com if os.path.isfile(current_opts_file): 3365341Sstever@gmail.com sticky_opts.files.append(current_opts_file) 3375341Sstever@gmail.com print "Using saved options file %s" % current_opts_file 3385863Snate@binkert.org else: 3395341Sstever@gmail.com # Build dir-specific options file doesn't exist. 3405863Snate@binkert.org 3415341Sstever@gmail.com # Make sure the directory is there so we can create it later 3425863Snate@binkert.org opt_dir = os.path.dirname(current_opts_file) 3436121Snate@binkert.org if not os.path.isdir(opt_dir): 3446121Snate@binkert.org os.mkdir(opt_dir) 3455397Ssaidi@eecs.umich.edu 3465397Ssaidi@eecs.umich.edu # Get default build options from source tree. Options are 3475341Sstever@gmail.com # normally determined by name of $BUILD_DIR, but can be 3485341Sstever@gmail.com # overriden by 'default=' arg on command line. 3495341Sstever@gmail.com default_opts_file = os.path.join('build_opts', 3505341Sstever@gmail.com ARGUMENTS.get('default', build_dir)) 3515341Sstever@gmail.com if os.path.isfile(default_opts_file): 3525341Sstever@gmail.com sticky_opts.files.append(default_opts_file) 3535341Sstever@gmail.com print "Options file %s not found,\n using defaults in %s" \ 3545341Sstever@gmail.com % (current_opts_file, default_opts_file) 3555863Snate@binkert.org else: 3565341Sstever@gmail.com print "Error: cannot find options file %s or %s" \ 3575341Sstever@gmail.com % (current_opts_file, default_opts_file) 3586121Snate@binkert.org Exit(1) 3595341Sstever@gmail.com 3606121Snate@binkert.org # Apply current option settings to env 3616121Snate@binkert.org sticky_opts.Update(env) 3625341Sstever@gmail.com nonsticky_opts.Update(env) 3635863Snate@binkert.org 3646121Snate@binkert.org help_text += "Sticky options for %s:\n" % build_dir \ 3655341Sstever@gmail.com + sticky_opts.GenerateHelpText(env) \ 3665863Snate@binkert.org + "\nNon-sticky options for %s:\n" % build_dir \ 3675341Sstever@gmail.com + nonsticky_opts.GenerateHelpText(env) 3686121Snate@binkert.org 3696121Snate@binkert.org # Process option settings. 3706121Snate@binkert.org 3715742Snate@binkert.org if not have_fenv and env['USE_FENV']: 3725742Snate@binkert.org print "Warning: <fenv.h> not available; " \ 3735341Sstever@gmail.com "forcing USE_FENV to False in", build_dir + "." 3745742Snate@binkert.org env['USE_FENV'] = False 3755742Snate@binkert.org 3765341Sstever@gmail.com if not env['USE_FENV']: 3776017Snate@binkert.org print "Warning: No IEEE FP rounding mode control in", build_dir + "." 3786121Snate@binkert.org print " FP results may deviate slightly from other platforms." 3796017Snate@binkert.org 3802632Sstever@eecs.umich.edu if env['EFENCE']: 3816121Snate@binkert.org env.Append(LIBS=['efence']) 3825871Snate@binkert.org 3836121Snate@binkert.org if env['USE_MYSQL']: 3846121Snate@binkert.org if not have_mysql: 3855871Snate@binkert.org print "Warning: MySQL not available; " \ 3866121Snate@binkert.org "forcing USE_MYSQL to False in", build_dir + "." 3876121Snate@binkert.org env['USE_MYSQL'] = False 3886121Snate@binkert.org else: 3896121Snate@binkert.org print "Compiling in", build_dir, "with MySQL support." 3903940Ssaidi@eecs.umich.edu env.ParseConfig(mysql_config_libs) 3913918Ssaidi@eecs.umich.edu env.ParseConfig(mysql_config_include) 3923918Ssaidi@eecs.umich.edu 3931858SN/A # Save sticky option settings back to current options file 3946121Snate@binkert.org sticky_opts.Save(current_opts_file, env) 3956121Snate@binkert.org 3966121Snate@binkert.org # Do this after we save setting back, or else we'll tack on an 3976143Snate@binkert.org # extra 'qdo' every time we run scons. 3986121Snate@binkert.org if env['BATCH']: 3996121Snate@binkert.org env['CC'] = env['BATCH_CMD'] + ' ' + env['CC'] 4003940Ssaidi@eecs.umich.edu env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX'] 4016121Snate@binkert.org 4026121Snate@binkert.org if env['USE_SSE2']: 4036121Snate@binkert.org env.Append(CCFLAGS='-msse2') 4046121Snate@binkert.org 4056121Snate@binkert.org # The m5/SConscript file sets up the build rules in 'env' according 4066121Snate@binkert.org # to the configured options. It returns a list of environments, 4076121Snate@binkert.org # one for each variant build (debug, opt, etc.) 4083918Ssaidi@eecs.umich.edu envList = SConscript('src/SConscript', build_dir = build_path, 4093918Ssaidi@eecs.umich.edu exports = 'env', duplicate = False) 4103940Ssaidi@eecs.umich.edu 4113918Ssaidi@eecs.umich.edu # Set up the regression tests for each build. 4123918Ssaidi@eecs.umich.edu# for e in envList: 4135397Ssaidi@eecs.umich.edu# SConscript('m5-test/SConscript', 4145397Ssaidi@eecs.umich.edu# build_dir = os.path.join(build_dir, 'test', e.Label), 4156121Snate@binkert.org# exports = { 'env' : e }, duplicate = False) 4166121Snate@binkert.org 4176121Snate@binkert.orgHelp(help_text) 4186121Snate@binkert.org 4196121Snate@binkert.org################################################### 4206121Snate@binkert.org# 4215397Ssaidi@eecs.umich.edu# Let SCons do its thing. At this point SCons will use the defined 4221851SN/A# build environments to build the requested targets. 4231851SN/A# 4246121Snate@binkert.org################################################### 425955SN/A 4263053Sstever@eecs.umich.edu