SConstruct revision 1963
1955SN/A# -*- mode:python -*- 2955SN/A 311408Sandreas.sandberg@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: 11511401Sandreas.sandberg@arm.com # default target (ALPHA_SE/m5.debug, unless overridden) 1165863Snate@binkert.org target = os.path.join(default_config, default_binary) 1175863Snate@binkert.org my_targets = [target] 1184202Sbinkertn@umich.edu Default(target) 1195863Snate@binkert.orgelse: 1205863Snate@binkert.org # invoked from subdirectory 1215863Snate@binkert.org if not launch_dir.startswith(ROOT): 1225863Snate@binkert.org print "Error: launch dir (%s) not a subdirectory of ROOT (%s)!" \ 123955SN/A (launch_dir, ROOT) 1246654Snate@binkert.org Exit(1) 1255273Sstever@gmail.com # make launch_dir relative to ROOT (strip ROOT plus slash off front) 1265871Snate@binkert.org launch_dir = launch_dir[len(ROOT)+1:] 1275273Sstever@gmail.com if len(COMMAND_LINE_TARGETS) != 0: 1286655Snate@binkert.org # make specified targets relative to ROOT 1298878Ssteve.reinhardt@amd.com my_targets = map(lambda x: os.path.join(launch_dir, x), 1306655Snate@binkert.org COMMAND_LINE_TARGETS) 1316655Snate@binkert.org else: 1329219Spower.jg@gmail.com # build default binary (m5.debug, unless overridden) using the 1336655Snate@binkert.org # config inferred by the invocation directory (the first 1345871Snate@binkert.org # subdirectory after ROOT) 1356654Snate@binkert.org target = os.path.join(launch_dir.split('/')[0], default_binary) 1368947Sandreas.hansson@arm.com my_targets = [target] 1375396Ssaidi@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: 1458120Sgblack@eecs.umich.edu 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, 1588879Ssteve.reinhardt@amd.com 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 1728120Sgblack@eecs.umich.edu# 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': 17710458Sandreas.hansson@arm.com # cygwin has some header file issues... 17810458Sandreas.hansson@arm.com env.Append(CCFLAGS=Split("-Wno-uninitialized")) 17910458Sandreas.hansson@arm.comenv.Append(CPPPATH=[os.path.join(EXT_SRCDIR + '/dnet')]) 1808879Ssteve.reinhardt@amd.com 1818879Ssteve.reinhardt@amd.com# Default libraries 1828879Ssteve.reinhardt@amd.comenv.Append(LIBS=['z']) 1838879Ssteve.reinhardt@amd.com 1849227Sandreas.hansson@arm.com# Platform-specific configuration 1859227Sandreas.hansson@arm.comconf = Configure(env) 1868879Ssteve.reinhardt@amd.com 1878879Ssteve.reinhardt@amd.com# Check for <fenv.h> (C99 FP environment control) 1888879Ssteve.reinhardt@amd.comhave_fenv = conf.CheckHeader('fenv.h', '<>') 1898879Ssteve.reinhardt@amd.comif not have_fenv: 19010453SAndrew.Bardsley@arm.com print "Warning: Header file <fenv.h> not found." 19110453SAndrew.Bardsley@arm.com print " This host has no IEEE FP rounding mode control." 19210453SAndrew.Bardsley@arm.com 19310456SCurtis.Dunham@arm.com# Check for mysql. 19410456SCurtis.Dunham@arm.commysql_config = WhereIs('mysql_config') 19510456SCurtis.Dunham@arm.comhave_mysql = mysql_config != None 19610457Sandreas.hansson@arm.com 19710457Sandreas.hansson@arm.com# Check MySQL version. 19811342Sandreas.hansson@arm.comif have_mysql: 19911342Sandreas.hansson@arm.com mysql_version = os.popen(mysql_config + ' --version').read() 2008120Sgblack@eecs.umich.edu mysql_version = mysql_version.split('.') 2018947Sandreas.hansson@arm.com mysql_major = int(mysql_version[0]) 2027816Ssteve.reinhardt@amd.com 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. 2056121Snate@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 2089926Sstan.czerniawski@arm.com 2099926Sstan.czerniawski@arm.com# Set up mysql_config commands. 2109119Sandreas.hansson@arm.comif have_mysql: 21110068Sandreas.hansson@arm.com mysql_config_include = mysql_config + ' --include' 21210068Sandreas.hansson@arm.com if os.system(mysql_config_include + ' > /dev/null') != 0: 213955SN/A # older mysql_config versions don't support --include, use 2149416SAndreas.Sandberg@ARM.com # --cflags instead 21511342Sandreas.hansson@arm.com mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g' 21611212Sjoseph.gross@amd.com # This seems to work in all versions 21711212Sjoseph.gross@amd.com mysql_config_libs = mysql_config + ' --libs' 21811212Sjoseph.gross@amd.com 21911212Sjoseph.gross@amd.comenv = conf.Finish() 22011212Sjoseph.gross@amd.com 2219416SAndreas.Sandberg@ARM.com# Sticky options get saved in the options file so they persist from 2229416SAndreas.Sandberg@ARM.com# one invocation to the next (unless overridden, in which case the new 2235871Snate@binkert.org# value becomes sticky). 22410584Sandreas.hansson@arm.comsticky_opts = Options(args=ARGUMENTS) 2259416SAndreas.Sandberg@ARM.comsticky_opts.AddOptions( 2269416SAndreas.Sandberg@ARM.com EnumOption('TARGET_ISA', 'Target ISA', 'alpha', ('alpha')), 2275871Snate@binkert.org BoolOption('FULL_SYSTEM', 'Full-system support', False), 228955SN/A BoolOption('ALPHA_TLASER', 22910671Sandreas.hansson@arm.com 'Model Alpha TurboLaser platform (vs. Tsunami)', False), 23010671Sandreas.hansson@arm.com BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False), 23110671Sandreas.hansson@arm.com BoolOption('EFENCE', 'Link with Electric Fence malloc debugger', 23210671Sandreas.hansson@arm.com False), 2338881Smarc.orr@gmail.com BoolOption('SS_COMPATIBLE_FP', 2346121Snate@binkert.org 'Make floating-point results compatible with SimpleScalar', 2356121Snate@binkert.org False), 2361533SN/A BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql), 2379239Sandreas.hansson@arm.com BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), 2389239Sandreas.hansson@arm.com BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 2399239Sandreas.hansson@arm.com ('CC', 'C compiler', os.environ.get('CC', env['CC'])), 2409239Sandreas.hansson@arm.com ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])), 2419239Sandreas.hansson@arm.com BoolOption('BATCH', 'Use batch pool for build and tests', False), 2429239Sandreas.hansson@arm.com ('BATCH_CMD', 'Batch pool submission command name', 'qdo') 2439239Sandreas.hansson@arm.com ) 2449239Sandreas.hansson@arm.com 2459239Sandreas.hansson@arm.com# Non-sticky options only apply to the current build. 2469239Sandreas.hansson@arm.comnonsticky_opts = Options(args=ARGUMENTS) 2479239Sandreas.hansson@arm.comnonsticky_opts.AddOptions( 2489239Sandreas.hansson@arm.com BoolOption('update_ref', 'Update test reference outputs', False) 2496655Snate@binkert.org ) 2506655Snate@binkert.org 2516655Snate@binkert.org# These options get exported to #defines in config/*.hh (see m5/SConscript). 2526655Snate@binkert.orgenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ 2535871Snate@binkert.org 'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \ 2545871Snate@binkert.org 'STATS_BINNING'] 2555863Snate@binkert.org 2565871Snate@binkert.org# Define a handy 'no-op' action 2578878Ssteve.reinhardt@amd.comdef no_action(target, source, env): 2585871Snate@binkert.org return 0 2595871Snate@binkert.org 2605871Snate@binkert.orgenv.NoAction = Action(no_action, None) 2615863Snate@binkert.org 2626121Snate@binkert.org# libelf build is described in its own SConscript file. 2635863Snate@binkert.org# SConscript-global is the build in build/libelf shared among all 26411408Sandreas.sandberg@arm.com# configs. 26511408Sandreas.sandberg@arm.comenv.SConscript('m5/libelf/SConscript-global', exports = 'env') 2668336Ssteve.reinhardt@amd.com 26711469SCurtis.Dunham@arm.com################################################### 26811469SCurtis.Dunham@arm.com# 2698336Ssteve.reinhardt@amd.com# Define a SCons builder for configuration flag headers. 2704678Snate@binkert.org# 27111887Sandreas.sandberg@arm.com################################################### 27211887Sandreas.sandberg@arm.com 27311887Sandreas.sandberg@arm.com# This function generates a config header file that #defines the 27411887Sandreas.sandberg@arm.com# option symbol to the current option setting (0 or 1). The source 27511887Sandreas.sandberg@arm.com# operands are the name of the option and a Value node containing the 27611887Sandreas.sandberg@arm.com# value of the option. 27711887Sandreas.sandberg@arm.comdef build_config_file(target, source, env): 27811887Sandreas.sandberg@arm.com (option, value) = [s.get_contents() for s in source] 27911887Sandreas.sandberg@arm.com f = file(str(target[0]), 'w') 28011887Sandreas.sandberg@arm.com print >> f, '#define', option, value 28111887Sandreas.sandberg@arm.com f.close() 28211408Sandreas.sandberg@arm.com return None 28311401Sandreas.sandberg@arm.com 28411401Sandreas.sandberg@arm.com# Generate the message to be printed when building the config file. 28511401Sandreas.sandberg@arm.comdef build_config_file_string(target, source, env): 28611401Sandreas.sandberg@arm.com (option, value) = [s.get_contents() for s in source] 28711401Sandreas.sandberg@arm.com return "Defining %s as %s in %s." % (option, value, target[0]) 28811401Sandreas.sandberg@arm.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 2924678Snate@binkert.org# The emitter munges the source & target node lists to reflect what 29311401Sandreas.sandberg@arm.com# we're really doing. 2944678Snate@binkert.orgdef config_emitter(target, source, env): 2954678Snate@binkert.org # extract option name from Builder arg 29611401Sandreas.sandberg@arm.com option = str(target[0]) 29711401Sandreas.sandberg@arm.com # True target is config header file 2988336Ssteve.reinhardt@amd.com target = os.path.join('config', option.lower() + '.hh') 2994678Snate@binkert.org # Force value to 0/1 even if it's a Python bool 3008336Ssteve.reinhardt@amd.com val = int(eval(str(env[option]))) 3018336Ssteve.reinhardt@amd.com # Sources are option name & value (packaged in SCons Value nodes) 3028336Ssteve.reinhardt@amd.com return ([target], [Value(option), Value(val)]) 3038336Ssteve.reinhardt@amd.com 3048336Ssteve.reinhardt@amd.comconfig_builder = Builder(emitter = config_emitter, action = config_action) 3058336Ssteve.reinhardt@amd.com 3065871Snate@binkert.orgenv.Append(BUILDERS = { 'ConfigFile' : config_builder }) 3075871Snate@binkert.org 3088336Ssteve.reinhardt@amd.com################################################### 30911408Sandreas.sandberg@arm.com# 31011408Sandreas.sandberg@arm.com# Define build environments for selected configurations. 31111408Sandreas.sandberg@arm.com# 31211408Sandreas.sandberg@arm.com################################################### 31311408Sandreas.sandberg@arm.com 31411408Sandreas.sandberg@arm.com# rename base env 31511408Sandreas.sandberg@arm.combase_env = env 3168336Ssteve.reinhardt@amd.com 31711401Sandreas.sandberg@arm.comfor build_dir in build_dirs: 31811401Sandreas.sandberg@arm.com # Make a copy of the default environment to use for this config. 31911401Sandreas.sandberg@arm.com env = base_env.Copy() 3205871Snate@binkert.org # Set env according to the build directory config. 3218336Ssteve.reinhardt@amd.com 3228336Ssteve.reinhardt@amd.com sticky_opts.files = [] 32311401Sandreas.sandberg@arm.com # Name of default options file is taken from 'default=' on command 32411401Sandreas.sandberg@arm.com # line if set, otherwise name of build dir. 32511401Sandreas.sandberg@arm.com default_options_file = os.path.join('build_options', 'default', 32611401Sandreas.sandberg@arm.com ARGUMENTS.get('default', build_dir)) 32711401Sandreas.sandberg@arm.com if os.path.isfile(default_options_file): 3284678Snate@binkert.org sticky_opts.files.append(default_options_file) 3295871Snate@binkert.org current_options_file = os.path.join('build_options', 'current', build_dir) 3304678Snate@binkert.org if os.path.isfile(current_options_file): 33111401Sandreas.sandberg@arm.com sticky_opts.files.append(current_options_file) 33211401Sandreas.sandberg@arm.com else: 33311401Sandreas.sandberg@arm.com # if file doesn't exist, make sure at least the directory is there 33411401Sandreas.sandberg@arm.com # so we can create it later 33511401Sandreas.sandberg@arm.com opt_dir = os.path.dirname(current_options_file) 33611401Sandreas.sandberg@arm.com if not os.path.isdir(opt_dir): 33711401Sandreas.sandberg@arm.com os.mkdir(opt_dir) 33811401Sandreas.sandberg@arm.com if not sticky_opts.files: 33911401Sandreas.sandberg@arm.com print "%s: No options file found in build_options, using defaults." \ 34011401Sandreas.sandberg@arm.com % build_dir 34111401Sandreas.sandberg@arm.com 34211401Sandreas.sandberg@arm.com # Apply current option settings to env 34311450Sandreas.sandberg@arm.com sticky_opts.Update(env) 34411450Sandreas.sandberg@arm.com nonsticky_opts.Update(env) 34511450Sandreas.sandberg@arm.com 34611450Sandreas.sandberg@arm.com # Process option settings. 34711450Sandreas.sandberg@arm.com 34811450Sandreas.sandberg@arm.com if not have_fenv and env['USE_FENV']: 34911450Sandreas.sandberg@arm.com print "Warning: <fenv.h> not available; " \ 35011450Sandreas.sandberg@arm.com "forcing USE_FENV to False in", build_dir + "." 35111450Sandreas.sandberg@arm.com env['USE_FENV'] = False 35211450Sandreas.sandberg@arm.com 35311450Sandreas.sandberg@arm.com if not env['USE_FENV']: 35411401Sandreas.sandberg@arm.com print "Warning: No IEEE FP rounding mode control in", build_dir + "." 35511450Sandreas.sandberg@arm.com print " FP results may deviate slightly from other platforms." 35611450Sandreas.sandberg@arm.com 35711450Sandreas.sandberg@arm.com if env['EFENCE']: 35811401Sandreas.sandberg@arm.com env.Append(LIBS=['efence']) 35911450Sandreas.sandberg@arm.com 36011401Sandreas.sandberg@arm.com if env['USE_MYSQL']: 3618336Ssteve.reinhardt@amd.com if not have_mysql: 3628336Ssteve.reinhardt@amd.com print "Warning: MySQL not available; " \ 3638336Ssteve.reinhardt@amd.com "forcing USE_MYSQL to False in", build_dir + "." 3648336Ssteve.reinhardt@amd.com env['USE_MYSQL'] = False 3658336Ssteve.reinhardt@amd.com else: 3668336Ssteve.reinhardt@amd.com print "Compiling in", build_dir, "with MySQL support." 3678336Ssteve.reinhardt@amd.com env.ParseConfig(mysql_config_libs) 3688336Ssteve.reinhardt@amd.com env.ParseConfig(mysql_config_include) 3698336Ssteve.reinhardt@amd.com 3708336Ssteve.reinhardt@amd.com # Save sticky option settings back to current options file 37111401Sandreas.sandberg@arm.com sticky_opts.Save(current_options_file, env) 37211401Sandreas.sandberg@arm.com 3738336Ssteve.reinhardt@amd.com # Do this after we save setting back, or else we'll tack on an 3748336Ssteve.reinhardt@amd.com # extra 'qdo' every time we run scons. 3758336Ssteve.reinhardt@amd.com if env['BATCH']: 3765871Snate@binkert.org env['CC'] = env['BATCH_CMD'] + ' ' + env['CC'] 37711476Sandreas.sandberg@arm.com env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX'] 37811476Sandreas.sandberg@arm.com 37911476Sandreas.sandberg@arm.com # The m5/SConscript file sets up the build rules in 'env' according 38011476Sandreas.sandberg@arm.com # to the configured options. It returns a list of environments, 38111476Sandreas.sandberg@arm.com # one for each variant build (debug, opt, etc.) 38211476Sandreas.sandberg@arm.com envList = SConscript('m5/SConscript', build_dir = build_dir, 38311476Sandreas.sandberg@arm.com exports = 'env', duplicate = False) 38411476Sandreas.sandberg@arm.com 38511476Sandreas.sandberg@arm.com # Set up the regression tests for each build. 38611887Sandreas.sandberg@arm.com for e in envList: 38711887Sandreas.sandberg@arm.com SConscript('m5-test/SConscript', 38811887Sandreas.sandberg@arm.com build_dir = os.path.join(build_dir, 'test', e.Label), 38911408Sandreas.sandberg@arm.com exports = { 'env' : e }, duplicate = False) 39011887Sandreas.sandberg@arm.com 39111887Sandreas.sandberg@arm.com################################################### 39211887Sandreas.sandberg@arm.com# 39311887Sandreas.sandberg@arm.com# Let SCons do its thing. At this point SCons will use the defined 39411887Sandreas.sandberg@arm.com# build environments to build the requested targets. 39511887Sandreas.sandberg@arm.com# 39611926Sgabeblack@google.com################################################### 39711926Sgabeblack@google.com 39811926Sgabeblack@google.com