SConstruct revision 9590
1955SN/A# -*- mode:python -*- 2955SN/A 35871Snate@binkert.org# Copyright (c) 2011 Advanced Micro Devices, Inc. 41762SN/A# Copyright (c) 2009 The Hewlett-Packard Development Company 5955SN/A# Copyright (c) 2004-2005 The Regents of The University of Michigan 6955SN/A# All rights reserved. 7955SN/A# 8955SN/A# Redistribution and use in source and binary forms, with or without 9955SN/A# modification, are permitted provided that the following conditions are 10955SN/A# met: redistributions of source code must retain the above copyright 11955SN/A# notice, this list of conditions and the following disclaimer; 12955SN/A# redistributions in binary form must reproduce the above copyright 13955SN/A# notice, this list of conditions and the following disclaimer in the 14955SN/A# documentation and/or other materials provided with the distribution; 15955SN/A# neither the name of the copyright holders nor the names of its 16955SN/A# contributors may be used to endorse or promote products derived from 17955SN/A# this software without specific prior written permission. 18955SN/A# 19955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21955SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22955SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23955SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24955SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25955SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26955SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27955SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28955SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 292665Ssaidi@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 302665Ssaidi@eecs.umich.edu# 315863Snate@binkert.org# Authors: Steve Reinhardt 32955SN/A# Nathan Binkert 33955SN/A 34955SN/A################################################### 35955SN/A# 36955SN/A# SCons top-level build description (SConstruct) file. 372632Sstever@eecs.umich.edu# 382632Sstever@eecs.umich.edu# While in this directory ('gem5'), just type 'scons' to build the default 392632Sstever@eecs.umich.edu# configuration (see below), or type 'scons build/<CONFIG>/<binary>' 402632Sstever@eecs.umich.edu# to build some other configuration (e.g., 'build/ALPHA/gem5.opt' for 41955SN/A# the optimized full-system version). 422632Sstever@eecs.umich.edu# 432632Sstever@eecs.umich.edu# You can build gem5 in a different directory as long as there is a 442761Sstever@eecs.umich.edu# 'build/<CONFIG>' somewhere along the target path. The build system 452632Sstever@eecs.umich.edu# expects that all configs under the same build directory are being 462632Sstever@eecs.umich.edu# built for the same host system. 472632Sstever@eecs.umich.edu# 482761Sstever@eecs.umich.edu# Examples: 492761Sstever@eecs.umich.edu# 502761Sstever@eecs.umich.edu# The following two commands are equivalent. The '-u' option tells 512632Sstever@eecs.umich.edu# scons to search up the directory tree for this SConstruct file. 522632Sstever@eecs.umich.edu# % cd <path-to-src>/gem5 ; scons build/ALPHA/gem5.debug 532761Sstever@eecs.umich.edu# % cd <path-to-src>/gem5/build/ALPHA; scons -u gem5.debug 542761Sstever@eecs.umich.edu# 552761Sstever@eecs.umich.edu# The following two commands are equivalent and demonstrate building 562761Sstever@eecs.umich.edu# in a directory outside of the source tree. The '-C' option tells 572761Sstever@eecs.umich.edu# scons to chdir to the specified directory to find this SConstruct 582632Sstever@eecs.umich.edu# file. 592632Sstever@eecs.umich.edu# % cd <path-to-src>/gem5 ; scons /local/foo/build/ALPHA/gem5.debug 602632Sstever@eecs.umich.edu# % cd /local/foo/build/ALPHA; scons -C <path-to-src>/gem5 gem5.debug 612632Sstever@eecs.umich.edu# 622632Sstever@eecs.umich.edu# You can use 'scons -H' to print scons options. If you're in this 632632Sstever@eecs.umich.edu# 'gem5' directory (or use -u or -C to tell scons where to find this 642632Sstever@eecs.umich.edu# file), you can use 'scons -h' to print all the gem5-specific build 65955SN/A# options as well. 66955SN/A# 67955SN/A################################################### 685863Snate@binkert.org 695863Snate@binkert.org# Check for recent-enough Python and SCons versions. 705863Snate@binkert.orgtry: 715863Snate@binkert.org # Really old versions of scons only take two options for the 725863Snate@binkert.org # function, so check once without the revision and once with the 735863Snate@binkert.org # revision, the first instance will fail for stuff other than 745863Snate@binkert.org # 0.98, and the second will fail for 0.98.0 755863Snate@binkert.org EnsureSConsVersion(0, 98) 765863Snate@binkert.org EnsureSConsVersion(0, 98, 1) 775863Snate@binkert.orgexcept SystemExit, e: 785863Snate@binkert.org print """ 795863Snate@binkert.orgFor more details, see: 805863Snate@binkert.org http://gem5.org/Dependencies 815863Snate@binkert.org""" 825863Snate@binkert.org raise 835863Snate@binkert.org 845863Snate@binkert.org# We ensure the python version early because we have stuff that 855863Snate@binkert.org# requires python 2.4 865863Snate@binkert.orgtry: 875863Snate@binkert.org EnsurePythonVersion(2, 4) 885863Snate@binkert.orgexcept SystemExit, e: 895863Snate@binkert.org print """ 905863Snate@binkert.orgYou can use a non-default installation of the Python interpreter by 915863Snate@binkert.orgeither (1) rearranging your PATH so that scons finds the non-default 925863Snate@binkert.org'python' first or (2) explicitly invoking an alternative interpreter 935863Snate@binkert.orgon the scons script. 945863Snate@binkert.org 955863Snate@binkert.orgFor more details, see: 965863Snate@binkert.org http://gem5.org/wiki/index.php/Using_a_non-default_Python_installation 975863Snate@binkert.org""" 985863Snate@binkert.org raise 99955SN/A 1005396Ssaidi@eecs.umich.edu# Global Python includes 1015863Snate@binkert.orgimport os 1025863Snate@binkert.orgimport re 1034202Sbinkertn@umich.eduimport subprocess 1045863Snate@binkert.orgimport sys 1055863Snate@binkert.org 1065863Snate@binkert.orgfrom os import mkdir, environ 1075863Snate@binkert.orgfrom os.path import abspath, basename, dirname, expanduser, normpath 108955SN/Afrom os.path import exists, isdir, isfile 1095273Sstever@gmail.comfrom os.path import join as joinpath, split as splitpath 1105871Snate@binkert.org 1115273Sstever@gmail.com# SCons includes 1125871Snate@binkert.orgimport SCons 1135863Snate@binkert.orgimport SCons.Node 1145863Snate@binkert.org 1155863Snate@binkert.orgextra_python_paths = [ 1165871Snate@binkert.org Dir('src/python').srcnode().abspath, # gem5 includes 1175872Snate@binkert.org Dir('ext/ply').srcnode().abspath, # ply is used by several files 1185872Snate@binkert.org ] 1195872Snate@binkert.org 1205871Snate@binkert.orgsys.path[1:1] = extra_python_paths 1215871Snate@binkert.org 1225871Snate@binkert.orgfrom m5.util import compareVersions, readCommand 1235871Snate@binkert.orgfrom m5.util.terminal import get_termcap 1245871Snate@binkert.org 1255871Snate@binkert.orghelp_texts = { 1265871Snate@binkert.org "options" : "", 1275871Snate@binkert.org "global_vars" : "", 1285871Snate@binkert.org "local_vars" : "" 1295871Snate@binkert.org} 1305871Snate@binkert.org 1315871Snate@binkert.orgExport("help_texts") 1325871Snate@binkert.org 1335871Snate@binkert.org 1345863Snate@binkert.org# There's a bug in scons in that (1) by default, the help texts from 1355227Ssaidi@eecs.umich.edu# AddOption() are supposed to be displayed when you type 'scons -h' 1365396Ssaidi@eecs.umich.edu# and (2) you can override the help displayed by 'scons -h' using the 1375396Ssaidi@eecs.umich.edu# Help() function, but these two features are incompatible: once 1385396Ssaidi@eecs.umich.edu# you've overridden the help text using Help(), there's no way to get 1395396Ssaidi@eecs.umich.edu# at the help texts from AddOptions. See: 1405396Ssaidi@eecs.umich.edu# http://scons.tigris.org/issues/show_bug.cgi?id=2356 1415396Ssaidi@eecs.umich.edu# http://scons.tigris.org/issues/show_bug.cgi?id=2611 1425396Ssaidi@eecs.umich.edu# This hack lets us extract the help text from AddOptions and 1435396Ssaidi@eecs.umich.edu# re-inject it via Help(). Ideally someday this bug will be fixed and 1445588Ssaidi@eecs.umich.edu# we can just use AddOption directly. 1455396Ssaidi@eecs.umich.edudef AddLocalOption(*args, **kwargs): 1465396Ssaidi@eecs.umich.edu col_width = 30 1475396Ssaidi@eecs.umich.edu 1485396Ssaidi@eecs.umich.edu help = " " + ", ".join(args) 1495396Ssaidi@eecs.umich.edu if "help" in kwargs: 1505396Ssaidi@eecs.umich.edu length = len(help) 1515396Ssaidi@eecs.umich.edu if length >= col_width: 1525396Ssaidi@eecs.umich.edu help += "\n" + " " * col_width 1535396Ssaidi@eecs.umich.edu else: 1545396Ssaidi@eecs.umich.edu help += " " * (col_width - length) 1555396Ssaidi@eecs.umich.edu help += kwargs["help"] 1565396Ssaidi@eecs.umich.edu help_texts["options"] += help + "\n" 1575396Ssaidi@eecs.umich.edu 1585396Ssaidi@eecs.umich.edu AddOption(*args, **kwargs) 1595871Snate@binkert.org 1605871Snate@binkert.orgAddLocalOption('--colors', dest='use_colors', action='store_true', 1616121Snate@binkert.org help="Add color to abbreviated scons output") 1625871Snate@binkert.orgAddLocalOption('--no-colors', dest='use_colors', action='store_false', 1635871Snate@binkert.org help="Don't add color to abbreviated scons output") 1646003Snate@binkert.orgAddLocalOption('--default', dest='default', type='string', action='store', 1656003Snate@binkert.org help='Override which build_opts file to use for defaults') 166955SN/AAddLocalOption('--ignore-style', dest='ignore_style', action='store_true', 1675871Snate@binkert.org help='Disable style checking hooks') 1685871Snate@binkert.orgAddLocalOption('--no-lto', dest='no_lto', action='store_true', 1695871Snate@binkert.org help='Disable Link-Time Optimization for fast') 1705871Snate@binkert.orgAddLocalOption('--update-ref', dest='update_ref', action='store_true', 171955SN/A help='Update test reference outputs') 1726121Snate@binkert.orgAddLocalOption('--verbose', dest='verbose', action='store_true', 1736121Snate@binkert.org help='Print full tool command lines') 1746121Snate@binkert.org 1751533SN/Atermcap = get_termcap(GetOption('use_colors')) 1765871Snate@binkert.org 1775871Snate@binkert.org######################################################################## 1785863Snate@binkert.org# 1795871Snate@binkert.org# Set up the main build environment. 1805871Snate@binkert.org# 1815871Snate@binkert.org######################################################################## 1825871Snate@binkert.orguse_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH', 1835871Snate@binkert.org 'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PYTHONPATH', 1845863Snate@binkert.org 'RANLIB', 'SWIG' ]) 1856121Snate@binkert.org 1865863Snate@binkert.orguse_prefixes = [ 1875871Snate@binkert.org "M5", # M5 configuration (e.g., path to kernels) 1884678Snate@binkert.org "DISTCC_", # distcc (distributed compiler wrapper) configuration 1894678Snate@binkert.org "CCACHE_", # ccache (caching compiler wrapper) configuration 1904678Snate@binkert.org "CCC_", # clang static analyzer configuration 1914678Snate@binkert.org ] 1924678Snate@binkert.org 1934678Snate@binkert.orguse_env = {} 1944678Snate@binkert.orgfor key,val in os.environ.iteritems(): 1954678Snate@binkert.org if key in use_vars or \ 1964678Snate@binkert.org any([key.startswith(prefix) for prefix in use_prefixes]): 1974678Snate@binkert.org use_env[key] = val 1984678Snate@binkert.org 1994678Snate@binkert.orgmain = Environment(ENV=use_env) 2006121Snate@binkert.orgmain.Decider('MD5-timestamp') 2014678Snate@binkert.orgmain.root = Dir(".") # The current directory (where this file lives). 2025871Snate@binkert.orgmain.srcdir = Dir("src") # The source directory 2035871Snate@binkert.org 2045871Snate@binkert.orgmain_dict_keys = main.Dictionary().keys() 2055871Snate@binkert.org 2065871Snate@binkert.org# Check that we have a C/C++ compiler 2075871Snate@binkert.orgif not ('CC' in main_dict_keys and 'CXX' in main_dict_keys): 2085871Snate@binkert.org print "No C++ compiler installed (package g++ on Ubuntu and RedHat)" 2095871Snate@binkert.org Exit(1) 2105871Snate@binkert.org 2115871Snate@binkert.org# Check that swig is present 2125871Snate@binkert.orgif not 'SWIG' in main_dict_keys: 2135871Snate@binkert.org print "swig is not installed (package swig on Ubuntu and RedHat)" 2145871Snate@binkert.org Exit(1) 2155990Ssaidi@eecs.umich.edu 2165871Snate@binkert.org# add useful python code PYTHONPATH so it can be used by subprocesses 2175871Snate@binkert.org# as well 2185871Snate@binkert.orgmain.AppendENVPath('PYTHONPATH', extra_python_paths) 2194678Snate@binkert.org 2206121Snate@binkert.org######################################################################## 2215871Snate@binkert.org# 2225871Snate@binkert.org# Mercurial Stuff. 2235871Snate@binkert.org# 2245871Snate@binkert.org# If the gem5 directory is a mercurial repository, we should do some 2255871Snate@binkert.org# extra things. 2265871Snate@binkert.org# 2275871Snate@binkert.org######################################################################## 2285871Snate@binkert.org 2295871Snate@binkert.orghgdir = main.root.Dir(".hg") 2304678Snate@binkert.org 2315871Snate@binkert.orgmercurial_style_message = """ 2324678Snate@binkert.orgYou're missing the gem5 style hook, which automatically checks your code 2335871Snate@binkert.orgagainst the gem5 style rules on hg commit and qrefresh commands. This 2345871Snate@binkert.orgscript will now install the hook in your .hg/hgrc file. 2355871Snate@binkert.orgPress enter to continue, or ctrl-c to abort: """ 2365871Snate@binkert.org 2375871Snate@binkert.orgmercurial_style_hook = """ 2385871Snate@binkert.org# The following lines were automatically added by gem5/SConstruct 2395871Snate@binkert.org# to provide the gem5 style-checking hooks 2405871Snate@binkert.org[extensions] 2415871Snate@binkert.orgstyle = %s/util/style.py 2426121Snate@binkert.org 2436121Snate@binkert.org[hooks] 2445863Snate@binkert.orgpretxncommit.style = python:style.check_style 245955SN/Apre-qrefresh.style = python:style.check_style 246955SN/A# End of SConstruct additions 2472632Sstever@eecs.umich.edu 2482632Sstever@eecs.umich.edu""" % (main.root.abspath) 249955SN/A 250955SN/Amercurial_lib_not_found = """ 251955SN/AMercurial libraries cannot be found, ignoring style hook. If 252955SN/Ayou are a gem5 developer, please fix this and run the style 2535863Snate@binkert.orghook. It is important. 254955SN/A""" 2552632Sstever@eecs.umich.edu 2562632Sstever@eecs.umich.edu# Check for style hook and prompt for installation if it's not there. 2572632Sstever@eecs.umich.edu# Skip this if --ignore-style was specified, there's no .hg dir to 2582632Sstever@eecs.umich.edu# install a hook in, or there's no interactive terminal to prompt. 2592632Sstever@eecs.umich.eduif not GetOption('ignore_style') and hgdir.exists() and sys.stdin.isatty(): 2602632Sstever@eecs.umich.edu style_hook = True 2612632Sstever@eecs.umich.edu try: 2622632Sstever@eecs.umich.edu from mercurial import ui 2632632Sstever@eecs.umich.edu ui = ui.ui() 2642632Sstever@eecs.umich.edu ui.readconfig(hgdir.File('hgrc').abspath) 2652632Sstever@eecs.umich.edu style_hook = ui.config('hooks', 'pretxncommit.style', None) and \ 2662632Sstever@eecs.umich.edu ui.config('hooks', 'pre-qrefresh.style', None) 2672632Sstever@eecs.umich.edu except ImportError: 2683718Sstever@eecs.umich.edu print mercurial_lib_not_found 2693718Sstever@eecs.umich.edu 2703718Sstever@eecs.umich.edu if not style_hook: 2713718Sstever@eecs.umich.edu print mercurial_style_message, 2723718Sstever@eecs.umich.edu # continue unless user does ctrl-c/ctrl-d etc. 2735863Snate@binkert.org try: 2745863Snate@binkert.org raw_input() 2753718Sstever@eecs.umich.edu except: 2763718Sstever@eecs.umich.edu print "Input exception, exiting scons.\n" 2776121Snate@binkert.org sys.exit(1) 2785863Snate@binkert.org hgrc_path = '%s/.hg/hgrc' % main.root.abspath 2793718Sstever@eecs.umich.edu print "Adding style hook to", hgrc_path, "\n" 2803718Sstever@eecs.umich.edu try: 2812634Sstever@eecs.umich.edu hgrc = open(hgrc_path, 'a') 2822634Sstever@eecs.umich.edu hgrc.write(mercurial_style_hook) 2835863Snate@binkert.org hgrc.close() 2842638Sstever@eecs.umich.edu except: 2852632Sstever@eecs.umich.edu print "Error updating", hgrc_path 2862632Sstever@eecs.umich.edu sys.exit(1) 2872632Sstever@eecs.umich.edu 2882632Sstever@eecs.umich.edu 2892632Sstever@eecs.umich.edu################################################### 2902632Sstever@eecs.umich.edu# 2911858SN/A# Figure out which configurations to set up based on the path(s) of 2923716Sstever@eecs.umich.edu# the target(s). 2932638Sstever@eecs.umich.edu# 2942638Sstever@eecs.umich.edu################################################### 2952638Sstever@eecs.umich.edu 2962638Sstever@eecs.umich.edu# Find default configuration & binary. 2972638Sstever@eecs.umich.eduDefault(environ.get('M5_DEFAULT_BINARY', 'build/ALPHA/gem5.debug')) 2982638Sstever@eecs.umich.edu 2992638Sstever@eecs.umich.edu# helper function: find last occurrence of element in list 3005863Snate@binkert.orgdef rfind(l, elt, offs = -1): 3015863Snate@binkert.org for i in range(len(l)+offs, 0, -1): 3025863Snate@binkert.org if l[i] == elt: 303955SN/A return i 3045341Sstever@gmail.com raise ValueError, "element not found" 3055341Sstever@gmail.com 3065863Snate@binkert.org# Take a list of paths (or SCons Nodes) and return a list with all 3075341Sstever@gmail.com# paths made absolute and ~-expanded. Paths will be interpreted 3086121Snate@binkert.org# relative to the launch directory unless a different root is provided 3094494Ssaidi@eecs.umich.edudef makePathListAbsolute(path_list, root=GetLaunchDir()): 3106121Snate@binkert.org return [abspath(joinpath(root, expanduser(str(p)))) 3111105SN/A for p in path_list] 3122667Sstever@eecs.umich.edu 3132667Sstever@eecs.umich.edu# Each target must have 'build' in the interior of the path; the 3142667Sstever@eecs.umich.edu# directory below this will determine the build parameters. For 3152667Sstever@eecs.umich.edu# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we 3166121Snate@binkert.org# recognize that ALPHA_SE specifies the configuration because it 3172667Sstever@eecs.umich.edu# follow 'build' in the build path. 3185341Sstever@gmail.com 3195863Snate@binkert.org# The funky assignment to "[:]" is needed to replace the list contents 3205341Sstever@gmail.com# in place rather than reassign the symbol to a new list, which 3215341Sstever@gmail.com# doesn't work (obviously!). 3225341Sstever@gmail.comBUILD_TARGETS[:] = makePathListAbsolute(BUILD_TARGETS) 3235863Snate@binkert.org 3245341Sstever@gmail.com# Generate a list of the unique build roots and configs that the 3255341Sstever@gmail.com# collected targets reference. 3265341Sstever@gmail.comvariant_paths = [] 3275863Snate@binkert.orgbuild_root = None 3285341Sstever@gmail.comfor t in BUILD_TARGETS: 3295341Sstever@gmail.com path_dirs = t.split('/') 3305341Sstever@gmail.com try: 3315341Sstever@gmail.com build_top = rfind(path_dirs, 'build', -2) 3325341Sstever@gmail.com except: 3335341Sstever@gmail.com print "Error: no non-leaf 'build' dir found on target path", t 3345341Sstever@gmail.com Exit(1) 3355341Sstever@gmail.com this_build_root = joinpath('/',*path_dirs[:build_top+1]) 3365341Sstever@gmail.com if not build_root: 3375341Sstever@gmail.com build_root = this_build_root 3385863Snate@binkert.org else: 3395341Sstever@gmail.com if this_build_root != build_root: 3405863Snate@binkert.org print "Error: build targets not under same build root\n"\ 3415341Sstever@gmail.com " %s\n %s" % (build_root, this_build_root) 3425863Snate@binkert.org Exit(1) 3436121Snate@binkert.org variant_path = joinpath('/',*path_dirs[:build_top+2]) 3446121Snate@binkert.org if variant_path not in variant_paths: 3455397Ssaidi@eecs.umich.edu variant_paths.append(variant_path) 3465397Ssaidi@eecs.umich.edu 3475341Sstever@gmail.com# Make sure build_root exists (might not if this is the first build there) 3485341Sstever@gmail.comif not isdir(build_root): 3495341Sstever@gmail.com mkdir(build_root) 3505341Sstever@gmail.commain['BUILDROOT'] = build_root 3515341Sstever@gmail.com 3525341Sstever@gmail.comExport('main') 3535341Sstever@gmail.com 3545341Sstever@gmail.commain.SConsignFile(joinpath(build_root, "sconsign")) 3555863Snate@binkert.org 3565341Sstever@gmail.com# Default duplicate option is to use hard links, but this messes up 3575341Sstever@gmail.com# when you use emacs to edit a file in the target dir, as emacs moves 3586121Snate@binkert.org# file to file~ then copies to file, breaking the link. Symbolic 3595341Sstever@gmail.com# (soft) links work better. 3606121Snate@binkert.orgmain.SetOption('duplicate', 'soft-copy') 3616121Snate@binkert.org 3625341Sstever@gmail.com# 3635863Snate@binkert.org# Set up global sticky variables... these are common to an entire build 3646121Snate@binkert.org# tree (not specific to a particular build like ALPHA_SE) 3655341Sstever@gmail.com# 3665863Snate@binkert.org 3675341Sstever@gmail.comglobal_vars_file = joinpath(build_root, 'variables.global') 3686121Snate@binkert.org 3696121Snate@binkert.orgglobal_vars = Variables(global_vars_file, args=ARGUMENTS) 3706121Snate@binkert.org 3715742Snate@binkert.orgglobal_vars.AddVariables( 3725742Snate@binkert.org ('CC', 'C compiler', environ.get('CC', main['CC'])), 3735341Sstever@gmail.com ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])), 3745742Snate@binkert.org ('SWIG', 'SWIG tool', environ.get('SWIG', main['SWIG'])), 3755742Snate@binkert.org ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')), 3765341Sstever@gmail.com ('BATCH', 'Use batch pool for build and tests', False), 3776017Snate@binkert.org ('BATCH_CMD', 'Batch pool submission command name', 'qdo'), 3786121Snate@binkert.org ('M5_BUILD_CACHE', 'Cache built objects in this directory', False), 3796017Snate@binkert.org ('EXTRAS', 'Add extra directories to the compilation', '') 3802632Sstever@eecs.umich.edu ) 3816121Snate@binkert.org 3825871Snate@binkert.org# Update main environment with values from ARGUMENTS & global_vars_file 3836121Snate@binkert.orgglobal_vars.Update(main) 3846121Snate@binkert.orghelp_texts["global_vars"] += global_vars.GenerateHelpText(main) 3855871Snate@binkert.org 3866121Snate@binkert.org# Save sticky variable settings back to current variables file 3876121Snate@binkert.orgglobal_vars.Save(global_vars_file, main) 3886121Snate@binkert.org 3896121Snate@binkert.org# Parse EXTRAS variable to build list of all directories where we're 3903940Ssaidi@eecs.umich.edu# look for sources etc. This list is exported as extras_dir_list. 3913918Ssaidi@eecs.umich.edubase_dir = main.srcdir.abspath 3923918Ssaidi@eecs.umich.eduif main['EXTRAS']: 3931858SN/A extras_dir_list = makePathListAbsolute(main['EXTRAS'].split(':')) 3946121Snate@binkert.orgelse: 3956121Snate@binkert.org extras_dir_list = [] 3966121Snate@binkert.org 3976121Snate@binkert.orgExport('base_dir') 3986121Snate@binkert.orgExport('extras_dir_list') 3996121Snate@binkert.org 4003940Ssaidi@eecs.umich.edu# the ext directory should be on the #includes path 4016121Snate@binkert.orgmain.Append(CPPPATH=[Dir('ext')]) 4026121Snate@binkert.org 4036121Snate@binkert.orgdef strip_build_path(path, env): 4046121Snate@binkert.org path = str(path) 4056121Snate@binkert.org variant_base = env['BUILDROOT'] + os.path.sep 4066121Snate@binkert.org if path.startswith(variant_base): 4076121Snate@binkert.org path = path[len(variant_base):] 4083918Ssaidi@eecs.umich.edu elif path.startswith('build/'): 4093918Ssaidi@eecs.umich.edu path = path[6:] 4103940Ssaidi@eecs.umich.edu return path 4113918Ssaidi@eecs.umich.edu 4123918Ssaidi@eecs.umich.edu# Generate a string of the form: 4135397Ssaidi@eecs.umich.edu# common/path/prefix/src1, src2 -> tgt1, tgt2 4145397Ssaidi@eecs.umich.edu# to print while building. 4156121Snate@binkert.orgclass Transform(object): 4166121Snate@binkert.org # all specific color settings should be here and nowhere else 4176121Snate@binkert.org tool_color = termcap.Normal 4186121Snate@binkert.org pfx_color = termcap.Yellow 4196121Snate@binkert.org srcs_color = termcap.Yellow + termcap.Bold 4206121Snate@binkert.org arrow_color = termcap.Blue + termcap.Bold 4215397Ssaidi@eecs.umich.edu tgts_color = termcap.Yellow + termcap.Bold 4221851SN/A 4231851SN/A def __init__(self, tool, max_sources=99): 4246121Snate@binkert.org self.format = self.tool_color + (" [%8s] " % tool) \ 425955SN/A + self.pfx_color + "%s" \ 4263053Sstever@eecs.umich.edu + self.srcs_color + "%s" \ 4276121Snate@binkert.org + self.arrow_color + " -> " \ 4283053Sstever@eecs.umich.edu + self.tgts_color + "%s" \ 4293053Sstever@eecs.umich.edu + termcap.Normal 4303053Sstever@eecs.umich.edu self.max_sources = max_sources 4313053Sstever@eecs.umich.edu 4323053Sstever@eecs.umich.edu def __call__(self, target, source, env, for_signature=None): 4335871Snate@binkert.org # truncate source list according to max_sources param 4343053Sstever@eecs.umich.edu source = source[0:self.max_sources] 4354742Sstever@eecs.umich.edu def strip(f): 4364742Sstever@eecs.umich.edu return strip_build_path(str(f), env) 4373053Sstever@eecs.umich.edu if len(source) > 0: 4383053Sstever@eecs.umich.edu srcs = map(strip, source) 4393053Sstever@eecs.umich.edu else: 4403053Sstever@eecs.umich.edu srcs = [''] 4413053Sstever@eecs.umich.edu tgts = map(strip, target) 4423053Sstever@eecs.umich.edu # surprisingly, os.path.commonprefix is a dumb char-by-char string 4433053Sstever@eecs.umich.edu # operation that has nothing to do with paths. 4443053Sstever@eecs.umich.edu com_pfx = os.path.commonprefix(srcs + tgts) 4453053Sstever@eecs.umich.edu com_pfx_len = len(com_pfx) 4462667Sstever@eecs.umich.edu if com_pfx: 4474554Sbinkertn@umich.edu # do some cleanup and sanity checking on common prefix 4486121Snate@binkert.org if com_pfx[-1] == ".": 4492667Sstever@eecs.umich.edu # prefix matches all but file extension: ok 4504554Sbinkertn@umich.edu # back up one to change 'foo.cc -> o' to 'foo.cc -> .o' 4514554Sbinkertn@umich.edu com_pfx = com_pfx[0:-1] 4524554Sbinkertn@umich.edu elif com_pfx[-1] == "/": 4536121Snate@binkert.org # common prefix is directory path: OK 4544554Sbinkertn@umich.edu pass 4554554Sbinkertn@umich.edu else: 4564554Sbinkertn@umich.edu src0_len = len(srcs[0]) 4574781Snate@binkert.org tgt0_len = len(tgts[0]) 4584554Sbinkertn@umich.edu if src0_len == com_pfx_len: 4594554Sbinkertn@umich.edu # source is a substring of target, OK 4602667Sstever@eecs.umich.edu pass 4614554Sbinkertn@umich.edu elif tgt0_len == com_pfx_len: 4624554Sbinkertn@umich.edu # target is a substring of source, need to back up to 4634554Sbinkertn@umich.edu # avoid empty string on RHS of arrow 4644554Sbinkertn@umich.edu sep_idx = com_pfx.rfind(".") 4652667Sstever@eecs.umich.edu if sep_idx != -1: 4664554Sbinkertn@umich.edu com_pfx = com_pfx[0:sep_idx] 4672667Sstever@eecs.umich.edu else: 4684554Sbinkertn@umich.edu com_pfx = '' 4696121Snate@binkert.org elif src0_len > com_pfx_len and srcs[0][com_pfx_len] == ".": 4702667Sstever@eecs.umich.edu # still splitting at file extension: ok 4715522Snate@binkert.org pass 4725522Snate@binkert.org else: 4735522Snate@binkert.org # probably a fluke; ignore it 4745522Snate@binkert.org com_pfx = '' 4755522Snate@binkert.org # recalculate length in case com_pfx was modified 4765522Snate@binkert.org com_pfx_len = len(com_pfx) 4775522Snate@binkert.org def fmt(files): 4785522Snate@binkert.org f = map(lambda s: s[com_pfx_len:], files) 4795522Snate@binkert.org return ', '.join(f) 4805522Snate@binkert.org return self.format % (com_pfx, fmt(srcs), fmt(tgts)) 4815522Snate@binkert.org 4825522Snate@binkert.orgExport('Transform') 4835522Snate@binkert.org 4845522Snate@binkert.org# enable the regression script to use the termcap 4855522Snate@binkert.orgmain['TERMCAP'] = termcap 4865522Snate@binkert.org 4875522Snate@binkert.orgif GetOption('verbose'): 4885522Snate@binkert.org def MakeAction(action, string, *args, **kwargs): 4895522Snate@binkert.org return Action(action, *args, **kwargs) 4905522Snate@binkert.orgelse: 4915522Snate@binkert.org MakeAction = Action 4925522Snate@binkert.org main['CCCOMSTR'] = Transform("CC") 4935522Snate@binkert.org main['CXXCOMSTR'] = Transform("CXX") 4945522Snate@binkert.org main['ASCOMSTR'] = Transform("AS") 4955522Snate@binkert.org main['SWIGCOMSTR'] = Transform("SWIG") 4965522Snate@binkert.org main['ARCOMSTR'] = Transform("AR", 0) 4972638Sstever@eecs.umich.edu main['LINKCOMSTR'] = Transform("LINK", 0) 4982638Sstever@eecs.umich.edu main['RANLIBCOMSTR'] = Transform("RANLIB", 0) 4996121Snate@binkert.org main['M4COMSTR'] = Transform("M4") 5003716Sstever@eecs.umich.edu main['SHCCCOMSTR'] = Transform("SHCC") 5015522Snate@binkert.org main['SHCXXCOMSTR'] = Transform("SHCXX") 5025522Snate@binkert.orgExport('MakeAction') 5035522Snate@binkert.org 5045522Snate@binkert.org# Initialize the Link-Time Optimization (LTO) flags 5055522Snate@binkert.orgmain['LTO_CCFLAGS'] = [] 5065522Snate@binkert.orgmain['LTO_LDFLAGS'] = [] 5071858SN/A 5085227Ssaidi@eecs.umich.edu# According to the readme, tcmalloc works best if the compiler doesn't 5095227Ssaidi@eecs.umich.edu# assume that we're using the builtin malloc and friends. These flags 5105227Ssaidi@eecs.umich.edu# are compiler-specific, so we need to set them after we detect which 5115227Ssaidi@eecs.umich.edu# compiler we're using. 5125227Ssaidi@eecs.umich.edumain['TCMALLOC_CCFLAGS'] = [] 5135863Snate@binkert.org 5146121Snate@binkert.orgCXX_version = readCommand([main['CXX'],'--version'], exception=False) 5156121Snate@binkert.orgCXX_V = readCommand([main['CXX'],'-V'], exception=False) 5166121Snate@binkert.org 5176121Snate@binkert.orgmain['GCC'] = CXX_version and CXX_version.find('g++') >= 0 5185227Ssaidi@eecs.umich.edumain['CLANG'] = CXX_version and CXX_version.find('clang') >= 0 5195227Ssaidi@eecs.umich.eduif main['GCC'] + main['CLANG'] > 1: 5205227Ssaidi@eecs.umich.edu print 'Error: How can we have two at the same time?' 5215204Sstever@gmail.com Exit(1) 5225204Sstever@gmail.com 5235204Sstever@gmail.com# Set up default C++ compiler flags 5245204Sstever@gmail.comif main['GCC'] or main['CLANG']: 5255204Sstever@gmail.com # As gcc and clang share many flags, do the common parts here 5265204Sstever@gmail.com main.Append(CCFLAGS=['-pipe']) 5275204Sstever@gmail.com main.Append(CCFLAGS=['-fno-strict-aliasing']) 5285204Sstever@gmail.com # Enable -Wall and then disable the few warnings that we 5295204Sstever@gmail.com # consistently violate 5305204Sstever@gmail.com main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef']) 5315204Sstever@gmail.com # We always compile using C++11, but only gcc >= 4.7 and clang 3.1 5325204Sstever@gmail.com # actually use that name, so we stick with c++0x 5335204Sstever@gmail.com main.Append(CXXFLAGS=['-std=c++0x']) 5345204Sstever@gmail.com # Add selected sanity checks from -Wextra 5355204Sstever@gmail.com main.Append(CXXFLAGS=['-Wmissing-field-initializers', 5365204Sstever@gmail.com '-Woverloaded-virtual']) 5375204Sstever@gmail.comelse: 5386121Snate@binkert.org print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal, 5395204Sstever@gmail.com print "Don't know what compiler options to use for your compiler." 5403118Sstever@eecs.umich.edu print termcap.Yellow + ' compiler:' + termcap.Normal, main['CXX'] 5413118Sstever@eecs.umich.edu print termcap.Yellow + ' version:' + termcap.Normal, 5423118Sstever@eecs.umich.edu if not CXX_version: 5433118Sstever@eecs.umich.edu print termcap.Yellow + termcap.Bold + "COMMAND NOT FOUND!" +\ 5443118Sstever@eecs.umich.edu termcap.Normal 5455863Snate@binkert.org else: 5463118Sstever@eecs.umich.edu print CXX_version.replace('\n', '<nl>') 5475863Snate@binkert.org print " If you're trying to use a compiler other than GCC" 5483118Sstever@eecs.umich.edu print " or clang, there appears to be something wrong with your" 5495863Snate@binkert.org print " environment." 5505863Snate@binkert.org print " " 5515863Snate@binkert.org print " If you are trying to use a compiler other than those listed" 5525863Snate@binkert.org print " above you will need to ease fix SConstruct and " 5535863Snate@binkert.org print " src/SConscript to support that compiler." 5545863Snate@binkert.org Exit(1) 5555863Snate@binkert.org 5565863Snate@binkert.orgif main['GCC']: 5576003Snate@binkert.org # Check for a supported version of gcc, >= 4.4 is needed for c++0x 5585863Snate@binkert.org # support. See http://gcc.gnu.org/projects/cxx0x.html for details 5595863Snate@binkert.org gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False) 5605863Snate@binkert.org if compareVersions(gcc_version, "4.4") < 0: 5616120Snate@binkert.org print 'Error: gcc version 4.4 or newer required.' 5625863Snate@binkert.org print ' Installed version:', gcc_version 5635863Snate@binkert.org Exit(1) 5645863Snate@binkert.org 5656120Snate@binkert.org main['GCC_VERSION'] = gcc_version 5666120Snate@binkert.org 5675863Snate@binkert.org # Check for versions with bugs 5685863Snate@binkert.org if not compareVersions(gcc_version, '4.4.1') or \ 5696120Snate@binkert.org not compareVersions(gcc_version, '4.4.2'): 5705863Snate@binkert.org print 'Info: Tree vectorizer in GCC 4.4.1 & 4.4.2 is buggy, disabling.' 5716121Snate@binkert.org main.Append(CCFLAGS=['-fno-tree-vectorize']) 5726121Snate@binkert.org 5735863Snate@binkert.org # LTO support is only really working properly from 4.6 and beyond 5745863Snate@binkert.org if compareVersions(gcc_version, '4.6') >= 0: 5753118Sstever@eecs.umich.edu # Add the appropriate Link-Time Optimization (LTO) flags 5765863Snate@binkert.org # unless LTO is explicitly turned off. Note that these flags 5773118Sstever@eecs.umich.edu # are only used by the fast target. 5783118Sstever@eecs.umich.edu if not GetOption('no_lto'): 5795863Snate@binkert.org # Pass the LTO flag when compiling to produce GIMPLE 5805863Snate@binkert.org # output, we merely create the flags here and only append 5815863Snate@binkert.org # them later/ 5825863Snate@binkert.org main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')] 5833118Sstever@eecs.umich.edu 5843483Ssaidi@eecs.umich.edu # Use the same amount of jobs for LTO as we are running 5853494Ssaidi@eecs.umich.edu # scons with, we hardcode the use of the linker plugin 5863494Ssaidi@eecs.umich.edu # which requires either gold or GNU ld >= 2.21 5873483Ssaidi@eecs.umich.edu main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'), 5883483Ssaidi@eecs.umich.edu '-fuse-linker-plugin'] 5893483Ssaidi@eecs.umich.edu 5903053Sstever@eecs.umich.edu main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc', 5913053Sstever@eecs.umich.edu '-fno-builtin-realloc', '-fno-builtin-free']) 5923918Ssaidi@eecs.umich.edu 5933053Sstever@eecs.umich.eduelif main['CLANG']: 5943053Sstever@eecs.umich.edu # Check for a supported version of clang, >= 2.9 is needed to 5953053Sstever@eecs.umich.edu # support similar features as gcc 4.4. See 5963053Sstever@eecs.umich.edu # http://clang.llvm.org/cxx_status.html for details 5973053Sstever@eecs.umich.edu clang_version_re = re.compile(".* version (\d+\.\d+)") 5981858SN/A clang_version_match = clang_version_re.match(CXX_version) 5991858SN/A if (clang_version_match): 6001858SN/A clang_version = clang_version_match.groups()[0] 6011858SN/A if compareVersions(clang_version, "2.9") < 0: 6021858SN/A print 'Error: clang version 2.9 or newer required.' 6031858SN/A print ' Installed version:', clang_version 6045863Snate@binkert.org Exit(1) 6055863Snate@binkert.org else: 6061859SN/A print 'Error: Unable to determine clang version.' 6075863Snate@binkert.org Exit(1) 6081858SN/A 6095863Snate@binkert.org # clang has a few additional warnings that we disable, 6101858SN/A # tautological comparisons are allowed due to unsigned integers 6111859SN/A # being compared to constants that happen to be 0, and extraneous 6121859SN/A # parantheses are allowed due to Ruby's printing of the AST, 6135863Snate@binkert.org # finally self assignments are allowed as the generated CPU code 6143053Sstever@eecs.umich.edu # is relying on this 6153053Sstever@eecs.umich.edu main.Append(CCFLAGS=['-Wno-tautological-compare', 6163053Sstever@eecs.umich.edu '-Wno-parentheses', 6173053Sstever@eecs.umich.edu '-Wno-self-assign']) 6181859SN/A 6191859SN/A main.Append(TCMALLOC_CCFLAGS=['-fno-builtin']) 6201859SN/A 6211859SN/A # On Mac OS X/Darwin we need to also use libc++ (part of XCode) as 6221859SN/A # opposed to libstdc++ to make the transition from TR1 to 6231859SN/A # C++11. See http://libcxx.llvm.org. However, clang has chosen a 6241859SN/A # strict implementation of the C++11 standard, and does not allow 6251859SN/A # incomplete types in template arguments (besides unique_ptr and 6261862SN/A # shared_ptr), and the libc++ STL containers create problems in 6271859SN/A # combination with the current gem5 code. For now, we stick with 6281859SN/A # libstdc++ and use the TR1 namespace. 6291859SN/A # if sys.platform == "darwin": 6305863Snate@binkert.org # main.Append(CXXFLAGS=['-stdlib=libc++']) 6315863Snate@binkert.org 6325863Snate@binkert.orgelse: 6335863Snate@binkert.org print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal, 6346121Snate@binkert.org print "Don't know what compiler options to use for your compiler." 6351858SN/A print termcap.Yellow + ' compiler:' + termcap.Normal, main['CXX'] 6365863Snate@binkert.org print termcap.Yellow + ' version:' + termcap.Normal, 6375863Snate@binkert.org if not CXX_version: 6385863Snate@binkert.org print termcap.Yellow + termcap.Bold + "COMMAND NOT FOUND!" +\ 6395863Snate@binkert.org termcap.Normal 6405863Snate@binkert.org else: 6412139SN/A print CXX_version.replace('\n', '<nl>') 6424202Sbinkertn@umich.edu print " If you're trying to use a compiler other than GCC" 6434202Sbinkertn@umich.edu print " or clang, there appears to be something wrong with your" 6442139SN/A print " environment." 6452155SN/A print " " 6464202Sbinkertn@umich.edu print " If you are trying to use a compiler other than those listed" 6474202Sbinkertn@umich.edu print " above you will need to ease fix SConstruct and " 6484202Sbinkertn@umich.edu print " src/SConscript to support that compiler." 6492155SN/A Exit(1) 6505863Snate@binkert.org 6511869SN/A# Set up common yacc/bison flags (needed for Ruby) 6521869SN/Amain['YACCFLAGS'] = '-d' 6535863Snate@binkert.orgmain['YACCHXXFILESUFFIX'] = '.hh' 6545863Snate@binkert.org 6554202Sbinkertn@umich.edu# Do this after we save setting back, or else we'll tack on an 6566108Snate@binkert.org# extra 'qdo' every time we run scons. 6576108Snate@binkert.orgif main['BATCH']: 6586108Snate@binkert.org main['CC'] = main['BATCH_CMD'] + ' ' + main['CC'] 6596108Snate@binkert.org main['CXX'] = main['BATCH_CMD'] + ' ' + main['CXX'] 6605863Snate@binkert.org main['AS'] = main['BATCH_CMD'] + ' ' + main['AS'] 6615863Snate@binkert.org main['AR'] = main['BATCH_CMD'] + ' ' + main['AR'] 6625863Snate@binkert.org main['RANLIB'] = main['BATCH_CMD'] + ' ' + main['RANLIB'] 6634202Sbinkertn@umich.edu 6644202Sbinkertn@umich.eduif sys.platform == 'cygwin': 6655863Snate@binkert.org # cygwin has some header file issues... 6665742Snate@binkert.org main.Append(CCFLAGS=["-Wno-uninitialized"]) 6675742Snate@binkert.org 6685341Sstever@gmail.com# Check for the protobuf compiler 6695342Sstever@gmail.comprotoc_version = readCommand([main['PROTOC'], '--version'], 6705342Sstever@gmail.com exception='').split() 6714202Sbinkertn@umich.edu 6724202Sbinkertn@umich.edu# First two words should be "libprotoc x.y.z" 6734202Sbinkertn@umich.eduif len(protoc_version) < 2 or protoc_version[0] != 'libprotoc': 6744202Sbinkertn@umich.edu print termcap.Yellow + termcap.Bold + \ 6754202Sbinkertn@umich.edu 'Warning: Protocol buffer compiler (protoc) not found.\n' + \ 6765863Snate@binkert.org ' Please install protobuf-compiler for tracing support.' + \ 6775863Snate@binkert.org termcap.Normal 6785863Snate@binkert.org main['PROTOC'] = False 6795863Snate@binkert.orgelse: 6805863Snate@binkert.org # Based on the availability of the compress stream wrappers, 6815863Snate@binkert.org # require 2.1.0 6825863Snate@binkert.org min_protoc_version = '2.1.0' 6835863Snate@binkert.org if compareVersions(protoc_version[1], min_protoc_version) < 0: 6845863Snate@binkert.org print termcap.Yellow + termcap.Bold + \ 6855863Snate@binkert.org 'Warning: protoc version', min_protoc_version, \ 6865863Snate@binkert.org 'or newer required.\n' + \ 6875863Snate@binkert.org ' Installed version:', protoc_version[1], \ 6885863Snate@binkert.org termcap.Normal 6895863Snate@binkert.org main['PROTOC'] = False 6905863Snate@binkert.org else: 6915863Snate@binkert.org # Attempt to determine the appropriate include path and 6925863Snate@binkert.org # library path using pkg-config, that means we also need to 6935863Snate@binkert.org # check for pkg-config. Note that it is possible to use 6945863Snate@binkert.org # protobuf without the involvement of pkg-config. Later on we 6955863Snate@binkert.org # check go a library config check and at that point the test 6965952Ssaidi@eecs.umich.edu # will fail if libprotobuf cannot be found. 6971869SN/A if readCommand(['pkg-config', '--version'], exception=''): 6981858SN/A try: 6995863Snate@binkert.org # Attempt to establish what linking flags to add for protobuf 7005863Snate@binkert.org # using pkg-config 7011869SN/A main.ParseConfig('pkg-config --cflags --libs-only-L protobuf') 7021858SN/A except: 7035863Snate@binkert.org print termcap.Yellow + termcap.Bold + \ 7046108Snate@binkert.org 'Warning: pkg-config could not get protobuf flags.' + \ 7056108Snate@binkert.org termcap.Normal 7066108Snate@binkert.org 7071858SN/A# Check for SWIG 708955SN/Aif not main.has_key('SWIG'): 709955SN/A print 'Error: SWIG utility not found.' 7101869SN/A print ' Please install (see http://www.swig.org) and retry.' 7111869SN/A Exit(1) 7121869SN/A 7131869SN/A# Check for appropriate SWIG version 7141869SN/Aswig_version = readCommand([main['SWIG'], '-version'], exception='').split() 7155863Snate@binkert.org# First 3 words should be "SWIG Version x.y.z" 7165863Snate@binkert.orgif len(swig_version) < 3 or \ 7175863Snate@binkert.org swig_version[0] != 'SWIG' or swig_version[1] != 'Version': 7181869SN/A print 'Error determining SWIG version.' 7195863Snate@binkert.org Exit(1) 7201869SN/A 7215863Snate@binkert.orgmin_swig_version = '1.3.34' 7221869SN/Aif compareVersions(swig_version[2], min_swig_version) < 0: 7231869SN/A print 'Error: SWIG version', min_swig_version, 'or newer required.' 7241869SN/A print ' Installed version:', swig_version[2] 7251869SN/A Exit(1) 7261869SN/A 7275863Snate@binkert.orgif swig_version[2] == "2.0.9": 7285863Snate@binkert.org print '\n' + termcap.Yellow + termcap.Bold + \ 7291869SN/A 'Warning: SWIG version 2.0.9 sometimes generates broken code.\n' + \ 7301869SN/A termcap.Normal + \ 7311869SN/A 'This problem only affects some platforms and some Python\n' + \ 7321869SN/A 'versions. See the following SWIG bug report for details:\n' + \ 7331869SN/A 'http://sourceforge.net/p/swig/bugs/1297/\n' 7341869SN/A 7351869SN/A 7365863Snate@binkert.org# Set up SWIG flags & scanner 7375863Snate@binkert.orgswig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS') 7381869SN/Amain.Append(SWIGFLAGS=swig_flags) 7395863Snate@binkert.org 7405863Snate@binkert.org# filter out all existing swig scanners, they mess up the dependency 7413356Sbinkertn@umich.edu# stuff for some reason 7423356Sbinkertn@umich.eduscanners = [] 7433356Sbinkertn@umich.edufor scanner in main['SCANNERS']: 7443356Sbinkertn@umich.edu skeys = scanner.skeys 7453356Sbinkertn@umich.edu if skeys == '.i': 7464781Snate@binkert.org continue 7475863Snate@binkert.org 7485863Snate@binkert.org if isinstance(skeys, (list, tuple)) and '.i' in skeys: 7491869SN/A continue 7501869SN/A 7511869SN/A scanners.append(scanner) 7526121Snate@binkert.org 7531869SN/A# add the new swig scanner that we like better 7542638Sstever@eecs.umich.edufrom SCons.Scanner import ClassicCPP as CPPScanner 7556121Snate@binkert.orgswig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")' 7566121Snate@binkert.orgscanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re)) 7572638Sstever@eecs.umich.edu 7585749Scws3k@cs.virginia.edu# replace the scanners list that has what we want 7596121Snate@binkert.orgmain['SCANNERS'] = scanners 7606121Snate@binkert.org 7615749Scws3k@cs.virginia.edu# Add a custom Check function to the Configure context so that we can 7621869SN/A# figure out if the compiler adds leading underscores to global 7631869SN/A# variables. This is needed for the autogenerated asm files that we 7643546Sgblack@eecs.umich.edu# use for embedding the python code. 7653546Sgblack@eecs.umich.edudef CheckLeading(context): 7663546Sgblack@eecs.umich.edu context.Message("Checking for leading underscore in global variables...") 7673546Sgblack@eecs.umich.edu # 1) Define a global variable called x from asm so the C compiler 7686121Snate@binkert.org # won't change the symbol at all. 7695863Snate@binkert.org # 2) Declare that variable. 7703546Sgblack@eecs.umich.edu # 3) Use the variable 7713546Sgblack@eecs.umich.edu # 7723546Sgblack@eecs.umich.edu # If the compiler prepends an underscore, this will successfully 7733546Sgblack@eecs.umich.edu # link because the external symbol 'x' will be called '_x' which 7744781Snate@binkert.org # was defined by the asm statement. If the compiler does not 7755863Snate@binkert.org # prepend an underscore, this will not successfully link because 7764781Snate@binkert.org # '_x' will have been defined by assembly, while the C portion of 7774781Snate@binkert.org # the code will be trying to use 'x' 7784781Snate@binkert.org ret = context.TryLink(''' 7794781Snate@binkert.org asm(".globl _x; _x: .byte 0"); 7804781Snate@binkert.org extern int x; 7815863Snate@binkert.org int main() { return x; } 7824781Snate@binkert.org ''', extension=".c") 7834781Snate@binkert.org context.env.Append(LEADING_UNDERSCORE=ret) 7844781Snate@binkert.org context.Result(ret) 7854781Snate@binkert.org return ret 7863546Sgblack@eecs.umich.edu 7873546Sgblack@eecs.umich.edu# Platform-specific configuration. Note again that we assume that all 7883546Sgblack@eecs.umich.edu# builds under a given build root run on the same host platform. 7894781Snate@binkert.orgconf = Configure(main, 7903546Sgblack@eecs.umich.edu conf_dir = joinpath(build_root, '.scons_config'), 7913546Sgblack@eecs.umich.edu log_file = joinpath(build_root, 'scons_config.log'), 7923546Sgblack@eecs.umich.edu custom_tests = { 'CheckLeading' : CheckLeading }) 7933546Sgblack@eecs.umich.edu 7943546Sgblack@eecs.umich.edu# Check for leading underscores. Don't really need to worry either 7953546Sgblack@eecs.umich.edu# way so don't need to check the return code. 7963546Sgblack@eecs.umich.educonf.CheckLeading() 7973546Sgblack@eecs.umich.edu 7983546Sgblack@eecs.umich.edu# Check if we should compile a 64 bit binary on Mac OS X/Darwin 7993546Sgblack@eecs.umich.edutry: 8004202Sbinkertn@umich.edu import platform 8013546Sgblack@eecs.umich.edu uname = platform.uname() 8023546Sgblack@eecs.umich.edu if uname[0] == 'Darwin' and compareVersions(uname[2], '9.0.0') >= 0: 8033546Sgblack@eecs.umich.edu if int(readCommand('sysctl -n hw.cpu64bit_capable')[0]): 804955SN/A main.Append(CCFLAGS=['-arch', 'x86_64']) 805955SN/A main.Append(CFLAGS=['-arch', 'x86_64']) 806955SN/A main.Append(LINKFLAGS=['-arch', 'x86_64']) 807955SN/A main.Append(ASFLAGS=['-arch', 'x86_64']) 8085863Snate@binkert.orgexcept: 8095863Snate@binkert.org pass 8105343Sstever@gmail.com 8115343Sstever@gmail.com# Recent versions of scons substitute a "Null" object for Configure() 8126121Snate@binkert.org# when configuration isn't necessary, e.g., if the "--help" option is 8135863Snate@binkert.org# present. Unfortuantely this Null object always returns false, 8144773Snate@binkert.org# breaking all our configuration checks. We replace it with our own 8155863Snate@binkert.org# more optimistic null object that returns True instead. 8162632Sstever@eecs.umich.eduif not conf: 8175863Snate@binkert.org def NullCheck(*args, **kwargs): 8182023SN/A return True 8195863Snate@binkert.org 8205863Snate@binkert.org class NullConf: 8215863Snate@binkert.org def __init__(self, env): 8225863Snate@binkert.org self.env = env 8235863Snate@binkert.org def Finish(self): 8245863Snate@binkert.org return self.env 8255863Snate@binkert.org def __getattr__(self, mname): 8265863Snate@binkert.org return NullCheck 8275863Snate@binkert.org 8282632Sstever@eecs.umich.edu conf = NullConf(main) 8295863Snate@binkert.org 8302023SN/A# Find Python include and library directories for embedding the 8312632Sstever@eecs.umich.edu# interpreter. For consistency, we will use the same Python 8325863Snate@binkert.org# installation used to run scons (and thus this script). If you want 8335342Sstever@gmail.com# to link in an alternate version, see above for instructions on how 8345863Snate@binkert.org# to invoke scons with a different copy of the Python interpreter. 8352632Sstever@eecs.umich.edufrom distutils import sysconfig 8365863Snate@binkert.org 8375863Snate@binkert.orgpy_getvar = sysconfig.get_config_var 8382632Sstever@eecs.umich.edu 8395863Snate@binkert.orgpy_debug = getattr(sys, 'pydebug', False) 8405863Snate@binkert.orgpy_version = 'python' + py_getvar('VERSION') + (py_debug and "_d" or "") 8415863Snate@binkert.org 8425863Snate@binkert.orgpy_general_include = sysconfig.get_python_inc() 8435863Snate@binkert.orgpy_platform_include = sysconfig.get_python_inc(plat_specific=True) 8445863Snate@binkert.orgpy_includes = [ py_general_include ] 8452632Sstever@eecs.umich.eduif py_platform_include != py_general_include: 8465863Snate@binkert.org py_includes.append(py_platform_include) 8475863Snate@binkert.org 8482632Sstever@eecs.umich.edupy_lib_path = [ py_getvar('LIBDIR') ] 8491888SN/A# add the prefix/lib/pythonX.Y/config dir, but only if there is no 8505863Snate@binkert.org# shared library in prefix/lib/. 8515863Snate@binkert.orgif not py_getvar('Py_ENABLE_SHARED'): 8525863Snate@binkert.org py_lib_path.append(py_getvar('LIBPL')) 8531858SN/A # Python requires the flags in LINKFORSHARED to be added the 8545863Snate@binkert.org # linker flags when linking with a statically with Python. Failing 8555863Snate@binkert.org # to do so can lead to errors from the Python's dynamic module 8565863Snate@binkert.org # loader at start up. 8575863Snate@binkert.org main.Append(LINKFLAGS=[py_getvar('LINKFORSHARED').split()]) 8582598SN/A 8595863Snate@binkert.orgpy_libs = [] 8601858SN/Afor lib in py_getvar('LIBS').split() + py_getvar('SYSLIBS').split(): 8611858SN/A if not lib.startswith('-l'): 8621858SN/A # Python requires some special flags to link (e.g. -framework 8635863Snate@binkert.org # common on OS X systems), assume appending preserves order 8641858SN/A main.Append(LINKFLAGS=[lib]) 8651858SN/A else: 8661858SN/A lib = lib[2:] 8675863Snate@binkert.org if lib not in py_libs: 8681871SN/A py_libs.append(lib) 8691858SN/Apy_libs.append(py_version) 8701858SN/A 8711858SN/Amain.Append(CPPPATH=py_includes) 8721858SN/Amain.Append(LIBPATH=py_lib_path) 8731858SN/A 8741858SN/A# Cache build files in the supplied directory. 8751858SN/Aif main['M5_BUILD_CACHE']: 8765863Snate@binkert.org print 'Using build cache located at', main['M5_BUILD_CACHE'] 8771858SN/A CacheDir(main['M5_BUILD_CACHE']) 8781858SN/A 8795863Snate@binkert.org 8801859SN/A# verify that this stuff works 8811859SN/Aif not conf.CheckHeader('Python.h', '<>'): 8821869SN/A print "Error: can't find Python.h header in", py_includes 8835863Snate@binkert.org print "Install Python headers (package python-dev on Ubuntu and RedHat)" 8845863Snate@binkert.org Exit(1) 8851869SN/A 8861965SN/Afor lib in py_libs: 8871965SN/A if not conf.CheckLib(lib): 8881965SN/A print "Error: can't find library %s required by python" % lib 8892761Sstever@eecs.umich.edu Exit(1) 8905863Snate@binkert.org 8911869SN/A# On Solaris you need to use libsocket for socket ops 8925863Snate@binkert.orgif not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'): 8932667Sstever@eecs.umich.edu if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'): 8941869SN/A print "Can't find library with socket calls (e.g. accept())" 8951869SN/A Exit(1) 8962929Sktlim@umich.edu 8972929Sktlim@umich.edu# Check for zlib. If the check passes, libz will be automatically 8985863Snate@binkert.org# added to the LIBS environment variable. 8992929Sktlim@umich.eduif not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'): 900955SN/A print 'Error: did not find needed zlib compression library '\ 9012598SN/A 'and/or zlib.h header file.' 902 print ' Please install zlib and try again.' 903 Exit(1) 904 905# If we have the protobuf compiler, also make sure we have the 906# development libraries. If the check passes, libprotobuf will be 907# automatically added to the LIBS environment variable. After 908# this, we can use the HAVE_PROTOBUF flag to determine if we have 909# got both protoc and libprotobuf available. 910main['HAVE_PROTOBUF'] = main['PROTOC'] and \ 911 conf.CheckLibWithHeader('protobuf', 'google/protobuf/message.h', 912 'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;') 913 914# If we have the compiler but not the library, print another warning. 915if main['PROTOC'] and not main['HAVE_PROTOBUF']: 916 print termcap.Yellow + termcap.Bold + \ 917 'Warning: did not find protocol buffer library and/or headers.\n' + \ 918 ' Please install libprotobuf-dev for tracing support.' + \ 919 termcap.Normal 920 921# Check for librt. 922have_posix_clock = \ 923 conf.CheckLibWithHeader(None, 'time.h', 'C', 924 'clock_nanosleep(0,0,NULL,NULL);') or \ 925 conf.CheckLibWithHeader('rt', 'time.h', 'C', 926 'clock_nanosleep(0,0,NULL,NULL);') 927 928if conf.CheckLib('tcmalloc_minimal'): 929 main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS']) 930else: 931 print termcap.Yellow + termcap.Bold + \ 932 "You can get a 12% performance improvement by installing tcmalloc "\ 933 "(libgoogle-perftools-dev package on Ubuntu or RedHat)." + \ 934 termcap.Normal 935 936if not have_posix_clock: 937 print "Can't find library for POSIX clocks." 938 939# Check for <fenv.h> (C99 FP environment control) 940have_fenv = conf.CheckHeader('fenv.h', '<>') 941if not have_fenv: 942 print "Warning: Header file <fenv.h> not found." 943 print " This host has no IEEE FP rounding mode control." 944 945###################################################################### 946# 947# Finish the configuration 948# 949main = conf.Finish() 950 951###################################################################### 952# 953# Collect all non-global variables 954# 955 956# Define the universe of supported ISAs 957all_isa_list = [ ] 958Export('all_isa_list') 959 960class CpuModel(object): 961 '''The CpuModel class encapsulates everything the ISA parser needs to 962 know about a particular CPU model.''' 963 964 # Dict of available CPU model objects. Accessible as CpuModel.dict. 965 dict = {} 966 list = [] 967 defaults = [] 968 969 # Constructor. Automatically adds models to CpuModel.dict. 970 def __init__(self, name, filename, includes, strings, default=False): 971 self.name = name # name of model 972 self.filename = filename # filename for output exec code 973 self.includes = includes # include files needed in exec file 974 # The 'strings' dict holds all the per-CPU symbols we can 975 # substitute into templates etc. 976 self.strings = strings 977 978 # This cpu is enabled by default 979 self.default = default 980 981 # Add self to dict 982 if name in CpuModel.dict: 983 raise AttributeError, "CpuModel '%s' already registered" % name 984 CpuModel.dict[name] = self 985 CpuModel.list.append(name) 986 987Export('CpuModel') 988 989# Sticky variables get saved in the variables file so they persist from 990# one invocation to the next (unless overridden, in which case the new 991# value becomes sticky). 992sticky_vars = Variables(args=ARGUMENTS) 993Export('sticky_vars') 994 995# Sticky variables that should be exported 996export_vars = [] 997Export('export_vars') 998 999# For Ruby 1000all_protocols = [] 1001Export('all_protocols') 1002protocol_dirs = [] 1003Export('protocol_dirs') 1004slicc_includes = [] 1005Export('slicc_includes') 1006 1007# Walk the tree and execute all SConsopts scripts that wil add to the 1008# above variables 1009if not GetOption('verbose'): 1010 print "Reading SConsopts" 1011for bdir in [ base_dir ] + extras_dir_list: 1012 if not isdir(bdir): 1013 print "Error: directory '%s' does not exist" % bdir 1014 Exit(1) 1015 for root, dirs, files in os.walk(bdir): 1016 if 'SConsopts' in files: 1017 if GetOption('verbose'): 1018 print "Reading", joinpath(root, 'SConsopts') 1019 SConscript(joinpath(root, 'SConsopts')) 1020 1021all_isa_list.sort() 1022 1023sticky_vars.AddVariables( 1024 EnumVariable('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list), 1025 ListVariable('CPU_MODELS', 'CPU models', 1026 sorted(n for n,m in CpuModel.dict.iteritems() if m.default), 1027 sorted(CpuModel.list)), 1028 BoolVariable('EFENCE', 'Link with Electric Fence malloc debugger', 1029 False), 1030 BoolVariable('SS_COMPATIBLE_FP', 1031 'Make floating-point results compatible with SimpleScalar', 1032 False), 1033 BoolVariable('USE_SSE2', 1034 'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts', 1035 False), 1036 BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks', have_posix_clock), 1037 BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 1038 BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False), 1039 EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None', 1040 all_protocols), 1041 ) 1042 1043# These variables get exported to #defines in config/*.hh (see src/SConscript). 1044export_vars += ['USE_FENV', 'SS_COMPATIBLE_FP', 'TARGET_ISA', 'CP_ANNOTATE', 1045 'USE_POSIX_CLOCK', 'PROTOCOL', 'HAVE_PROTOBUF'] 1046 1047################################################### 1048# 1049# Define a SCons builder for configuration flag headers. 1050# 1051################################################### 1052 1053# This function generates a config header file that #defines the 1054# variable symbol to the current variable setting (0 or 1). The source 1055# operands are the name of the variable and a Value node containing the 1056# value of the variable. 1057def build_config_file(target, source, env): 1058 (variable, value) = [s.get_contents() for s in source] 1059 f = file(str(target[0]), 'w') 1060 print >> f, '#define', variable, value 1061 f.close() 1062 return None 1063 1064# Combine the two functions into a scons Action object. 1065config_action = MakeAction(build_config_file, Transform("CONFIG H", 2)) 1066 1067# The emitter munges the source & target node lists to reflect what 1068# we're really doing. 1069def config_emitter(target, source, env): 1070 # extract variable name from Builder arg 1071 variable = str(target[0]) 1072 # True target is config header file 1073 target = joinpath('config', variable.lower() + '.hh') 1074 val = env[variable] 1075 if isinstance(val, bool): 1076 # Force value to 0/1 1077 val = int(val) 1078 elif isinstance(val, str): 1079 val = '"' + val + '"' 1080 1081 # Sources are variable name & value (packaged in SCons Value nodes) 1082 return ([target], [Value(variable), Value(val)]) 1083 1084config_builder = Builder(emitter = config_emitter, action = config_action) 1085 1086main.Append(BUILDERS = { 'ConfigFile' : config_builder }) 1087 1088# libelf build is shared across all configs in the build root. 1089main.SConscript('ext/libelf/SConscript', 1090 variant_dir = joinpath(build_root, 'libelf')) 1091 1092# gzstream build is shared across all configs in the build root. 1093main.SConscript('ext/gzstream/SConscript', 1094 variant_dir = joinpath(build_root, 'gzstream')) 1095 1096# libfdt build is shared across all configs in the build root. 1097main.SConscript('ext/libfdt/SConscript', 1098 variant_dir = joinpath(build_root, 'libfdt')) 1099 1100################################################### 1101# 1102# This function is used to set up a directory with switching headers 1103# 1104################################################### 1105 1106main['ALL_ISA_LIST'] = all_isa_list 1107def make_switching_dir(dname, switch_headers, env): 1108 # Generate the header. target[0] is the full path of the output 1109 # header to generate. 'source' is a dummy variable, since we get the 1110 # list of ISAs from env['ALL_ISA_LIST']. 1111 def gen_switch_hdr(target, source, env): 1112 fname = str(target[0]) 1113 f = open(fname, 'w') 1114 isa = env['TARGET_ISA'].lower() 1115 print >>f, '#include "%s/%s/%s"' % (dname, isa, basename(fname)) 1116 f.close() 1117 1118 # Build SCons Action object. 'varlist' specifies env vars that this 1119 # action depends on; when env['ALL_ISA_LIST'] changes these actions 1120 # should get re-executed. 1121 switch_hdr_action = MakeAction(gen_switch_hdr, 1122 Transform("GENERATE"), varlist=['ALL_ISA_LIST']) 1123 1124 # Instantiate actions for each header 1125 for hdr in switch_headers: 1126 env.Command(hdr, [], switch_hdr_action) 1127Export('make_switching_dir') 1128 1129################################################### 1130# 1131# Define build environments for selected configurations. 1132# 1133################################################### 1134 1135for variant_path in variant_paths: 1136 print "Building in", variant_path 1137 1138 # Make a copy of the build-root environment to use for this config. 1139 env = main.Clone() 1140 env['BUILDDIR'] = variant_path 1141 1142 # variant_dir is the tail component of build path, and is used to 1143 # determine the build parameters (e.g., 'ALPHA_SE') 1144 (build_root, variant_dir) = splitpath(variant_path) 1145 1146 # Set env variables according to the build directory config. 1147 sticky_vars.files = [] 1148 # Variables for $BUILD_ROOT/$VARIANT_DIR are stored in 1149 # $BUILD_ROOT/variables/$VARIANT_DIR so you can nuke 1150 # $BUILD_ROOT/$VARIANT_DIR without losing your variables settings. 1151 current_vars_file = joinpath(build_root, 'variables', variant_dir) 1152 if isfile(current_vars_file): 1153 sticky_vars.files.append(current_vars_file) 1154 print "Using saved variables file %s" % current_vars_file 1155 else: 1156 # Build dir-specific variables file doesn't exist. 1157 1158 # Make sure the directory is there so we can create it later 1159 opt_dir = dirname(current_vars_file) 1160 if not isdir(opt_dir): 1161 mkdir(opt_dir) 1162 1163 # Get default build variables from source tree. Variables are 1164 # normally determined by name of $VARIANT_DIR, but can be 1165 # overridden by '--default=' arg on command line. 1166 default = GetOption('default') 1167 opts_dir = joinpath(main.root.abspath, 'build_opts') 1168 if default: 1169 default_vars_files = [joinpath(build_root, 'variables', default), 1170 joinpath(opts_dir, default)] 1171 else: 1172 default_vars_files = [joinpath(opts_dir, variant_dir)] 1173 existing_files = filter(isfile, default_vars_files) 1174 if existing_files: 1175 default_vars_file = existing_files[0] 1176 sticky_vars.files.append(default_vars_file) 1177 print "Variables file %s not found,\n using defaults in %s" \ 1178 % (current_vars_file, default_vars_file) 1179 else: 1180 print "Error: cannot find variables file %s or " \ 1181 "default file(s) %s" \ 1182 % (current_vars_file, ' or '.join(default_vars_files)) 1183 Exit(1) 1184 1185 # Apply current variable settings to env 1186 sticky_vars.Update(env) 1187 1188 help_texts["local_vars"] += \ 1189 "Build variables for %s:\n" % variant_dir \ 1190 + sticky_vars.GenerateHelpText(env) 1191 1192 # Process variable settings. 1193 1194 if not have_fenv and env['USE_FENV']: 1195 print "Warning: <fenv.h> not available; " \ 1196 "forcing USE_FENV to False in", variant_dir + "." 1197 env['USE_FENV'] = False 1198 1199 if not env['USE_FENV']: 1200 print "Warning: No IEEE FP rounding mode control in", variant_dir + "." 1201 print " FP results may deviate slightly from other platforms." 1202 1203 if env['EFENCE']: 1204 env.Append(LIBS=['efence']) 1205 1206 # Save sticky variable settings back to current variables file 1207 sticky_vars.Save(current_vars_file, env) 1208 1209 if env['USE_SSE2']: 1210 env.Append(CCFLAGS=['-msse2']) 1211 1212 # The src/SConscript file sets up the build rules in 'env' according 1213 # to the configured variables. It returns a list of environments, 1214 # one for each variant build (debug, opt, etc.) 1215 envList = SConscript('src/SConscript', variant_dir = variant_path, 1216 exports = 'env') 1217 1218 # Set up the regression tests for each build. 1219 for e in envList: 1220 SConscript('tests/SConscript', 1221 variant_dir = joinpath(variant_path, 'tests', e.Label), 1222 exports = { 'env' : e }, duplicate = False) 1223 1224# base help text 1225Help(''' 1226Usage: scons [scons options] [build variables] [target(s)] 1227 1228Extra scons options: 1229%(options)s 1230 1231Global build variables: 1232%(global_vars)s 1233 1234%(local_vars)s 1235''' % help_texts) 1236