SConstruct revision 4742
1955SN/A# -*- mode:python -*- 2955SN/A 37816Ssteve.reinhardt@amd.com# Copyright (c) 2004-2005 The Regents of The University of Michigan 45871Snate@binkert.org# All rights reserved. 51762SN/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# 29955SN/A# Authors: Steve Reinhardt 302665Ssaidi@eecs.umich.edu 312665Ssaidi@eecs.umich.edu################################################### 325863Snate@binkert.org# 33955SN/A# SCons top-level build description (SConstruct) file. 34955SN/A# 35955SN/A# While in this directory ('m5'), just type 'scons' to build the default 36955SN/A# configuration (see below), or type 'scons build/<CONFIG>/<binary>' 37955SN/A# to build some other configuration (e.g., 'build/ALPHA_FS/m5.opt' for 388878Ssteve.reinhardt@amd.com# the optimized full-system version). 392632Sstever@eecs.umich.edu# 408878Ssteve.reinhardt@amd.com# You can build M5 in a different directory as long as there is a 412632Sstever@eecs.umich.edu# 'build/<CONFIG>' somewhere along the target path. The build system 42955SN/A# expects that all configs under the same build directory are being 438878Ssteve.reinhardt@amd.com# built for the same host system. 442632Sstever@eecs.umich.edu# 452761Sstever@eecs.umich.edu# Examples: 462632Sstever@eecs.umich.edu# 472632Sstever@eecs.umich.edu# The following two commands are equivalent. The '-u' option tells 482632Sstever@eecs.umich.edu# scons to search up the directory tree for this SConstruct file. 492761Sstever@eecs.umich.edu# % cd <path-to-src>/m5 ; scons build/ALPHA_FS/m5.debug 502761Sstever@eecs.umich.edu# % cd <path-to-src>/m5/build/ALPHA_FS; scons -u m5.debug 512761Sstever@eecs.umich.edu# 528878Ssteve.reinhardt@amd.com# The following two commands are equivalent and demonstrate building 538878Ssteve.reinhardt@amd.com# in a directory outside of the source tree. The '-C' option tells 542761Sstever@eecs.umich.edu# scons to chdir to the specified directory to find this SConstruct 552761Sstever@eecs.umich.edu# file. 562761Sstever@eecs.umich.edu# % cd <path-to-src>/m5 ; scons /local/foo/build/ALPHA_FS/m5.debug 572761Sstever@eecs.umich.edu# % cd /local/foo/build/ALPHA_FS; scons -C <path-to-src>/m5 m5.debug 582761Sstever@eecs.umich.edu# 598878Ssteve.reinhardt@amd.com# You can use 'scons -H' to print scons options. If you're in this 608878Ssteve.reinhardt@amd.com# 'm5' directory (or use -u or -C to tell scons where to find this 612632Sstever@eecs.umich.edu# file), you can use 'scons -h' to print all the M5-specific build 622632Sstever@eecs.umich.edu# options as well. 638878Ssteve.reinhardt@amd.com# 648878Ssteve.reinhardt@amd.com################################################### 652632Sstever@eecs.umich.edu 66955SN/Aimport sys 67955SN/Aimport os 68955SN/Aimport subprocess 695863Snate@binkert.org 705863Snate@binkert.orgfrom os.path import join as joinpath 715863Snate@binkert.org 725863Snate@binkert.org# Check for recent-enough Python and SCons versions. If your system's 735863Snate@binkert.org# default installation of Python is not recent enough, you can use a 745863Snate@binkert.org# non-default installation of the Python interpreter by either (1) 755863Snate@binkert.org# rearranging your PATH so that scons finds the non-default 'python' 765863Snate@binkert.org# first or (2) explicitly invoking an alternative interpreter on the 775863Snate@binkert.org# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]". 785863Snate@binkert.orgEnsurePythonVersion(2,4) 795863Snate@binkert.org 808878Ssteve.reinhardt@amd.com# Ironically, SCons 0.96 dies if you give EnsureSconsVersion a 815863Snate@binkert.org# 3-element version number. 825863Snate@binkert.orgmin_scons_version = (0,96,91) 835863Snate@binkert.orgtry: 845863Snate@binkert.org EnsureSConsVersion(*min_scons_version) 855863Snate@binkert.orgexcept: 865863Snate@binkert.org print "Error checking current SCons version." 875863Snate@binkert.org print "SCons", ".".join(map(str,min_scons_version)), "or greater required." 885863Snate@binkert.org Exit(2) 895863Snate@binkert.org 905863Snate@binkert.org 915863Snate@binkert.org# The absolute path to the current directory (where this file lives). 925863Snate@binkert.orgROOT = Dir('.').abspath 935863Snate@binkert.org 945863Snate@binkert.org# Path to the M5 source tree. 955863Snate@binkert.orgSRCDIR = joinpath(ROOT, 'src') 968878Ssteve.reinhardt@amd.com 975863Snate@binkert.org# tell python where to find m5 python code 985863Snate@binkert.orgsys.path.append(joinpath(ROOT, 'src/python')) 995863Snate@binkert.org 1006654Snate@binkert.org################################################### 101955SN/A# 1025396Ssaidi@eecs.umich.edu# Figure out which configurations to set up based on the path(s) of 1035863Snate@binkert.org# the target(s). 1045863Snate@binkert.org# 1054202Sbinkertn@umich.edu################################################### 1065863Snate@binkert.org 1075863Snate@binkert.org# Find default configuration & binary. 1085863Snate@binkert.orgDefault(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug')) 1095863Snate@binkert.org 110955SN/A# helper function: find last occurrence of element in list 1116654Snate@binkert.orgdef rfind(l, elt, offs = -1): 1125273Sstever@gmail.com for i in range(len(l)+offs, 0, -1): 1135871Snate@binkert.org if l[i] == elt: 1145273Sstever@gmail.com return i 1156655Snate@binkert.org raise ValueError, "element not found" 1168878Ssteve.reinhardt@amd.com 1176655Snate@binkert.org# helper function: compare dotted version numbers. 1186655Snate@binkert.org# E.g., compare_version('1.3.25', '1.4.1') 1196655Snate@binkert.org# returns -1, 0, 1 if v1 is <, ==, > v2 1206655Snate@binkert.orgdef compare_versions(v1, v2): 1215871Snate@binkert.org # Convert dotted strings to lists 1226654Snate@binkert.org v1 = map(int, v1.split('.')) 1238947Sandreas.hansson@arm.com v2 = map(int, v2.split('.')) 1245396Ssaidi@eecs.umich.edu # Compare corresponding elements of lists 1258120Sgblack@eecs.umich.edu for n1,n2 in zip(v1, v2): 1268120Sgblack@eecs.umich.edu if n1 < n2: return -1 1278120Sgblack@eecs.umich.edu if n1 > n2: return 1 1288120Sgblack@eecs.umich.edu # all corresponding values are equal... see if one has extra values 1298120Sgblack@eecs.umich.edu if len(v1) < len(v2): return -1 1308120Sgblack@eecs.umich.edu if len(v1) > len(v2): return 1 1318120Sgblack@eecs.umich.edu return 0 1328120Sgblack@eecs.umich.edu 1338879Ssteve.reinhardt@amd.com# Each target must have 'build' in the interior of the path; the 1348879Ssteve.reinhardt@amd.com# directory below this will determine the build parameters. For 1358879Ssteve.reinhardt@amd.com# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we 1368879Ssteve.reinhardt@amd.com# recognize that ALPHA_SE specifies the configuration because it 1378879Ssteve.reinhardt@amd.com# follow 'build' in the bulid path. 1388879Ssteve.reinhardt@amd.com 1398879Ssteve.reinhardt@amd.com# Generate absolute paths to targets so we can see where the build dir is 1408879Ssteve.reinhardt@amd.comif COMMAND_LINE_TARGETS: 1418879Ssteve.reinhardt@amd.com # Ask SCons which directory it was invoked from 1428879Ssteve.reinhardt@amd.com launch_dir = GetLaunchDir() 1438879Ssteve.reinhardt@amd.com # Make targets relative to invocation directory 1448879Ssteve.reinhardt@amd.com abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))), 1458879Ssteve.reinhardt@amd.com COMMAND_LINE_TARGETS) 1468120Sgblack@eecs.umich.eduelse: 1478120Sgblack@eecs.umich.edu # Default targets are relative to root of tree 1488120Sgblack@eecs.umich.edu abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))), 1498120Sgblack@eecs.umich.edu DEFAULT_TARGETS) 1508120Sgblack@eecs.umich.edu 1518120Sgblack@eecs.umich.edu 1528120Sgblack@eecs.umich.edu# Generate a list of the unique build roots and configs that the 1538120Sgblack@eecs.umich.edu# collected targets reference. 1548120Sgblack@eecs.umich.edubuild_paths = [] 1558120Sgblack@eecs.umich.edubuild_root = None 1568120Sgblack@eecs.umich.edufor t in abs_targets: 1578120Sgblack@eecs.umich.edu path_dirs = t.split('/') 1588120Sgblack@eecs.umich.edu try: 1598120Sgblack@eecs.umich.edu build_top = rfind(path_dirs, 'build', -2) 1608879Ssteve.reinhardt@amd.com except: 1618879Ssteve.reinhardt@amd.com print "Error: no non-leaf 'build' dir found on target path", t 1628879Ssteve.reinhardt@amd.com Exit(1) 1638879Ssteve.reinhardt@amd.com this_build_root = joinpath('/',*path_dirs[:build_top+1]) 1648879Ssteve.reinhardt@amd.com if not build_root: 1658879Ssteve.reinhardt@amd.com build_root = this_build_root 1668879Ssteve.reinhardt@amd.com else: 1678879Ssteve.reinhardt@amd.com if this_build_root != build_root: 1688879Ssteve.reinhardt@amd.com print "Error: build targets not under same build root\n"\ 1698879Ssteve.reinhardt@amd.com " %s\n %s" % (build_root, this_build_root) 1708879Ssteve.reinhardt@amd.com Exit(1) 1718879Ssteve.reinhardt@amd.com build_path = joinpath('/',*path_dirs[:build_top+2]) 1728120Sgblack@eecs.umich.edu if build_path not in build_paths: 1738947Sandreas.hansson@arm.com build_paths.append(build_path) 1747816Ssteve.reinhardt@amd.com 1755871Snate@binkert.org################################################### 1765871Snate@binkert.org# 1776121Snate@binkert.org# Set up the default build environment. This environment is copied 1785871Snate@binkert.org# and modified according to each selected configuration. 1795871Snate@binkert.org# 1806003Snate@binkert.org################################################### 1818980Ssteve.reinhardt@amd.com 182955SN/Aenv = Environment(ENV = os.environ, # inherit user's environment vars 1835871Snate@binkert.org ROOT = ROOT, 1845871Snate@binkert.org SRCDIR = SRCDIR) 1855871Snate@binkert.org 1865871Snate@binkert.org#Parse CC/CXX early so that we use the correct compiler for 187955SN/A# to test for dependencies/versions/libraries/includes 1886121Snate@binkert.orgif ARGUMENTS.get('CC', None): 1898881Smarc.orr@gmail.com env['CC'] = ARGUMENTS.get('CC') 1906121Snate@binkert.org 1916121Snate@binkert.orgif ARGUMENTS.get('CXX', None): 1921533SN/A env['CXX'] = ARGUMENTS.get('CXX') 1936655Snate@binkert.org 1946655Snate@binkert.orgExport('env') 1956655Snate@binkert.org 1966655Snate@binkert.orgenv.SConsignFile(joinpath(build_root,"sconsign")) 1975871Snate@binkert.org 1985871Snate@binkert.org# Default duplicate option is to use hard links, but this messes up 1995863Snate@binkert.org# when you use emacs to edit a file in the target dir, as emacs moves 2005871Snate@binkert.org# file to file~ then copies to file, breaking the link. Symbolic 2018878Ssteve.reinhardt@amd.com# (soft) links work better. 2025871Snate@binkert.orgenv.SetOption('duplicate', 'soft-copy') 2035871Snate@binkert.org 2045871Snate@binkert.org# I waffle on this setting... it does avoid a few painful but 2055863Snate@binkert.org# unnecessary builds, but it also seems to make trivial builds take 2066121Snate@binkert.org# noticeably longer. 2075863Snate@binkert.orgif False: 2085871Snate@binkert.org env.TargetSignatures('content') 2098336Ssteve.reinhardt@amd.com 2108336Ssteve.reinhardt@amd.com# M5_PLY is used by isa_parser.py to find the PLY package. 2118336Ssteve.reinhardt@amd.comenv.Append(ENV = { 'M5_PLY' : Dir('ext/ply') }) 2128336Ssteve.reinhardt@amd.comenv['GCC'] = False 2134678Snate@binkert.orgenv['SUNCC'] = False 2148336Ssteve.reinhardt@amd.comenv['ICC'] = False 2158336Ssteve.reinhardt@amd.comenv['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True, 2168336Ssteve.reinhardt@amd.com stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 2174678Snate@binkert.org close_fds=True).communicate()[0].find('GCC') >= 0 2184678Snate@binkert.orgenv['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 2194678Snate@binkert.org stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 2204678Snate@binkert.org close_fds=True).communicate()[0].find('Sun C++') >= 0 2217827Snate@binkert.orgenv['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 2227827Snate@binkert.org stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 2238336Ssteve.reinhardt@amd.com close_fds=True).communicate()[0].find('Intel') >= 0 2244678Snate@binkert.orgif env['GCC'] + env['SUNCC'] + env['ICC'] > 1: 2258336Ssteve.reinhardt@amd.com print 'Error: How can we have two at the same time?' 2268336Ssteve.reinhardt@amd.com Exit(1) 2278336Ssteve.reinhardt@amd.com 2288336Ssteve.reinhardt@amd.com 2298336Ssteve.reinhardt@amd.com# Set up default C++ compiler flags 2308336Ssteve.reinhardt@amd.comif env['GCC']: 2315871Snate@binkert.org env.Append(CCFLAGS='-pipe') 2325871Snate@binkert.org env.Append(CCFLAGS='-fno-strict-aliasing') 2338336Ssteve.reinhardt@amd.com env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef')) 2348336Ssteve.reinhardt@amd.comelif env['ICC']: 2358336Ssteve.reinhardt@amd.com pass #Fix me... add warning flags once we clean up icc warnings 2368336Ssteve.reinhardt@amd.comelif env['SUNCC']: 2378336Ssteve.reinhardt@amd.com env.Append(CCFLAGS='-Qoption ccfe') 2385871Snate@binkert.org env.Append(CCFLAGS='-features=gcc') 2398336Ssteve.reinhardt@amd.com env.Append(CCFLAGS='-features=extensions') 2408336Ssteve.reinhardt@amd.com env.Append(CCFLAGS='-library=stlport4') 2418336Ssteve.reinhardt@amd.com env.Append(CCFLAGS='-xar') 2428336Ssteve.reinhardt@amd.com# env.Append(CCFLAGS='-instances=semiexplicit') 2438336Ssteve.reinhardt@amd.comelse: 2444678Snate@binkert.org print 'Error: Don\'t know what compiler options to use for your compiler.' 2455871Snate@binkert.org print ' Please fix SConstruct and src/SConscript and try again.' 2464678Snate@binkert.org Exit(1) 2478336Ssteve.reinhardt@amd.com 2488336Ssteve.reinhardt@amd.comif sys.platform == 'cygwin': 2498336Ssteve.reinhardt@amd.com # cygwin has some header file issues... 2508336Ssteve.reinhardt@amd.com env.Append(CCFLAGS=Split("-Wno-uninitialized")) 2518336Ssteve.reinhardt@amd.comenv.Append(CPPPATH=[Dir('ext/dnet')]) 2528336Ssteve.reinhardt@amd.com 2538336Ssteve.reinhardt@amd.com# Check for SWIG 2548336Ssteve.reinhardt@amd.comif not env.has_key('SWIG'): 2558336Ssteve.reinhardt@amd.com print 'Error: SWIG utility not found.' 2568336Ssteve.reinhardt@amd.com print ' Please install (see http://www.swig.org) and retry.' 2578336Ssteve.reinhardt@amd.com Exit(1) 2588336Ssteve.reinhardt@amd.com 2598336Ssteve.reinhardt@amd.com# Check for appropriate SWIG version 2608336Ssteve.reinhardt@amd.comswig_version = os.popen('swig -version').read().split() 2618336Ssteve.reinhardt@amd.com# First 3 words should be "SWIG Version x.y.z" 2628336Ssteve.reinhardt@amd.comif len(swig_version) < 3 or \ 2638336Ssteve.reinhardt@amd.com swig_version[0] != 'SWIG' or swig_version[1] != 'Version': 2645871Snate@binkert.org print 'Error determining SWIG version.' 2656121Snate@binkert.org Exit(1) 266955SN/A 267955SN/Amin_swig_version = '1.3.28' 2682632Sstever@eecs.umich.eduif compare_versions(swig_version[2], min_swig_version) < 0: 2692632Sstever@eecs.umich.edu print 'Error: SWIG version', min_swig_version, 'or newer required.' 270955SN/A print ' Installed version:', swig_version[2] 271955SN/A Exit(1) 272955SN/A 273955SN/A# Set up SWIG flags & scanner 2748878Ssteve.reinhardt@amd.comswig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS') 275955SN/Aenv.Append(SWIGFLAGS=swig_flags) 2762632Sstever@eecs.umich.edu 2772632Sstever@eecs.umich.edu# filter out all existing swig scanners, they mess up the dependency 2782632Sstever@eecs.umich.edu# stuff for some reason 2792632Sstever@eecs.umich.eduscanners = [] 2802632Sstever@eecs.umich.edufor scanner in env['SCANNERS']: 2812632Sstever@eecs.umich.edu skeys = scanner.skeys 2822632Sstever@eecs.umich.edu if skeys == '.i': 2838268Ssteve.reinhardt@amd.com continue 2848268Ssteve.reinhardt@amd.com 2858268Ssteve.reinhardt@amd.com if isinstance(skeys, (list, tuple)) and '.i' in skeys: 2868268Ssteve.reinhardt@amd.com continue 2878268Ssteve.reinhardt@amd.com 2888268Ssteve.reinhardt@amd.com scanners.append(scanner) 2898268Ssteve.reinhardt@amd.com 2902632Sstever@eecs.umich.edu# add the new swig scanner that we like better 2912632Sstever@eecs.umich.edufrom SCons.Scanner import ClassicCPP as CPPScanner 2922632Sstever@eecs.umich.eduswig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")' 2932632Sstever@eecs.umich.eduscanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re)) 2948268Ssteve.reinhardt@amd.com 2952632Sstever@eecs.umich.edu# replace the scanners list that has what we want 2968268Ssteve.reinhardt@amd.comenv['SCANNERS'] = scanners 2978268Ssteve.reinhardt@amd.com 2988268Ssteve.reinhardt@amd.com# Platform-specific configuration. Note again that we assume that all 2998268Ssteve.reinhardt@amd.com# builds under a given build root run on the same host platform. 3003718Sstever@eecs.umich.educonf = Configure(env, 3012634Sstever@eecs.umich.edu conf_dir = joinpath(build_root, '.scons_config'), 3022634Sstever@eecs.umich.edu log_file = joinpath(build_root, 'scons_config.log')) 3035863Snate@binkert.org 3042638Sstever@eecs.umich.edu# Find Python include and library directories for embedding the 3058268Ssteve.reinhardt@amd.com# interpreter. For consistency, we will use the same Python 3062632Sstever@eecs.umich.edu# installation used to run scons (and thus this script). If you want 3072632Sstever@eecs.umich.edu# to link in an alternate version, see above for instructions on how 3082632Sstever@eecs.umich.edu# to invoke scons with a different copy of the Python interpreter. 3092632Sstever@eecs.umich.edu 3102632Sstever@eecs.umich.edu# Get brief Python version name (e.g., "python2.4") for locating 3111858SN/A# include & library files 3123716Sstever@eecs.umich.edupy_version_name = 'python' + sys.version[:3] 3132638Sstever@eecs.umich.edu 3142638Sstever@eecs.umich.edu# include path, e.g. /usr/local/include/python2.4 3152638Sstever@eecs.umich.edupy_header_path = joinpath(sys.exec_prefix, 'include', py_version_name) 3162638Sstever@eecs.umich.eduenv.Append(CPPPATH = py_header_path) 3172638Sstever@eecs.umich.edu# verify that it works 3182638Sstever@eecs.umich.eduif not conf.CheckHeader('Python.h', '<>'): 3192638Sstever@eecs.umich.edu print "Error: can't find Python.h header in", py_header_path 3205863Snate@binkert.org Exit(1) 3215863Snate@binkert.org 3225863Snate@binkert.org# add library path too if it's not in the default place 323955SN/Apy_lib_path = None 3245341Sstever@gmail.comif sys.exec_prefix != '/usr': 3255341Sstever@gmail.com py_lib_path = joinpath(sys.exec_prefix, 'lib') 3265863Snate@binkert.orgelif sys.platform == 'cygwin': 3277756SAli.Saidi@ARM.com # cygwin puts the .dll in /bin for some reason 3285341Sstever@gmail.com py_lib_path = '/bin' 3296121Snate@binkert.orgif py_lib_path: 3304494Ssaidi@eecs.umich.edu env.Append(LIBPATH = py_lib_path) 3316121Snate@binkert.org print 'Adding', py_lib_path, 'to LIBPATH for', py_version_name 3321105SN/Aif not conf.CheckLib(py_version_name): 3332667Sstever@eecs.umich.edu print "Error: can't find Python library", py_version_name 3342667Sstever@eecs.umich.edu Exit(1) 3352667Sstever@eecs.umich.edu 3362667Sstever@eecs.umich.edu# On Solaris you need to use libsocket for socket ops 3376121Snate@binkert.orgif not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'): 3382667Sstever@eecs.umich.edu if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'): 3395341Sstever@gmail.com print "Can't find library with socket calls (e.g. accept())" 3405863Snate@binkert.org Exit(1) 3415341Sstever@gmail.com 3425341Sstever@gmail.com# Check for zlib. If the check passes, libz will be automatically 3435341Sstever@gmail.com# added to the LIBS environment variable. 3448120Sgblack@eecs.umich.eduif not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'): 3455341Sstever@gmail.com print 'Error: did not find needed zlib compression library '\ 3468120Sgblack@eecs.umich.edu 'and/or zlib.h header file.' 3475341Sstever@gmail.com print ' Please install zlib and try again.' 3488120Sgblack@eecs.umich.edu Exit(1) 3496121Snate@binkert.org 3506121Snate@binkert.org# Check for <fenv.h> (C99 FP environment control) 3518980Ssteve.reinhardt@amd.comhave_fenv = conf.CheckHeader('fenv.h', '<>') 3525397Ssaidi@eecs.umich.eduif not have_fenv: 3535397Ssaidi@eecs.umich.edu print "Warning: Header file <fenv.h> not found." 3547727SAli.Saidi@ARM.com print " This host has no IEEE FP rounding mode control." 3558268Ssteve.reinhardt@amd.com 3566168Snate@binkert.org# Check for mysql. 3575341Sstever@gmail.commysql_config = WhereIs('mysql_config') 3588120Sgblack@eecs.umich.eduhave_mysql = mysql_config != None 3598120Sgblack@eecs.umich.edu 3608120Sgblack@eecs.umich.edu# Check MySQL version. 3616814Sgblack@eecs.umich.eduif have_mysql: 3625863Snate@binkert.org mysql_version = os.popen(mysql_config + ' --version').read() 3638120Sgblack@eecs.umich.edu min_mysql_version = '4.1' 3645341Sstever@gmail.com if compare_versions(mysql_version, min_mysql_version) < 0: 3655863Snate@binkert.org print 'Warning: MySQL', min_mysql_version, 'or newer required.' 3668268Ssteve.reinhardt@amd.com print ' Version', mysql_version, 'detected.' 3676121Snate@binkert.org have_mysql = False 3686121Snate@binkert.org 3698268Ssteve.reinhardt@amd.com# Set up mysql_config commands. 3705742Snate@binkert.orgif have_mysql: 3715742Snate@binkert.org mysql_config_include = mysql_config + ' --include' 3725341Sstever@gmail.com if os.system(mysql_config_include + ' > /dev/null') != 0: 3735742Snate@binkert.org # older mysql_config versions don't support --include, use 3745742Snate@binkert.org # --cflags instead 3755341Sstever@gmail.com mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g' 3766017Snate@binkert.org # This seems to work in all versions 3776121Snate@binkert.org mysql_config_libs = mysql_config + ' --libs' 3786017Snate@binkert.org 3797816Ssteve.reinhardt@amd.comenv = conf.Finish() 3807756SAli.Saidi@ARM.com 3817756SAli.Saidi@ARM.com# Define the universe of supported ISAs 3827756SAli.Saidi@ARM.comall_isa_list = [ ] 3837756SAli.Saidi@ARM.comExport('all_isa_list') 3847756SAli.Saidi@ARM.com 3857756SAli.Saidi@ARM.com# Define the universe of supported CPU models 3867756SAli.Saidi@ARM.comall_cpu_list = [ ] 3877756SAli.Saidi@ARM.comdefault_cpus = [ ] 3887816Ssteve.reinhardt@amd.comExport('all_cpu_list', 'default_cpus') 3897816Ssteve.reinhardt@amd.com 3907816Ssteve.reinhardt@amd.com# Sticky options get saved in the options file so they persist from 3917816Ssteve.reinhardt@amd.com# one invocation to the next (unless overridden, in which case the new 3927816Ssteve.reinhardt@amd.com# value becomes sticky). 3937816Ssteve.reinhardt@amd.comsticky_opts = Options(args=ARGUMENTS) 3947816Ssteve.reinhardt@amd.comExport('sticky_opts') 3957816Ssteve.reinhardt@amd.com 3967816Ssteve.reinhardt@amd.com# Non-sticky options only apply to the current build. 3977816Ssteve.reinhardt@amd.comnonsticky_opts = Options(args=ARGUMENTS) 3987756SAli.Saidi@ARM.comExport('nonsticky_opts') 3997816Ssteve.reinhardt@amd.com 4007816Ssteve.reinhardt@amd.com# Walk the tree and execute all SConsopts scripts that wil add to the 4017816Ssteve.reinhardt@amd.com# above options 4027816Ssteve.reinhardt@amd.comfor root, dirs, files in os.walk('.'): 4037816Ssteve.reinhardt@amd.com if 'SConsopts' in files: 4047816Ssteve.reinhardt@amd.com SConscript(os.path.join(root, 'SConsopts')) 4057816Ssteve.reinhardt@amd.com 4067816Ssteve.reinhardt@amd.comall_isa_list.sort() 4077816Ssteve.reinhardt@amd.comall_cpu_list.sort() 4087816Ssteve.reinhardt@amd.comdefault_cpus.sort() 4097816Ssteve.reinhardt@amd.com 4107816Ssteve.reinhardt@amd.comsticky_opts.AddOptions( 4117816Ssteve.reinhardt@amd.com EnumOption('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list), 4127816Ssteve.reinhardt@amd.com BoolOption('FULL_SYSTEM', 'Full-system support', False), 4137816Ssteve.reinhardt@amd.com # There's a bug in scons 0.96.1 that causes ListOptions with list 4147816Ssteve.reinhardt@amd.com # values (more than one value) not to be able to be restored from 4157816Ssteve.reinhardt@amd.com # a saved option file. If this causes trouble then upgrade to 4167816Ssteve.reinhardt@amd.com # scons 0.96.90 or later. 4177816Ssteve.reinhardt@amd.com ListOption('CPU_MODELS', 'CPU models', default_cpus, all_cpu_list), 4187816Ssteve.reinhardt@amd.com BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False), 4197816Ssteve.reinhardt@amd.com BoolOption('EFENCE', 'Link with Electric Fence malloc debugger', 4207816Ssteve.reinhardt@amd.com False), 4217816Ssteve.reinhardt@amd.com BoolOption('SS_COMPATIBLE_FP', 4227816Ssteve.reinhardt@amd.com 'Make floating-point results compatible with SimpleScalar', 4237816Ssteve.reinhardt@amd.com False), 4247816Ssteve.reinhardt@amd.com BoolOption('USE_SSE2', 4257816Ssteve.reinhardt@amd.com 'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts', 4267816Ssteve.reinhardt@amd.com False), 4277816Ssteve.reinhardt@amd.com BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), 4287816Ssteve.reinhardt@amd.com BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 4297816Ssteve.reinhardt@amd.com BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False), 4307816Ssteve.reinhardt@amd.com ('CC', 'C compiler', os.environ.get('CC', env['CC'])), 4317816Ssteve.reinhardt@amd.com ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])), 4327816Ssteve.reinhardt@amd.com BoolOption('BATCH', 'Use batch pool for build and tests', False), 4337816Ssteve.reinhardt@amd.com ('BATCH_CMD', 'Batch pool submission command name', 'qdo'), 4347816Ssteve.reinhardt@amd.com ('PYTHONHOME', 4357816Ssteve.reinhardt@amd.com 'Override the default PYTHONHOME for this system (use with caution)', 4367816Ssteve.reinhardt@amd.com '%s:%s' % (sys.prefix, sys.exec_prefix)) 4377816Ssteve.reinhardt@amd.com ) 4387816Ssteve.reinhardt@amd.com 4397816Ssteve.reinhardt@amd.comnonsticky_opts.AddOptions( 4407816Ssteve.reinhardt@amd.com BoolOption('update_ref', 'Update test reference outputs', False) 4417816Ssteve.reinhardt@amd.com ) 4427816Ssteve.reinhardt@amd.com 4437816Ssteve.reinhardt@amd.com# These options get exported to #defines in config/*.hh (see src/SConscript). 4447816Ssteve.reinhardt@amd.comenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ 4457816Ssteve.reinhardt@amd.com 'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \ 4467816Ssteve.reinhardt@amd.com 'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA'] 4477816Ssteve.reinhardt@amd.com 4487816Ssteve.reinhardt@amd.com# Define a handy 'no-op' action 4497816Ssteve.reinhardt@amd.comdef no_action(target, source, env): 4507816Ssteve.reinhardt@amd.com return 0 4517816Ssteve.reinhardt@amd.com 4527816Ssteve.reinhardt@amd.comenv.NoAction = Action(no_action, None) 4537816Ssteve.reinhardt@amd.com 4547816Ssteve.reinhardt@amd.com################################################### 4557816Ssteve.reinhardt@amd.com# 4567816Ssteve.reinhardt@amd.com# Define a SCons builder for configuration flag headers. 4577816Ssteve.reinhardt@amd.com# 4587816Ssteve.reinhardt@amd.com################################################### 4597816Ssteve.reinhardt@amd.com 4608947Sandreas.hansson@arm.com# This function generates a config header file that #defines the 4618947Sandreas.hansson@arm.com# option symbol to the current option setting (0 or 1). The source 4627756SAli.Saidi@ARM.com# operands are the name of the option and a Value node containing the 4638120Sgblack@eecs.umich.edu# value of the option. 4647756SAli.Saidi@ARM.comdef build_config_file(target, source, env): 4657756SAli.Saidi@ARM.com (option, value) = [s.get_contents() for s in source] 4667756SAli.Saidi@ARM.com f = file(str(target[0]), 'w') 4677756SAli.Saidi@ARM.com print >> f, '#define', option, value 4687816Ssteve.reinhardt@amd.com f.close() 4697816Ssteve.reinhardt@amd.com return None 4707816Ssteve.reinhardt@amd.com 4717816Ssteve.reinhardt@amd.com# Generate the message to be printed when building the config file. 4727816Ssteve.reinhardt@amd.comdef build_config_file_string(target, source, env): 4737816Ssteve.reinhardt@amd.com (option, value) = [s.get_contents() for s in source] 4747816Ssteve.reinhardt@amd.com return "Defining %s as %s in %s." % (option, value, target[0]) 4757816Ssteve.reinhardt@amd.com 4767816Ssteve.reinhardt@amd.com# Combine the two functions into a scons Action object. 4777816Ssteve.reinhardt@amd.comconfig_action = Action(build_config_file, build_config_file_string) 4787756SAli.Saidi@ARM.com 4797756SAli.Saidi@ARM.com# The emitter munges the source & target node lists to reflect what 4806654Snate@binkert.org# we're really doing. 4816654Snate@binkert.orgdef config_emitter(target, source, env): 4825871Snate@binkert.org # extract option name from Builder arg 4836121Snate@binkert.org option = str(target[0]) 4846121Snate@binkert.org # True target is config header file 4856121Snate@binkert.org target = joinpath('config', option.lower() + '.hh') 4868946Sandreas.hansson@arm.com val = env[option] 4878737Skoansin.tan@gmail.com if isinstance(val, bool): 4883940Ssaidi@eecs.umich.edu # Force value to 0/1 4893918Ssaidi@eecs.umich.edu val = int(val) 4903918Ssaidi@eecs.umich.edu elif isinstance(val, str): 4911858SN/A val = '"' + val + '"' 4926121Snate@binkert.org 4937739Sgblack@eecs.umich.edu # Sources are option name & value (packaged in SCons Value nodes) 4947739Sgblack@eecs.umich.edu return ([target], [Value(option), Value(val)]) 4956143Snate@binkert.org 4967618SAli.Saidi@arm.comconfig_builder = Builder(emitter = config_emitter, action = config_action) 4977618SAli.Saidi@arm.com 4987618SAli.Saidi@arm.comenv.Append(BUILDERS = { 'ConfigFile' : config_builder }) 4997618SAli.Saidi@arm.com 5008614Sgblack@eecs.umich.edu################################################### 5017618SAli.Saidi@arm.com# 5027618SAli.Saidi@arm.com# Define a SCons builder for copying files. This is used by the 5037618SAli.Saidi@arm.com# Python zipfile code in src/python/SConscript, but is placed up here 5047739Sgblack@eecs.umich.edu# since it's potentially more generally applicable. 5058946Sandreas.hansson@arm.com# 5068946Sandreas.hansson@arm.com################################################### 5076121Snate@binkert.org 5083940Ssaidi@eecs.umich.educopy_builder = Builder(action = Copy("$TARGET", "$SOURCE")) 5096121Snate@binkert.org 5107739Sgblack@eecs.umich.eduenv.Append(BUILDERS = { 'CopyFile' : copy_builder }) 5117739Sgblack@eecs.umich.edu 5127739Sgblack@eecs.umich.edu################################################### 5137739Sgblack@eecs.umich.edu# 5147739Sgblack@eecs.umich.edu# Define a simple SCons builder to concatenate files. 5157739Sgblack@eecs.umich.edu# 5168737Skoansin.tan@gmail.com# Used to append the Python zip archive to the executable. 5178737Skoansin.tan@gmail.com# 5188737Skoansin.tan@gmail.com################################################### 5198737Skoansin.tan@gmail.com 5208737Skoansin.tan@gmail.comconcat_builder = Builder(action = Action(['cat $SOURCES > $TARGET', 5218737Skoansin.tan@gmail.com 'chmod +x $TARGET'])) 5228737Skoansin.tan@gmail.com 5238737Skoansin.tan@gmail.comenv.Append(BUILDERS = { 'Concat' : concat_builder }) 5248737Skoansin.tan@gmail.com 5258737Skoansin.tan@gmail.com 5268737Skoansin.tan@gmail.com# base help text 5278737Skoansin.tan@gmail.comhelp_text = ''' 5288737Skoansin.tan@gmail.comUsage: scons [scons options] [build options] [target(s)] 5298737Skoansin.tan@gmail.com 5308737Skoansin.tan@gmail.com''' 5318737Skoansin.tan@gmail.com 5328737Skoansin.tan@gmail.com# libelf build is shared across all configs in the build root. 5338737Skoansin.tan@gmail.comenv.SConscript('ext/libelf/SConscript', 5348946Sandreas.hansson@arm.com build_dir = joinpath(build_root, 'libelf'), 5358946Sandreas.hansson@arm.com exports = 'env') 5368946Sandreas.hansson@arm.com 5378946Sandreas.hansson@arm.com################################################### 5388946Sandreas.hansson@arm.com# 5398946Sandreas.hansson@arm.com# This function is used to set up a directory with switching headers 5403918Ssaidi@eecs.umich.edu# 5413918Ssaidi@eecs.umich.edu################################################### 5423940Ssaidi@eecs.umich.edu 5433918Ssaidi@eecs.umich.eduenv['ALL_ISA_LIST'] = all_isa_list 5443918Ssaidi@eecs.umich.edudef make_switching_dir(dirname, switch_headers, env): 5456157Snate@binkert.org # Generate the header. target[0] is the full path of the output 5466157Snate@binkert.org # header to generate. 'source' is a dummy variable, since we get the 5476157Snate@binkert.org # list of ISAs from env['ALL_ISA_LIST']. 5486157Snate@binkert.org def gen_switch_hdr(target, source, env): 5495397Ssaidi@eecs.umich.edu fname = str(target[0]) 5505397Ssaidi@eecs.umich.edu basename = os.path.basename(fname) 5516121Snate@binkert.org f = open(fname, 'w') 5526121Snate@binkert.org f.write('#include "arch/isa_specific.hh"\n') 5536121Snate@binkert.org cond = '#if' 5546121Snate@binkert.org for isa in all_isa_list: 5556121Snate@binkert.org f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n' 5566121Snate@binkert.org % (cond, isa.upper(), dirname, isa, basename)) 5575397Ssaidi@eecs.umich.edu cond = '#elif' 5581851SN/A f.write('#else\n#error "THE_ISA not set"\n#endif\n') 5591851SN/A f.close() 5607739Sgblack@eecs.umich.edu return 0 561955SN/A 5623053Sstever@eecs.umich.edu # String to print when generating header 5636121Snate@binkert.org def gen_switch_hdr_string(target, source, env): 5643053Sstever@eecs.umich.edu return "Generating switch header " + str(target[0]) 5653053Sstever@eecs.umich.edu 5663053Sstever@eecs.umich.edu # Build SCons Action object. 'varlist' specifies env vars that this 5673053Sstever@eecs.umich.edu # action depends on; when env['ALL_ISA_LIST'] changes these actions 5683053Sstever@eecs.umich.edu # should get re-executed. 5696654Snate@binkert.org switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string, 5703053Sstever@eecs.umich.edu varlist=['ALL_ISA_LIST']) 5714742Sstever@eecs.umich.edu 5724742Sstever@eecs.umich.edu # Instantiate actions for each header 5733053Sstever@eecs.umich.edu for hdr in switch_headers: 5743053Sstever@eecs.umich.edu env.Command(hdr, [], switch_hdr_action) 5753053Sstever@eecs.umich.eduExport('make_switching_dir') 5768960Ssteve.reinhardt@amd.com 5776654Snate@binkert.org################################################### 5783053Sstever@eecs.umich.edu# 5793053Sstever@eecs.umich.edu# Define build environments for selected configurations. 5803053Sstever@eecs.umich.edu# 5813053Sstever@eecs.umich.edu################################################### 5822667Sstever@eecs.umich.edu 5834554Sbinkertn@umich.edu# rename base env 5846121Snate@binkert.orgbase_env = env 5852667Sstever@eecs.umich.edu 5864554Sbinkertn@umich.edufor build_path in build_paths: 5874554Sbinkertn@umich.edu print "Building in", build_path 5884554Sbinkertn@umich.edu # build_dir is the tail component of build path, and is used to 5896121Snate@binkert.org # determine the build parameters (e.g., 'ALPHA_SE') 5904554Sbinkertn@umich.edu (build_root, build_dir) = os.path.split(build_path) 5914554Sbinkertn@umich.edu # Make a copy of the build-root environment to use for this config. 5924554Sbinkertn@umich.edu env = base_env.Copy() 5934781Snate@binkert.org 5944554Sbinkertn@umich.edu # Set env options according to the build directory config. 5954554Sbinkertn@umich.edu sticky_opts.files = [] 5962667Sstever@eecs.umich.edu # Options for $BUILD_ROOT/$BUILD_DIR are stored in 5974554Sbinkertn@umich.edu # $BUILD_ROOT/options/$BUILD_DIR so you can nuke 5984554Sbinkertn@umich.edu # $BUILD_ROOT/$BUILD_DIR without losing your options settings. 5994554Sbinkertn@umich.edu current_opts_file = joinpath(build_root, 'options', build_dir) 6004554Sbinkertn@umich.edu if os.path.isfile(current_opts_file): 6012667Sstever@eecs.umich.edu sticky_opts.files.append(current_opts_file) 6024554Sbinkertn@umich.edu print "Using saved options file %s" % current_opts_file 6032667Sstever@eecs.umich.edu else: 6044554Sbinkertn@umich.edu # Build dir-specific options file doesn't exist. 6056121Snate@binkert.org 6062667Sstever@eecs.umich.edu # Make sure the directory is there so we can create it later 6075522Snate@binkert.org opt_dir = os.path.dirname(current_opts_file) 6085522Snate@binkert.org if not os.path.isdir(opt_dir): 6095522Snate@binkert.org os.mkdir(opt_dir) 6105522Snate@binkert.org 6115522Snate@binkert.org # Get default build options from source tree. Options are 6125522Snate@binkert.org # normally determined by name of $BUILD_DIR, but can be 6135522Snate@binkert.org # overriden by 'default=' arg on command line. 6145522Snate@binkert.org default_opts_file = joinpath('build_opts', 6155522Snate@binkert.org ARGUMENTS.get('default', build_dir)) 6165522Snate@binkert.org if os.path.isfile(default_opts_file): 6175522Snate@binkert.org sticky_opts.files.append(default_opts_file) 6185522Snate@binkert.org print "Options file %s not found,\n using defaults in %s" \ 6195522Snate@binkert.org % (current_opts_file, default_opts_file) 6205522Snate@binkert.org else: 6215522Snate@binkert.org print "Error: cannot find options file %s or %s" \ 6225522Snate@binkert.org % (current_opts_file, default_opts_file) 6235522Snate@binkert.org Exit(1) 6245522Snate@binkert.org 6255522Snate@binkert.org # Apply current option settings to env 6265522Snate@binkert.org sticky_opts.Update(env) 6275522Snate@binkert.org nonsticky_opts.Update(env) 6285522Snate@binkert.org 6295522Snate@binkert.org help_text += "Sticky options for %s:\n" % build_dir \ 6305522Snate@binkert.org + sticky_opts.GenerateHelpText(env) \ 6315522Snate@binkert.org + "\nNon-sticky options for %s:\n" % build_dir \ 6325522Snate@binkert.org + nonsticky_opts.GenerateHelpText(env) 6332638Sstever@eecs.umich.edu 6342638Sstever@eecs.umich.edu # Process option settings. 6356121Snate@binkert.org 6363716Sstever@eecs.umich.edu if not have_fenv and env['USE_FENV']: 6375522Snate@binkert.org print "Warning: <fenv.h> not available; " \ 6385522Snate@binkert.org "forcing USE_FENV to False in", build_dir + "." 6395522Snate@binkert.org env['USE_FENV'] = False 6405522Snate@binkert.org 6415522Snate@binkert.org if not env['USE_FENV']: 6425522Snate@binkert.org print "Warning: No IEEE FP rounding mode control in", build_dir + "." 6431858SN/A print " FP results may deviate slightly from other platforms." 6445227Ssaidi@eecs.umich.edu 6455227Ssaidi@eecs.umich.edu if env['EFENCE']: 6465227Ssaidi@eecs.umich.edu env.Append(LIBS=['efence']) 6475227Ssaidi@eecs.umich.edu 6486654Snate@binkert.org if env['USE_MYSQL']: 6496654Snate@binkert.org if not have_mysql: 6507769SAli.Saidi@ARM.com print "Warning: MySQL not available; " \ 6517769SAli.Saidi@ARM.com "forcing USE_MYSQL to False in", build_dir + "." 6527769SAli.Saidi@ARM.com env['USE_MYSQL'] = False 6537769SAli.Saidi@ARM.com else: 6545227Ssaidi@eecs.umich.edu print "Compiling in", build_dir, "with MySQL support." 6555227Ssaidi@eecs.umich.edu env.ParseConfig(mysql_config_libs) 6565227Ssaidi@eecs.umich.edu env.ParseConfig(mysql_config_include) 6575204Sstever@gmail.com 6585204Sstever@gmail.com # Save sticky option settings back to current options file 6595204Sstever@gmail.com sticky_opts.Save(current_opts_file, env) 6605204Sstever@gmail.com 6615204Sstever@gmail.com # Do this after we save setting back, or else we'll tack on an 6625204Sstever@gmail.com # extra 'qdo' every time we run scons. 6635204Sstever@gmail.com if env['BATCH']: 6645204Sstever@gmail.com env['CC'] = env['BATCH_CMD'] + ' ' + env['CC'] 6655204Sstever@gmail.com env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX'] 6665204Sstever@gmail.com 6675204Sstever@gmail.com if env['USE_SSE2']: 6685204Sstever@gmail.com env.Append(CCFLAGS='-msse2') 6695204Sstever@gmail.com 6705204Sstever@gmail.com # The src/SConscript file sets up the build rules in 'env' according 6715204Sstever@gmail.com # to the configured options. It returns a list of environments, 6725204Sstever@gmail.com # one for each variant build (debug, opt, etc.) 6735204Sstever@gmail.com envList = SConscript('src/SConscript', build_dir = build_path, 6746121Snate@binkert.org exports = 'env') 6755204Sstever@gmail.com 6763118Sstever@eecs.umich.edu # Set up the regression tests for each build. 6773118Sstever@eecs.umich.edu for e in envList: 6783118Sstever@eecs.umich.edu SConscript('tests/SConscript', 6793118Sstever@eecs.umich.edu build_dir = joinpath(build_path, 'tests', e.Label), 6803118Sstever@eecs.umich.edu exports = { 'env' : e }, duplicate = False) 6815863Snate@binkert.org 6823118Sstever@eecs.umich.eduHelp(help_text) 6835863Snate@binkert.org 6843118Sstever@eecs.umich.edu 6857457Snate@binkert.org################################################### 6867457Snate@binkert.org# 6875863Snate@binkert.org# Let SCons do its thing. At this point SCons will use the defined 6885863Snate@binkert.org# build environments to build the requested targets. 6895863Snate@binkert.org# 6905863Snate@binkert.org################################################### 6915863Snate@binkert.org 6925863Snate@binkert.org