SConstruct revision 4773
1955SN/A# -*- mode:python -*-
2955SN/A
31762SN/A# Copyright (c) 2004-2005 The Regents of The University of Michigan
4955SN/A# All rights reserved.
5955SN/A#
6955SN/A# Redistribution and use in source and binary forms, with or without
7955SN/A# modification, are permitted provided that the following conditions are
8955SN/A# met: redistributions of source code must retain the above copyright
9955SN/A# notice, this list of conditions and the following disclaimer;
10955SN/A# redistributions in binary form must reproduce the above copyright
11955SN/A# notice, this list of conditions and the following disclaimer in the
12955SN/A# documentation and/or other materials provided with the distribution;
13955SN/A# neither the name of the copyright holders nor the names of its
14955SN/A# contributors may be used to endorse or promote products derived from
15955SN/A# this software without specific prior written permission.
16955SN/A#
17955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19955SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20955SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21955SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22955SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23955SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24955SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25955SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26955SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27955SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282665Ssaidi@eecs.umich.edu#
292665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt
30955SN/A
31955SN/A###################################################
32955SN/A#
33955SN/A# SCons top-level build description (SConstruct) file.
34955SN/A#
352632Sstever@eecs.umich.edu# While in this directory ('m5'), just type 'scons' to build the default
362632Sstever@eecs.umich.edu# configuration (see below), or type 'scons build/<CONFIG>/<binary>'
372632Sstever@eecs.umich.edu# to build some other configuration (e.g., 'build/ALPHA_FS/m5.opt' for
382632Sstever@eecs.umich.edu# the optimized full-system version).
39955SN/A#
402632Sstever@eecs.umich.edu# 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
422761Sstever@eecs.umich.edu# expects that all configs under the same build directory are being
432632Sstever@eecs.umich.edu# built for the same host system.
442632Sstever@eecs.umich.edu#
452632Sstever@eecs.umich.edu# Examples:
462761Sstever@eecs.umich.edu#
472761Sstever@eecs.umich.edu#   The following two commands are equivalent.  The '-u' option tells
482761Sstever@eecs.umich.edu#   scons to search up the directory tree for this SConstruct file.
492632Sstever@eecs.umich.edu#   % cd <path-to-src>/m5 ; scons build/ALPHA_FS/m5.debug
502632Sstever@eecs.umich.edu#   % cd <path-to-src>/m5/build/ALPHA_FS; scons -u m5.debug
512761Sstever@eecs.umich.edu#
522761Sstever@eecs.umich.edu#   The following two commands are equivalent and demonstrate building
532761Sstever@eecs.umich.edu#   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.
562632Sstever@eecs.umich.edu#   % cd <path-to-src>/m5 ; scons /local/foo/build/ALPHA_FS/m5.debug
572632Sstever@eecs.umich.edu#   % cd /local/foo/build/ALPHA_FS; scons -C <path-to-src>/m5 m5.debug
582632Sstever@eecs.umich.edu#
592632Sstever@eecs.umich.edu# You can use 'scons -H' to print scons options.  If you're in this
602632Sstever@eecs.umich.edu# '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.
63955SN/A#
64955SN/A###################################################
65955SN/A
66955SN/Aimport sys
67955SN/Aimport os
683918Ssaidi@eecs.umich.eduimport subprocess
694202Sbinkertn@umich.edu
704678Snate@binkert.orgfrom os.path import isdir, join as joinpath
71955SN/A
722656Sstever@eecs.umich.edu# Check for recent-enough Python and SCons versions.  If your system's
732656Sstever@eecs.umich.edu# default installation of Python is not recent enough, you can use a
742656Sstever@eecs.umich.edu# non-default installation of the Python interpreter by either (1)
752656Sstever@eecs.umich.edu# rearranging your PATH so that scons finds the non-default 'python'
762656Sstever@eecs.umich.edu# first or (2) explicitly invoking an alternative interpreter on the
772656Sstever@eecs.umich.edu# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
782656Sstever@eecs.umich.eduEnsurePythonVersion(2,4)
792653Sstever@eecs.umich.edu
802653Sstever@eecs.umich.edu# Ironically, SCons 0.96 dies if you give EnsureSconsVersion a
812653Sstever@eecs.umich.edu# 3-element version number.
822653Sstever@eecs.umich.edumin_scons_version = (0,96,91)
832653Sstever@eecs.umich.edutry:
842653Sstever@eecs.umich.edu    EnsureSConsVersion(*min_scons_version)
852653Sstever@eecs.umich.eduexcept:
862653Sstever@eecs.umich.edu    print "Error checking current SCons version."
872653Sstever@eecs.umich.edu    print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
882653Sstever@eecs.umich.edu    Exit(2)
892653Sstever@eecs.umich.edu    
901852SN/A
91955SN/A# The absolute path to the current directory (where this file lives).
92955SN/AROOT = Dir('.').abspath
93955SN/A
943717Sstever@eecs.umich.edu# Path to the M5 source tree.
953716Sstever@eecs.umich.eduSRCDIR = joinpath(ROOT, 'src')
96955SN/A
971533SN/A# tell python where to find m5 python code
983716Sstever@eecs.umich.edusys.path.append(joinpath(ROOT, 'src/python'))
991533SN/A
1004678Snate@binkert.orgdef check_style_hook(ui):
1014678Snate@binkert.org    ui.readconfig(joinpath(ROOT, '.hg', 'hgrc'))
1024678Snate@binkert.org    style_hook = ui.config('hooks', 'pretxncommit.style', None)
1034678Snate@binkert.org
1044678Snate@binkert.org    if not style_hook:
1054678Snate@binkert.org        print """\
1064678Snate@binkert.orgYou're missing the M5 style hook.
1074678Snate@binkert.orgPlease install the hook so we can ensure that all code fits a common style.
1084678Snate@binkert.org
1094678Snate@binkert.orgAll you'd need to do is add the following lines to your repository .hg/hgrc
1104678Snate@binkert.orgor your personal .hgrc
1114678Snate@binkert.org----------------
1124678Snate@binkert.org
1134678Snate@binkert.org[extensions]
1144678Snate@binkert.orgstyle = %s/util/style.py
1154678Snate@binkert.org
1164678Snate@binkert.org[hooks]
1174678Snate@binkert.orgpretxncommit.style = python:style.check_whitespace
1184678Snate@binkert.org""" % (ROOT)
1194678Snate@binkert.org        sys.exit(1)
1204678Snate@binkert.org
1214678Snate@binkert.orgif isdir(joinpath(ROOT, '.hg')):
1224678Snate@binkert.org    try:
1234678Snate@binkert.org        from mercurial import ui
1244678Snate@binkert.org        check_style_hook(ui.ui())
1254678Snate@binkert.org    except ImportError:
1264678Snate@binkert.org        pass
1274678Snate@binkert.org
128955SN/A###################################################
129955SN/A#
1302632Sstever@eecs.umich.edu# Figure out which configurations to set up based on the path(s) of
1312632Sstever@eecs.umich.edu# the target(s).
132955SN/A#
133955SN/A###################################################
134955SN/A
135955SN/A# Find default configuration & binary.
1362632Sstever@eecs.umich.eduDefault(os.environ.get('M5_DEFAULT_BINARY', 'build/ALPHA_SE/m5.debug'))
137955SN/A
1382632Sstever@eecs.umich.edu# helper function: find last occurrence of element in list
1392632Sstever@eecs.umich.edudef rfind(l, elt, offs = -1):
1402632Sstever@eecs.umich.edu    for i in range(len(l)+offs, 0, -1):
1412632Sstever@eecs.umich.edu        if l[i] == elt:
1422632Sstever@eecs.umich.edu            return i
1432632Sstever@eecs.umich.edu    raise ValueError, "element not found"
1442632Sstever@eecs.umich.edu
1453053Sstever@eecs.umich.edu# helper function: compare dotted version numbers.
1463053Sstever@eecs.umich.edu# E.g., compare_version('1.3.25', '1.4.1')
1473053Sstever@eecs.umich.edu# returns -1, 0, 1 if v1 is <, ==, > v2
1483053Sstever@eecs.umich.edudef compare_versions(v1, v2):
1493053Sstever@eecs.umich.edu    # Convert dotted strings to lists
1503053Sstever@eecs.umich.edu    v1 = map(int, v1.split('.'))
1513053Sstever@eecs.umich.edu    v2 = map(int, v2.split('.'))
1523053Sstever@eecs.umich.edu    # Compare corresponding elements of lists
1533053Sstever@eecs.umich.edu    for n1,n2 in zip(v1, v2):
1543053Sstever@eecs.umich.edu        if n1 < n2: return -1
1553053Sstever@eecs.umich.edu        if n1 > n2: return  1
1563053Sstever@eecs.umich.edu    # all corresponding values are equal... see if one has extra values
1573053Sstever@eecs.umich.edu    if len(v1) < len(v2): return -1
1583053Sstever@eecs.umich.edu    if len(v1) > len(v2): return  1
1593053Sstever@eecs.umich.edu    return 0
1603053Sstever@eecs.umich.edu
1612632Sstever@eecs.umich.edu# Each target must have 'build' in the interior of the path; the
1622632Sstever@eecs.umich.edu# directory below this will determine the build parameters.  For
1632632Sstever@eecs.umich.edu# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
1642632Sstever@eecs.umich.edu# recognize that ALPHA_SE specifies the configuration because it
1652632Sstever@eecs.umich.edu# follow 'build' in the bulid path.
1662632Sstever@eecs.umich.edu
1673718Sstever@eecs.umich.edu# Generate absolute paths to targets so we can see where the build dir is
1683718Sstever@eecs.umich.eduif COMMAND_LINE_TARGETS:
1693718Sstever@eecs.umich.edu    # Ask SCons which directory it was invoked from
1703718Sstever@eecs.umich.edu    launch_dir = GetLaunchDir()
1713718Sstever@eecs.umich.edu    # Make targets relative to invocation directory
1723718Sstever@eecs.umich.edu    abs_targets = map(lambda x: os.path.normpath(joinpath(launch_dir, str(x))),
1733718Sstever@eecs.umich.edu                      COMMAND_LINE_TARGETS)
1743718Sstever@eecs.umich.eduelse:
1753718Sstever@eecs.umich.edu    # Default targets are relative to root of tree
1763718Sstever@eecs.umich.edu    abs_targets = map(lambda x: os.path.normpath(joinpath(ROOT, str(x))),
1773718Sstever@eecs.umich.edu                      DEFAULT_TARGETS)
1783718Sstever@eecs.umich.edu
1793718Sstever@eecs.umich.edu
1802634Sstever@eecs.umich.edu# Generate a list of the unique build roots and configs that the
1812634Sstever@eecs.umich.edu# collected targets reference.
1822632Sstever@eecs.umich.edubuild_paths = []
1832638Sstever@eecs.umich.edubuild_root = None
1842632Sstever@eecs.umich.edufor t in abs_targets:
1852632Sstever@eecs.umich.edu    path_dirs = t.split('/')
1862632Sstever@eecs.umich.edu    try:
1872632Sstever@eecs.umich.edu        build_top = rfind(path_dirs, 'build', -2)
1882632Sstever@eecs.umich.edu    except:
1892632Sstever@eecs.umich.edu        print "Error: no non-leaf 'build' dir found on target path", t
1901858SN/A        Exit(1)
1913716Sstever@eecs.umich.edu    this_build_root = joinpath('/',*path_dirs[:build_top+1])
1922638Sstever@eecs.umich.edu    if not build_root:
1932638Sstever@eecs.umich.edu        build_root = this_build_root
1942638Sstever@eecs.umich.edu    else:
1952638Sstever@eecs.umich.edu        if this_build_root != build_root:
1962638Sstever@eecs.umich.edu            print "Error: build targets not under same build root\n"\
1972638Sstever@eecs.umich.edu                  "  %s\n  %s" % (build_root, this_build_root)
1982638Sstever@eecs.umich.edu            Exit(1)
1993716Sstever@eecs.umich.edu    build_path = joinpath('/',*path_dirs[:build_top+2])
2002634Sstever@eecs.umich.edu    if build_path not in build_paths:
2012634Sstever@eecs.umich.edu        build_paths.append(build_path)
202955SN/A
203955SN/A###################################################
204955SN/A#
205955SN/A# Set up the default build environment.  This environment is copied
206955SN/A# and modified according to each selected configuration.
207955SN/A#
208955SN/A###################################################
209955SN/A
2101858SN/Aenv = Environment(ENV = os.environ,  # inherit user's environment vars
2111858SN/A                  ROOT = ROOT,
2122632Sstever@eecs.umich.edu                  SRCDIR = SRCDIR)
213955SN/A
2143643Ssaidi@eecs.umich.edu#Parse CC/CXX early so that we use the correct compiler for 
2153643Ssaidi@eecs.umich.edu# to test for dependencies/versions/libraries/includes
2163643Ssaidi@eecs.umich.eduif ARGUMENTS.get('CC', None):
2173643Ssaidi@eecs.umich.edu    env['CC'] = ARGUMENTS.get('CC')
2183643Ssaidi@eecs.umich.edu
2193643Ssaidi@eecs.umich.eduif ARGUMENTS.get('CXX', None):
2203643Ssaidi@eecs.umich.edu    env['CXX'] = ARGUMENTS.get('CXX')
2213643Ssaidi@eecs.umich.edu
2224494Ssaidi@eecs.umich.eduExport('env')
2234494Ssaidi@eecs.umich.edu
2243716Sstever@eecs.umich.eduenv.SConsignFile(joinpath(build_root,"sconsign"))
2251105SN/A
2262667Sstever@eecs.umich.edu# Default duplicate option is to use hard links, but this messes up
2272667Sstever@eecs.umich.edu# when you use emacs to edit a file in the target dir, as emacs moves
2282667Sstever@eecs.umich.edu# file to file~ then copies to file, breaking the link.  Symbolic
2292667Sstever@eecs.umich.edu# (soft) links work better.
2302667Sstever@eecs.umich.eduenv.SetOption('duplicate', 'soft-copy')
2312667Sstever@eecs.umich.edu
2321869SN/A# I waffle on this setting... it does avoid a few painful but
2331869SN/A# unnecessary builds, but it also seems to make trivial builds take
2341869SN/A# noticeably longer.
2351869SN/Aif False:
2361869SN/A    env.TargetSignatures('content')
2371065SN/A
2382632Sstever@eecs.umich.edu# M5_PLY is used by isa_parser.py to find the PLY package.
2392632Sstever@eecs.umich.eduenv.Append(ENV = { 'M5_PLY' : Dir('ext/ply') })
2403918Ssaidi@eecs.umich.eduenv['GCC'] = False
2413918Ssaidi@eecs.umich.eduenv['SUNCC'] = False
2423940Ssaidi@eecs.umich.eduenv['ICC'] = False
2433918Ssaidi@eecs.umich.eduenv['GCC'] = subprocess.Popen(env['CXX'] + ' --version', shell=True, 
2443918Ssaidi@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2453918Ssaidi@eecs.umich.edu        close_fds=True).communicate()[0].find('GCC') >= 0
2463918Ssaidi@eecs.umich.eduenv['SUNCC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
2473918Ssaidi@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2483918Ssaidi@eecs.umich.edu        close_fds=True).communicate()[0].find('Sun C++') >= 0
2493940Ssaidi@eecs.umich.eduenv['ICC'] = subprocess.Popen(env['CXX'] + ' -V', shell=True, 
2503940Ssaidi@eecs.umich.edu        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 
2513940Ssaidi@eecs.umich.edu        close_fds=True).communicate()[0].find('Intel') >= 0
2523942Ssaidi@eecs.umich.eduif env['GCC'] + env['SUNCC'] + env['ICC'] > 1:
2533940Ssaidi@eecs.umich.edu    print 'Error: How can we have two at the same time?'
2543918Ssaidi@eecs.umich.edu    Exit(1)
2553918Ssaidi@eecs.umich.edu
256955SN/A
2571858SN/A# Set up default C++ compiler flags
2583918Ssaidi@eecs.umich.eduif env['GCC']:
2593918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS='-pipe')
2603918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS='-fno-strict-aliasing')
2613918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS=Split('-Wall -Wno-sign-compare -Werror -Wundef'))
2623940Ssaidi@eecs.umich.eduelif env['ICC']:
2633940Ssaidi@eecs.umich.edu    pass #Fix me... add warning flags once we clean up icc warnings
2643918Ssaidi@eecs.umich.eduelif env['SUNCC']:
2653918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS='-Qoption ccfe')
2663918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS='-features=gcc')
2673918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS='-features=extensions')
2683918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS='-library=stlport4')
2693918Ssaidi@eecs.umich.edu    env.Append(CCFLAGS='-xar')
2703918Ssaidi@eecs.umich.edu#    env.Append(CCFLAGS='-instances=semiexplicit')
2713918Ssaidi@eecs.umich.eduelse:
2723918Ssaidi@eecs.umich.edu    print 'Error: Don\'t know what compiler options to use for your compiler.'
2733940Ssaidi@eecs.umich.edu    print '       Please fix SConstruct and src/SConscript and try again.'
2743918Ssaidi@eecs.umich.edu    Exit(1)
2753918Ssaidi@eecs.umich.edu
2761851SN/Aif sys.platform == 'cygwin':
2771851SN/A    # cygwin has some header file issues...
2781858SN/A    env.Append(CCFLAGS=Split("-Wno-uninitialized"))
2792632Sstever@eecs.umich.eduenv.Append(CPPPATH=[Dir('ext/dnet')])
280955SN/A
2813053Sstever@eecs.umich.edu# Check for SWIG
2823053Sstever@eecs.umich.eduif not env.has_key('SWIG'):
2833053Sstever@eecs.umich.edu    print 'Error: SWIG utility not found.'
2843053Sstever@eecs.umich.edu    print '       Please install (see http://www.swig.org) and retry.'
2853053Sstever@eecs.umich.edu    Exit(1)
2863053Sstever@eecs.umich.edu
2873053Sstever@eecs.umich.edu# Check for appropriate SWIG version
2883053Sstever@eecs.umich.eduswig_version = os.popen('swig -version').read().split()
2893053Sstever@eecs.umich.edu# First 3 words should be "SWIG Version x.y.z"
2904742Sstever@eecs.umich.eduif len(swig_version) < 3 or \
2914742Sstever@eecs.umich.edu        swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
2923053Sstever@eecs.umich.edu    print 'Error determining SWIG version.'
2933053Sstever@eecs.umich.edu    Exit(1)
2943053Sstever@eecs.umich.edu
2953053Sstever@eecs.umich.edumin_swig_version = '1.3.28'
2963053Sstever@eecs.umich.eduif compare_versions(swig_version[2], min_swig_version) < 0:
2973053Sstever@eecs.umich.edu    print 'Error: SWIG version', min_swig_version, 'or newer required.'
2983053Sstever@eecs.umich.edu    print '       Installed version:', swig_version[2]
2993053Sstever@eecs.umich.edu    Exit(1)
3003053Sstever@eecs.umich.edu
3012667Sstever@eecs.umich.edu# Set up SWIG flags & scanner
3024554Sbinkertn@umich.eduswig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
3034554Sbinkertn@umich.eduenv.Append(SWIGFLAGS=swig_flags)
3042667Sstever@eecs.umich.edu
3054554Sbinkertn@umich.edu# filter out all existing swig scanners, they mess up the dependency
3064554Sbinkertn@umich.edu# stuff for some reason
3074554Sbinkertn@umich.eduscanners = []
3084554Sbinkertn@umich.edufor scanner in env['SCANNERS']:
3094554Sbinkertn@umich.edu    skeys = scanner.skeys
3104554Sbinkertn@umich.edu    if skeys == '.i':
3114554Sbinkertn@umich.edu        continue
3124554Sbinkertn@umich.edu    
3134554Sbinkertn@umich.edu    if isinstance(skeys, (list, tuple)) and '.i' in skeys:
3144554Sbinkertn@umich.edu        continue
3152667Sstever@eecs.umich.edu
3164554Sbinkertn@umich.edu    scanners.append(scanner)
3174554Sbinkertn@umich.edu
3184554Sbinkertn@umich.edu# add the new swig scanner that we like better
3194554Sbinkertn@umich.edufrom SCons.Scanner import ClassicCPP as CPPScanner
3202667Sstever@eecs.umich.eduswig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
3214554Sbinkertn@umich.eduscanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
3222667Sstever@eecs.umich.edu
3234554Sbinkertn@umich.edu# replace the scanners list that has what we want
3244554Sbinkertn@umich.eduenv['SCANNERS'] = scanners
3252667Sstever@eecs.umich.edu
3262638Sstever@eecs.umich.edu# Platform-specific configuration.  Note again that we assume that all
3272638Sstever@eecs.umich.edu# builds under a given build root run on the same host platform.
3282638Sstever@eecs.umich.educonf = Configure(env,
3293716Sstever@eecs.umich.edu                 conf_dir = joinpath(build_root, '.scons_config'),
3303716Sstever@eecs.umich.edu                 log_file = joinpath(build_root, 'scons_config.log'))
3311858SN/A
3323118Sstever@eecs.umich.edu# Find Python include and library directories for embedding the
3333118Sstever@eecs.umich.edu# interpreter.  For consistency, we will use the same Python
3343118Sstever@eecs.umich.edu# installation used to run scons (and thus this script).  If you want
3353118Sstever@eecs.umich.edu# to link in an alternate version, see above for instructions on how
3363118Sstever@eecs.umich.edu# to invoke scons with a different copy of the Python interpreter.
3373118Sstever@eecs.umich.edu
3383118Sstever@eecs.umich.edu# Get brief Python version name (e.g., "python2.4") for locating
3393118Sstever@eecs.umich.edu# include & library files
3403118Sstever@eecs.umich.edupy_version_name = 'python' + sys.version[:3]
3413118Sstever@eecs.umich.edu
3423118Sstever@eecs.umich.edu# include path, e.g. /usr/local/include/python2.4
3433716Sstever@eecs.umich.edupy_header_path = joinpath(sys.exec_prefix, 'include', py_version_name)
3443118Sstever@eecs.umich.eduenv.Append(CPPPATH = py_header_path)
3453118Sstever@eecs.umich.edu# verify that it works
3463118Sstever@eecs.umich.eduif not conf.CheckHeader('Python.h', '<>'):
3473118Sstever@eecs.umich.edu    print "Error: can't find Python.h header in", py_header_path
3483118Sstever@eecs.umich.edu    Exit(1)
3493118Sstever@eecs.umich.edu
3503118Sstever@eecs.umich.edu# add library path too if it's not in the default place
3513118Sstever@eecs.umich.edupy_lib_path = None
3523118Sstever@eecs.umich.eduif sys.exec_prefix != '/usr':
3533716Sstever@eecs.umich.edu    py_lib_path = joinpath(sys.exec_prefix, 'lib')
3543118Sstever@eecs.umich.eduelif sys.platform == 'cygwin':
3553118Sstever@eecs.umich.edu    # cygwin puts the .dll in /bin for some reason
3563118Sstever@eecs.umich.edu    py_lib_path = '/bin'
3573118Sstever@eecs.umich.eduif py_lib_path:
3583118Sstever@eecs.umich.edu    env.Append(LIBPATH = py_lib_path)
3593118Sstever@eecs.umich.edu    print 'Adding', py_lib_path, 'to LIBPATH for', py_version_name
3603118Sstever@eecs.umich.eduif not conf.CheckLib(py_version_name):
3613118Sstever@eecs.umich.edu    print "Error: can't find Python library", py_version_name
3623118Sstever@eecs.umich.edu    Exit(1)
3633118Sstever@eecs.umich.edu
3643483Ssaidi@eecs.umich.edu# On Solaris you need to use libsocket for socket ops
3653494Ssaidi@eecs.umich.eduif not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
3663494Ssaidi@eecs.umich.edu   if not conf.CheckLibWithHeader('socket', 'sys/socket.h', 'C++', 'accept(0,0,0);'):
3673483Ssaidi@eecs.umich.edu       print "Can't find library with socket calls (e.g. accept())"
3683483Ssaidi@eecs.umich.edu       Exit(1)
3693483Ssaidi@eecs.umich.edu
3703053Sstever@eecs.umich.edu# Check for zlib.  If the check passes, libz will be automatically
3713053Sstever@eecs.umich.edu# added to the LIBS environment variable.
3723918Ssaidi@eecs.umich.eduif not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
3733053Sstever@eecs.umich.edu    print 'Error: did not find needed zlib compression library '\
3743053Sstever@eecs.umich.edu          'and/or zlib.h header file.'
3753053Sstever@eecs.umich.edu    print '       Please install zlib and try again.'
3763053Sstever@eecs.umich.edu    Exit(1)
3773053Sstever@eecs.umich.edu
3781858SN/A# Check for <fenv.h> (C99 FP environment control)
3791858SN/Ahave_fenv = conf.CheckHeader('fenv.h', '<>')
3801858SN/Aif not have_fenv:
3811858SN/A    print "Warning: Header file <fenv.h> not found."
3821858SN/A    print "         This host has no IEEE FP rounding mode control."
3831858SN/A
3841859SN/A# Check for mysql.
3851858SN/Amysql_config = WhereIs('mysql_config')
3861858SN/Ahave_mysql = mysql_config != None
3871858SN/A
3881859SN/A# Check MySQL version.
3891859SN/Aif have_mysql:
3901862SN/A    mysql_version = os.popen(mysql_config + ' --version').read()
3913053Sstever@eecs.umich.edu    min_mysql_version = '4.1'
3923053Sstever@eecs.umich.edu    if compare_versions(mysql_version, min_mysql_version) < 0:
3933053Sstever@eecs.umich.edu        print 'Warning: MySQL', min_mysql_version, 'or newer required.'
3943053Sstever@eecs.umich.edu        print '         Version', mysql_version, 'detected.'
3951859SN/A        have_mysql = False
3961859SN/A
3971859SN/A# Set up mysql_config commands.
3981859SN/Aif have_mysql:
3991859SN/A    mysql_config_include = mysql_config + ' --include'
4001859SN/A    if os.system(mysql_config_include + ' > /dev/null') != 0:
4011859SN/A        # older mysql_config versions don't support --include, use
4021859SN/A        # --cflags instead
4031862SN/A        mysql_config_include = mysql_config + ' --cflags | sed s/\\\'//g'
4041859SN/A    # This seems to work in all versions
4051859SN/A    mysql_config_libs = mysql_config + ' --libs'
4061859SN/A
4071858SN/Aenv = conf.Finish()
4081858SN/A
4092139SN/A# Define the universe of supported ISAs
4104202Sbinkertn@umich.eduall_isa_list = [ ]
4114202Sbinkertn@umich.eduExport('all_isa_list')
4122139SN/A
4132155SN/A# Define the universe of supported CPU models
4144202Sbinkertn@umich.eduall_cpu_list = [ ]
4154202Sbinkertn@umich.edudefault_cpus = [ ]
4164202Sbinkertn@umich.eduExport('all_cpu_list', 'default_cpus')
4172155SN/A
4181869SN/A# Sticky options get saved in the options file so they persist from
4191869SN/A# one invocation to the next (unless overridden, in which case the new
4201869SN/A# value becomes sticky).
4211869SN/Asticky_opts = Options(args=ARGUMENTS)
4224202Sbinkertn@umich.eduExport('sticky_opts')
4234202Sbinkertn@umich.edu
4244202Sbinkertn@umich.edu# Non-sticky options only apply to the current build.
4254202Sbinkertn@umich.edunonsticky_opts = Options(args=ARGUMENTS)
4264202Sbinkertn@umich.eduExport('nonsticky_opts')
4274202Sbinkertn@umich.edu
4284202Sbinkertn@umich.edu# Walk the tree and execute all SConsopts scripts that wil add to the
4294202Sbinkertn@umich.edu# above options
4304202Sbinkertn@umich.edufor root, dirs, files in os.walk('.'):
4314202Sbinkertn@umich.edu    if 'SConsopts' in files:
4324202Sbinkertn@umich.edu        SConscript(os.path.join(root, 'SConsopts'))
4334202Sbinkertn@umich.edu
4344202Sbinkertn@umich.eduall_isa_list.sort()
4354202Sbinkertn@umich.eduall_cpu_list.sort()
4364202Sbinkertn@umich.edudefault_cpus.sort()
4374202Sbinkertn@umich.edu
4384773Snate@binkert.orgdef ExtraPathValidator(key, val, env):
4394773Snate@binkert.org    paths = val.split(':')
4404773Snate@binkert.org    for path in paths:
4414773Snate@binkert.org        path = os.path.expanduser(path)
4424773Snate@binkert.org        if not isdir(path):
4434773Snate@binkert.org            raise AttributeError, "Invalid path: '%s'" % path
4444773Snate@binkert.org
4451869SN/Asticky_opts.AddOptions(
4464202Sbinkertn@umich.edu    EnumOption('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
4471869SN/A    BoolOption('FULL_SYSTEM', 'Full-system support', False),
4482508SN/A    # There's a bug in scons 0.96.1 that causes ListOptions with list
4492508SN/A    # values (more than one value) not to be able to be restored from
4502508SN/A    # a saved option file.  If this causes trouble then upgrade to
4512508SN/A    # scons 0.96.90 or later.
4524202Sbinkertn@umich.edu    ListOption('CPU_MODELS', 'CPU models', default_cpus, all_cpu_list),
4531869SN/A    BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False),
4541869SN/A    BoolOption('EFENCE', 'Link with Electric Fence malloc debugger',
4551869SN/A               False),
4561869SN/A    BoolOption('SS_COMPATIBLE_FP',
4571869SN/A               'Make floating-point results compatible with SimpleScalar',
4581869SN/A               False),
4591965SN/A    BoolOption('USE_SSE2',
4601965SN/A               'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts',
4611965SN/A               False),
4621869SN/A    BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
4631869SN/A    BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
4642733Sktlim@umich.edu    BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False),
4651869SN/A    ('CC', 'C compiler', os.environ.get('CC', env['CC'])),
4661884SN/A    ('CXX', 'C++ compiler', os.environ.get('CXX', env['CXX'])),
4671884SN/A    BoolOption('BATCH', 'Use batch pool for build and tests', False),
4683356Sbinkertn@umich.edu    ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
4693356Sbinkertn@umich.edu    ('PYTHONHOME',
4703356Sbinkertn@umich.edu     'Override the default PYTHONHOME for this system (use with caution)',
4714773Snate@binkert.org     '%s:%s' % (sys.prefix, sys.exec_prefix)),
4724773Snate@binkert.org    ('EXTRAS', 'Add Extra directories to the compilation', '',
4734773Snate@binkert.org     ExtraPathValidator)
4741869SN/A    )
4751858SN/A
4761869SN/Anonsticky_opts.AddOptions(
4771869SN/A    BoolOption('update_ref', 'Update test reference outputs', False)
4781869SN/A    )
4791858SN/A
4802761Sstever@eecs.umich.edu# These options get exported to #defines in config/*.hh (see src/SConscript).
4811869SN/Aenv.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
4822733Sktlim@umich.edu                     'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
4833584Ssaidi@eecs.umich.edu                     'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA']
4841869SN/A
4851869SN/A# Define a handy 'no-op' action
4861869SN/Adef no_action(target, source, env):
4871869SN/A    return 0
4881869SN/A
4891869SN/Aenv.NoAction = Action(no_action, None)
4901858SN/A
491955SN/A###################################################
492955SN/A#
4931869SN/A# Define a SCons builder for configuration flag headers.
4941869SN/A#
4951869SN/A###################################################
4961869SN/A
4971869SN/A# This function generates a config header file that #defines the
4981869SN/A# option symbol to the current option setting (0 or 1).  The source
4991869SN/A# operands are the name of the option and a Value node containing the
5001869SN/A# value of the option.
5011869SN/Adef build_config_file(target, source, env):
5021869SN/A    (option, value) = [s.get_contents() for s in source]
5031869SN/A    f = file(str(target[0]), 'w')
5041869SN/A    print >> f, '#define', option, value
5051869SN/A    f.close()
5061869SN/A    return None
5071869SN/A
5081869SN/A# Generate the message to be printed when building the config file.
5091869SN/Adef build_config_file_string(target, source, env):
5101869SN/A    (option, value) = [s.get_contents() for s in source]
5111869SN/A    return "Defining %s as %s in %s." % (option, value, target[0])
5121869SN/A
5131869SN/A# Combine the two functions into a scons Action object.
5141869SN/Aconfig_action = Action(build_config_file, build_config_file_string)
5151869SN/A
5161869SN/A# The emitter munges the source & target node lists to reflect what
5171869SN/A# we're really doing.
5181869SN/Adef config_emitter(target, source, env):
5191869SN/A    # extract option name from Builder arg
5201869SN/A    option = str(target[0])
5211869SN/A    # True target is config header file
5223716Sstever@eecs.umich.edu    target = joinpath('config', option.lower() + '.hh')
5233356Sbinkertn@umich.edu    val = env[option]
5243356Sbinkertn@umich.edu    if isinstance(val, bool):
5253356Sbinkertn@umich.edu        # Force value to 0/1
5263356Sbinkertn@umich.edu        val = int(val)
5273356Sbinkertn@umich.edu    elif isinstance(val, str):
5283356Sbinkertn@umich.edu        val = '"' + val + '"'
5293356Sbinkertn@umich.edu        
5301869SN/A    # Sources are option name & value (packaged in SCons Value nodes)
5311869SN/A    return ([target], [Value(option), Value(val)])
5321869SN/A
5331869SN/Aconfig_builder = Builder(emitter = config_emitter, action = config_action)
5341869SN/A
5351869SN/Aenv.Append(BUILDERS = { 'ConfigFile' : config_builder })
5361869SN/A
5372655Sstever@eecs.umich.edu###################################################
5382655Sstever@eecs.umich.edu#
5392655Sstever@eecs.umich.edu# Define a SCons builder for copying files.  This is used by the
5402655Sstever@eecs.umich.edu# Python zipfile code in src/python/SConscript, but is placed up here
5412655Sstever@eecs.umich.edu# since it's potentially more generally applicable.
5422655Sstever@eecs.umich.edu#
5432655Sstever@eecs.umich.edu###################################################
5442655Sstever@eecs.umich.edu
5452655Sstever@eecs.umich.educopy_builder = Builder(action = Copy("$TARGET", "$SOURCE"))
5462655Sstever@eecs.umich.edu
5472655Sstever@eecs.umich.eduenv.Append(BUILDERS = { 'CopyFile' : copy_builder })
5482655Sstever@eecs.umich.edu
5492655Sstever@eecs.umich.edu###################################################
5502655Sstever@eecs.umich.edu#
5512655Sstever@eecs.umich.edu# Define a simple SCons builder to concatenate files.
5522655Sstever@eecs.umich.edu#
5532655Sstever@eecs.umich.edu# Used to append the Python zip archive to the executable.
5542655Sstever@eecs.umich.edu#
5552655Sstever@eecs.umich.edu###################################################
5562655Sstever@eecs.umich.edu
5572655Sstever@eecs.umich.educoncat_builder = Builder(action = Action(['cat $SOURCES > $TARGET',
5582655Sstever@eecs.umich.edu                                          'chmod +x $TARGET']))
5592655Sstever@eecs.umich.edu
5602655Sstever@eecs.umich.eduenv.Append(BUILDERS = { 'Concat' : concat_builder })
5612655Sstever@eecs.umich.edu
5622655Sstever@eecs.umich.edu
5632634Sstever@eecs.umich.edu# base help text
5642634Sstever@eecs.umich.eduhelp_text = '''
5652634Sstever@eecs.umich.eduUsage: scons [scons options] [build options] [target(s)]
5662634Sstever@eecs.umich.edu
5672634Sstever@eecs.umich.edu'''
5682634Sstever@eecs.umich.edu
5692638Sstever@eecs.umich.edu# libelf build is shared across all configs in the build root.
5702638Sstever@eecs.umich.eduenv.SConscript('ext/libelf/SConscript',
5713716Sstever@eecs.umich.edu               build_dir = joinpath(build_root, 'libelf'),
5722638Sstever@eecs.umich.edu               exports = 'env')
5732638Sstever@eecs.umich.edu
5741869SN/A###################################################
5751869SN/A#
5763546Sgblack@eecs.umich.edu# This function is used to set up a directory with switching headers
5773546Sgblack@eecs.umich.edu#
5783546Sgblack@eecs.umich.edu###################################################
5793546Sgblack@eecs.umich.edu
5804202Sbinkertn@umich.eduenv['ALL_ISA_LIST'] = all_isa_list
5813546Sgblack@eecs.umich.edudef make_switching_dir(dirname, switch_headers, env):
5823546Sgblack@eecs.umich.edu    # Generate the header.  target[0] is the full path of the output
5833546Sgblack@eecs.umich.edu    # header to generate.  'source' is a dummy variable, since we get the
5843546Sgblack@eecs.umich.edu    # list of ISAs from env['ALL_ISA_LIST'].
5853546Sgblack@eecs.umich.edu    def gen_switch_hdr(target, source, env):
5863546Sgblack@eecs.umich.edu	fname = str(target[0])
5873546Sgblack@eecs.umich.edu	basename = os.path.basename(fname)
5883546Sgblack@eecs.umich.edu	f = open(fname, 'w')
5893546Sgblack@eecs.umich.edu	f.write('#include "arch/isa_specific.hh"\n')
5903546Sgblack@eecs.umich.edu	cond = '#if'
5914202Sbinkertn@umich.edu	for isa in all_isa_list:
5923546Sgblack@eecs.umich.edu	    f.write('%s THE_ISA == %s_ISA\n#include "%s/%s/%s"\n'
5933546Sgblack@eecs.umich.edu		    % (cond, isa.upper(), dirname, isa, basename))
5943546Sgblack@eecs.umich.edu	    cond = '#elif'
5953546Sgblack@eecs.umich.edu	f.write('#else\n#error "THE_ISA not set"\n#endif\n')
5963546Sgblack@eecs.umich.edu	f.close()
5973546Sgblack@eecs.umich.edu	return 0
5983546Sgblack@eecs.umich.edu
5993546Sgblack@eecs.umich.edu    # String to print when generating header
6003546Sgblack@eecs.umich.edu    def gen_switch_hdr_string(target, source, env):
6013546Sgblack@eecs.umich.edu	return "Generating switch header " + str(target[0])
6023546Sgblack@eecs.umich.edu
6033546Sgblack@eecs.umich.edu    # Build SCons Action object. 'varlist' specifies env vars that this
6043546Sgblack@eecs.umich.edu    # action depends on; when env['ALL_ISA_LIST'] changes these actions
6053546Sgblack@eecs.umich.edu    # should get re-executed.
6063546Sgblack@eecs.umich.edu    switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string,
6073546Sgblack@eecs.umich.edu                               varlist=['ALL_ISA_LIST'])
6083546Sgblack@eecs.umich.edu
6093546Sgblack@eecs.umich.edu    # Instantiate actions for each header
6103546Sgblack@eecs.umich.edu    for hdr in switch_headers:
6113546Sgblack@eecs.umich.edu        env.Command(hdr, [], switch_hdr_action)
6124202Sbinkertn@umich.eduExport('make_switching_dir')
6133546Sgblack@eecs.umich.edu
6143546Sgblack@eecs.umich.edu###################################################
6153546Sgblack@eecs.umich.edu#
616955SN/A# Define build environments for selected configurations.
617955SN/A#
618955SN/A###################################################
619955SN/A
6201858SN/A# rename base env
6211858SN/Abase_env = env
6221858SN/A
6232632Sstever@eecs.umich.edufor build_path in build_paths:
6242632Sstever@eecs.umich.edu    print "Building in", build_path
6254773Snate@binkert.org    env['BUILDDIR'] = build_path
6264773Snate@binkert.org
6272632Sstever@eecs.umich.edu    # build_dir is the tail component of build path, and is used to
6282632Sstever@eecs.umich.edu    # determine the build parameters (e.g., 'ALPHA_SE')
6292632Sstever@eecs.umich.edu    (build_root, build_dir) = os.path.split(build_path)
6302634Sstever@eecs.umich.edu    # Make a copy of the build-root environment to use for this config.
6312638Sstever@eecs.umich.edu    env = base_env.Copy()
6322023SN/A
6332632Sstever@eecs.umich.edu    # Set env options according to the build directory config.
6342632Sstever@eecs.umich.edu    sticky_opts.files = []
6352632Sstever@eecs.umich.edu    # Options for $BUILD_ROOT/$BUILD_DIR are stored in
6362632Sstever@eecs.umich.edu    # $BUILD_ROOT/options/$BUILD_DIR so you can nuke
6372632Sstever@eecs.umich.edu    # $BUILD_ROOT/$BUILD_DIR without losing your options settings.
6383716Sstever@eecs.umich.edu    current_opts_file = joinpath(build_root, 'options', build_dir)
6392632Sstever@eecs.umich.edu    if os.path.isfile(current_opts_file):
6402632Sstever@eecs.umich.edu        sticky_opts.files.append(current_opts_file)
6412632Sstever@eecs.umich.edu        print "Using saved options file %s" % current_opts_file
6422632Sstever@eecs.umich.edu    else:
6432632Sstever@eecs.umich.edu        # Build dir-specific options file doesn't exist.
6442023SN/A
6452632Sstever@eecs.umich.edu        # Make sure the directory is there so we can create it later
6462632Sstever@eecs.umich.edu        opt_dir = os.path.dirname(current_opts_file)
6471889SN/A        if not os.path.isdir(opt_dir):
6481889SN/A            os.mkdir(opt_dir)
6492632Sstever@eecs.umich.edu
6502632Sstever@eecs.umich.edu        # Get default build options from source tree.  Options are
6512632Sstever@eecs.umich.edu        # normally determined by name of $BUILD_DIR, but can be
6522632Sstever@eecs.umich.edu        # overriden by 'default=' arg on command line.
6533716Sstever@eecs.umich.edu        default_opts_file = joinpath('build_opts',
6543716Sstever@eecs.umich.edu                                     ARGUMENTS.get('default', build_dir))
6552632Sstever@eecs.umich.edu        if os.path.isfile(default_opts_file):
6562632Sstever@eecs.umich.edu            sticky_opts.files.append(default_opts_file)
6572632Sstever@eecs.umich.edu            print "Options file %s not found,\n  using defaults in %s" \
6582632Sstever@eecs.umich.edu                  % (current_opts_file, default_opts_file)
6592632Sstever@eecs.umich.edu        else:
6602632Sstever@eecs.umich.edu            print "Error: cannot find options file %s or %s" \
6612632Sstever@eecs.umich.edu                  % (current_opts_file, default_opts_file)
6622632Sstever@eecs.umich.edu            Exit(1)
6631888SN/A
6641888SN/A    # Apply current option settings to env
6651869SN/A    sticky_opts.Update(env)
6661869SN/A    nonsticky_opts.Update(env)
6671858SN/A
6682598SN/A    help_text += "Sticky options for %s:\n" % build_dir \
6692598SN/A                 + sticky_opts.GenerateHelpText(env) \
6702598SN/A                 + "\nNon-sticky options for %s:\n" % build_dir \
6712598SN/A                 + nonsticky_opts.GenerateHelpText(env)
6722598SN/A
6731858SN/A    # Process option settings.
6741858SN/A
6751858SN/A    if not have_fenv and env['USE_FENV']:
6761858SN/A        print "Warning: <fenv.h> not available; " \
6771858SN/A              "forcing USE_FENV to False in", build_dir + "."
6781858SN/A        env['USE_FENV'] = False
6791858SN/A
6801858SN/A    if not env['USE_FENV']:
6811858SN/A        print "Warning: No IEEE FP rounding mode control in", build_dir + "."
6821871SN/A        print "         FP results may deviate slightly from other platforms."
6831858SN/A
6841858SN/A    if env['EFENCE']:
6851858SN/A        env.Append(LIBS=['efence'])
6861858SN/A
6871858SN/A    if env['USE_MYSQL']:
6881858SN/A        if not have_mysql:
6891858SN/A            print "Warning: MySQL not available; " \
6901858SN/A                  "forcing USE_MYSQL to False in", build_dir + "."
6911858SN/A            env['USE_MYSQL'] = False
6921858SN/A        else:
6931858SN/A            print "Compiling in", build_dir, "with MySQL support."
6941859SN/A            env.ParseConfig(mysql_config_libs)
6951859SN/A            env.ParseConfig(mysql_config_include)
6961869SN/A
6971888SN/A    # Save sticky option settings back to current options file
6982632Sstever@eecs.umich.edu    sticky_opts.Save(current_opts_file, env)
6991869SN/A
7001884SN/A    # Do this after we save setting back, or else we'll tack on an
7011884SN/A    # extra 'qdo' every time we run scons.
7021884SN/A    if env['BATCH']:
7031884SN/A        env['CC']  = env['BATCH_CMD'] + ' ' + env['CC']
7041884SN/A        env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX']
7051884SN/A
7061965SN/A    if env['USE_SSE2']:
7071965SN/A        env.Append(CCFLAGS='-msse2')
7081965SN/A
7092761Sstever@eecs.umich.edu    # The src/SConscript file sets up the build rules in 'env' according
7101869SN/A    # to the configured options.  It returns a list of environments,
7111869SN/A    # one for each variant build (debug, opt, etc.)
7122632Sstever@eecs.umich.edu    envList = SConscript('src/SConscript', build_dir = build_path,
7132667Sstever@eecs.umich.edu                         exports = 'env')
7141869SN/A
7151869SN/A    # Set up the regression tests for each build.
7162929Sktlim@umich.edu    for e in envList:
7172929Sktlim@umich.edu        SConscript('tests/SConscript',
7183716Sstever@eecs.umich.edu                   build_dir = joinpath(build_path, 'tests', e.Label),
7192929Sktlim@umich.edu                   exports = { 'env' : e }, duplicate = False)
720955SN/A
7212598SN/AHelp(help_text)
7222598SN/A
7233546Sgblack@eecs.umich.edu
724955SN/A###################################################
725955SN/A#
726955SN/A# Let SCons do its thing.  At this point SCons will use the defined
7271530SN/A# build environments to build the requested targets.
728955SN/A#
729955SN/A###################################################
730955SN/A
731