SConscript revision 5132
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#
294762Snate@binkert.org# Authors: Nathan Binkert
30955SN/A
315522Snate@binkert.orgimport imp
324762Snate@binkert.orgimport os
335522Snate@binkert.orgimport sys
34955SN/A
355522Snate@binkert.orgfrom os.path import basename
36955SN/Afrom os.path import join as joinpath
375522Snate@binkert.orgfrom os.path import exists
384202Sbinkertn@umich.edufrom os.path import isdir
395742Snate@binkert.orgfrom os.path import isfile
40955SN/A
414381Sbinkertn@umich.eduimport SCons
424381Sbinkertn@umich.edu
43955SN/A# This file defines how to build a particular configuration of M5
44955SN/A# based on variable settings in the 'env' build environment.
45955SN/A
464202Sbinkertn@umich.eduImport('*')
47955SN/A
484382Sbinkertn@umich.edu# Children need to see the environment
494382Sbinkertn@umich.eduExport('env')
504382Sbinkertn@umich.edu
515517Snate@binkert.orgdef sort_list(_list):
525517Snate@binkert.org    """return a sorted copy of '_list'"""
534762Snate@binkert.org    if isinstance(_list, list):
544762Snate@binkert.org        _list = _list[:]
554762Snate@binkert.org    else:
564762Snate@binkert.org        _list = list(_list)
574762Snate@binkert.org    _list.sort()
584762Snate@binkert.org    return _list
594762Snate@binkert.org
604762Snate@binkert.orgclass PySourceFile(object):
614762Snate@binkert.org    def __init__(self, package, source):
624762Snate@binkert.org        filename = str(source)
635522Snate@binkert.org        pyname = basename(filename)
645604Snate@binkert.org        assert pyname.endswith('.py')
655604Snate@binkert.org        name = pyname[:-3]
665604Snate@binkert.org        path = package.split('.')
674762Snate@binkert.org        modpath = path
684762Snate@binkert.org        if name != '__init__':
694762Snate@binkert.org            modpath += [name]
705522Snate@binkert.org        modpath = '.'.join(modpath)
715522Snate@binkert.org
725522Snate@binkert.org        arcpath = package.split('.') + [ pyname + 'c' ]
735522Snate@binkert.org        arcname = joinpath(*arcpath)
745604Snate@binkert.org
755604Snate@binkert.org        self.source = source
764762Snate@binkert.org        self.pyname = pyname
774762Snate@binkert.org        self.srcpath = source.srcnode().abspath
784762Snate@binkert.org        self.package = package
794762Snate@binkert.org        self.modpath = modpath
805522Snate@binkert.org        self.arcname = arcname
814762Snate@binkert.org        self.filename = filename
824762Snate@binkert.org        self.compiled = File(filename + 'c')
835604Snate@binkert.org
845604Snate@binkert.org########################################################################
855604Snate@binkert.org# Code for adding source files of various types
865604Snate@binkert.org#
875604Snate@binkert.orgcc_sources = []
885604Snate@binkert.orgdef Source(source):
894762Snate@binkert.org    '''Add a C/C++ source file to the build'''
904762Snate@binkert.org    if not isinstance(source, SCons.Node.FS.File):
914762Snate@binkert.org        source = File(source)
924762Snate@binkert.org
935604Snate@binkert.org    cc_sources.append(source)
944762Snate@binkert.org
955522Snate@binkert.orgpy_sources = []
965522Snate@binkert.orgdef PySource(package, source):
975522Snate@binkert.org    '''Add a python source file to the named package'''
984762Snate@binkert.org    if not isinstance(source, SCons.Node.FS.File):
994382Sbinkertn@umich.edu        source = File(source)
1004762Snate@binkert.org
1014382Sbinkertn@umich.edu    source = PySourceFile(package, source)
1025522Snate@binkert.org    py_sources.append(source)
1034381Sbinkertn@umich.edu
1045522Snate@binkert.orgsim_objects_fixed = False
1054762Snate@binkert.orgsim_object_modfiles = set()
1064762Snate@binkert.orgdef SimObject(source):
1074762Snate@binkert.org    '''Add a SimObject python file as a python source object and add
1085522Snate@binkert.org    it to a list of sim object modules'''
1095522Snate@binkert.org
1105522Snate@binkert.org    if sim_objects_fixed:
1115522Snate@binkert.org        raise AttributeError, "Too late to call SimObject now."
1125522Snate@binkert.org
1135522Snate@binkert.org    if not isinstance(source, SCons.Node.FS.File):
1145522Snate@binkert.org        source = File(source)
1155522Snate@binkert.org
1165522Snate@binkert.org    PySource('m5.objects', source)
1174762Snate@binkert.org    modfile = basename(str(source))
1184762Snate@binkert.org    assert modfile.endswith('.py')
1194762Snate@binkert.org    modname = modfile[:-3]
1204762Snate@binkert.org    sim_object_modfiles.add(modname)
1214762Snate@binkert.org
1224762Snate@binkert.orgswig_sources = []
1234762Snate@binkert.orgdef SwigSource(package, source):
1244762Snate@binkert.org    '''Add a swig file to build'''
1254762Snate@binkert.org    if not isinstance(source, SCons.Node.FS.File):
1264762Snate@binkert.org        source = File(source)
1274762Snate@binkert.org    val = source,package
1284762Snate@binkert.org    swig_sources.append(val)
1294762Snate@binkert.org
1304762Snate@binkert.org# Children should have access
1314762Snate@binkert.orgExport('Source')
1324762Snate@binkert.orgExport('PySource')
1334762Snate@binkert.orgExport('SimObject')
1344762Snate@binkert.orgExport('SwigSource')
1354762Snate@binkert.org
1364762Snate@binkert.org########################################################################
1374762Snate@binkert.org#
1384762Snate@binkert.org# Set some compiler variables
1394762Snate@binkert.org#
1404762Snate@binkert.org
1414762Snate@binkert.org# Include file paths are rooted in this directory.  SCons will
1424762Snate@binkert.org# automatically expand '.' to refer to both the source directory and
1434762Snate@binkert.org# the corresponding build directory to pick up generated include
1444762Snate@binkert.org# files.
1454762Snate@binkert.orgenv.Append(CPPPATH=Dir('.'))
1464762Snate@binkert.org
1474762Snate@binkert.org# Add a flag defining what THE_ISA should be for all compilation
1484762Snate@binkert.orgenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
1494762Snate@binkert.org
1504762Snate@binkert.org########################################################################
1514762Snate@binkert.org#
152955SN/A# Walk the tree and execute all SConscripts
1535584Snate@binkert.org#
1545584Snate@binkert.orgsrcdir = env['SRCDIR']
1555584Snate@binkert.orgfor root, dirs, files in os.walk(srcdir, topdown=True):
1565584Snate@binkert.org    if root == srcdir:
1575584Snate@binkert.org        # we don't want to recurse back into this SConscript
1585584Snate@binkert.org        continue
1595584Snate@binkert.org
1605584Snate@binkert.org    if 'SConscript' in files:
1615584Snate@binkert.org        # strip off the srcdir part since scons will try to find the
1625584Snate@binkert.org        # script in the build directory
1635584Snate@binkert.org        base = root[len(srcdir) + 1:]
1645584Snate@binkert.org        SConscript(joinpath(base, 'SConscript'))
1655584Snate@binkert.org
1664382Sbinkertn@umich.eduextra_string = env['EXTRAS']
1674202Sbinkertn@umich.eduif extra_string and extra_string != '' and not extra_string.isspace():
1685522Snate@binkert.org    for extra in extra_string.split(':'):
1694382Sbinkertn@umich.edu        extra = os.path.expanduser(extra)
1704382Sbinkertn@umich.edu        extra = os.path.normpath(extra)
1714382Sbinkertn@umich.edu        env.Append(CPPPATH=[Dir(extra)])
1725584Snate@binkert.org        for root, dirs, files in os.walk(extra, topdown=True):
1734382Sbinkertn@umich.edu            if 'SConscript' in files:
1744382Sbinkertn@umich.edu                subdir = root[len(os.path.dirname(extra))+1:]
1754382Sbinkertn@umich.edu                build_dir = joinpath(env['BUILDDIR'], subdir)
1765192Ssaidi@eecs.umich.edu                SConscript(joinpath(root, 'SConscript'), build_dir=build_dir)
1775192Ssaidi@eecs.umich.edu
1785192Ssaidi@eecs.umich.edufor opt in env.ExportOptions:
1795192Ssaidi@eecs.umich.edu    env.ConfigFile(opt)
1805192Ssaidi@eecs.umich.edu
1815192Ssaidi@eecs.umich.edu########################################################################
1825192Ssaidi@eecs.umich.edu#
1835192Ssaidi@eecs.umich.edu# Prevent any SimObjects from being added after this point, they
1845192Ssaidi@eecs.umich.edu# should all have been added in the SConscripts above
1855192Ssaidi@eecs.umich.edu#
1865192Ssaidi@eecs.umich.edusim_objects_fixed = True
1875192Ssaidi@eecs.umich.edu
1885192Ssaidi@eecs.umich.edu########################################################################
1895192Ssaidi@eecs.umich.edu#
1905192Ssaidi@eecs.umich.edu# Manually turn python/generate.py into a python module and import it
1915192Ssaidi@eecs.umich.edu#
1925192Ssaidi@eecs.umich.edugenerate_file = File('python/generate.py')
1935192Ssaidi@eecs.umich.edugenerate_module = imp.new_module('generate')
1945192Ssaidi@eecs.umich.edusys.modules['generate'] = generate_module
1955192Ssaidi@eecs.umich.eduexec file(generate_file.srcnode().abspath, 'r') in generate_module.__dict__
1965192Ssaidi@eecs.umich.edu
1975192Ssaidi@eecs.umich.edu########################################################################
1985192Ssaidi@eecs.umich.edu#
1995192Ssaidi@eecs.umich.edu# build a generate
2005192Ssaidi@eecs.umich.edu#
2015192Ssaidi@eecs.umich.edufrom generate import Generate
2025192Ssaidi@eecs.umich.eduoptionDict = dict([(opt, env[opt]) for opt in env.ExportOptions])
2035192Ssaidi@eecs.umich.edugenerate = Generate(py_sources, sim_object_modfiles, optionDict)
2045192Ssaidi@eecs.umich.edum5 = generate.m5
2055192Ssaidi@eecs.umich.edu
2065192Ssaidi@eecs.umich.edu########################################################################
2075192Ssaidi@eecs.umich.edu#
2084382Sbinkertn@umich.edu# calculate extra dependencies
2094382Sbinkertn@umich.edu#
2104382Sbinkertn@umich.edumodule_depends = ["m5", "m5.SimObject", "m5.params"]
2112667Sstever@eecs.umich.edumodule_depends = [ File(generate.py_modules[dep]) for dep in module_depends ]
2122667Sstever@eecs.umich.edufile_depends = [ generate_file ]
2132667Sstever@eecs.umich.edudepends = module_depends + file_depends
2142667Sstever@eecs.umich.edu
2152667Sstever@eecs.umich.edu########################################################################
2162667Sstever@eecs.umich.edu#
2175742Snate@binkert.org# Commands for the basic automatically generated python files
2185742Snate@binkert.org#
2195742Snate@binkert.org
2202037SN/A# Generate a file with all of the compile options in it
2212037SN/Aenv.Command('python/m5/defines.py', Value(optionDict),
2222037SN/A            generate.makeDefinesPyFile)
2234382Sbinkertn@umich.eduPySource('m5', 'python/m5/defines.py')
2244762Snate@binkert.org
2255344Sstever@gmail.com# Generate a file that wraps the basic top level files
2264382Sbinkertn@umich.eduenv.Command('python/m5/info.py',
2275341Sstever@gmail.com            [ '#/AUTHORS', '#/LICENSE', '#/README', '#/RELEASE_NOTES' ],
2285742Snate@binkert.org            generate.makeInfoPyFile)
2295742Snate@binkert.orgPySource('m5', 'python/m5/info.py')
2305742Snate@binkert.org
2315742Snate@binkert.org# Generate an __init__.py file for the objects package
2325742Snate@binkert.orgenv.Command('python/m5/objects/__init__.py',
2334762Snate@binkert.org            [ Value(o) for o in sort_list(sim_object_modfiles) ],
2345742Snate@binkert.org            generate.makeObjectsInitFile)
2355742Snate@binkert.orgPySource('m5.objects', 'python/m5/objects/__init__.py')
2365742Snate@binkert.org
2375742Snate@binkert.org########################################################################
2385742Snate@binkert.org#
2395742Snate@binkert.org# Create all of the SimObject param headers and enum headers
2405742Snate@binkert.org#
2415341Sstever@gmail.com
2425742Snate@binkert.org# Generate all of the SimObject param struct header files
2435341Sstever@gmail.comparams_hh_files = []
2444773Snate@binkert.orgfor name,simobj in generate.sim_objects.iteritems():
2451858SN/A    extra_deps = [ File(generate.py_modules[simobj.__module__]) ]
2461858SN/A
2471085SN/A    hh_file = File('params/%s.hh' % name)
2484382Sbinkertn@umich.edu    params_hh_files.append(hh_file)
2494382Sbinkertn@umich.edu    env.Command(hh_file, Value(name), generate.createSimObjectParam)
2504762Snate@binkert.org    env.Depends(hh_file, depends + extra_deps)
2514762Snate@binkert.org
2524762Snate@binkert.org# Generate any parameter header files needed
2535517Snate@binkert.orgfor name,param in generate.params.iteritems():
2545517Snate@binkert.org    if isinstance(param, m5.params.VectorParamDesc):
2555517Snate@binkert.org        ext = 'vptype'
2565517Snate@binkert.org    else:
2575517Snate@binkert.org        ext = 'ptype'
2585517Snate@binkert.org
2595517Snate@binkert.org    i_file = File('params/%s_%s.i' % (name, ext))
2605517Snate@binkert.org    env.Command(i_file, Value(name), generate.createSwigParam)
2615517Snate@binkert.org    env.Depends(i_file, depends)
2625517Snate@binkert.org
2635517Snate@binkert.org# Generate all enum header files
2645517Snate@binkert.orgfor name,enum in generate.enums.iteritems():
2655517Snate@binkert.org    extra_deps = [ File(generate.py_modules[enum.__module__]) ]
2665517Snate@binkert.org
2675517Snate@binkert.org    cc_file = File('enums/%s.cc' % name)
2685517Snate@binkert.org    env.Command(cc_file, Value(name), generate.createEnumStrings)
2695517Snate@binkert.org    env.Depends(cc_file, depends + extra_deps)
2705517Snate@binkert.org    Source(cc_file)
2715517Snate@binkert.org
2725517Snate@binkert.org    hh_file = File('enums/%s.hh' % name)
2735517Snate@binkert.org    env.Command(hh_file, Value(name), generate.createEnumParam)
2745517Snate@binkert.org    env.Depends(hh_file, depends + extra_deps)
2755517Snate@binkert.org
2765517Snate@binkert.org# Build the big monolithic swigged params module (wraps all SimObject
2775517Snate@binkert.org# param structs and enum structs)
2785517Snate@binkert.orgparams_file = File('params/params.i')
2795517Snate@binkert.orgnames = sort_list(generate.sim_objects.keys())
2805517Snate@binkert.orgenv.Command(params_file, [ Value(v) for v in names ],
2815517Snate@binkert.org            generate.buildParams)
2825517Snate@binkert.orgenv.Depends(params_file, params_hh_files + depends)
2835517Snate@binkert.orgSwigSource('m5.objects', params_file)
2845517Snate@binkert.org
2855517Snate@binkert.org# Build all swig modules
2865517Snate@binkert.orgswig_modules = []
2875517Snate@binkert.orgfor source,package in swig_sources:
2885517Snate@binkert.org    filename = str(source)
2895517Snate@binkert.org    assert filename.endswith('.i')
2905517Snate@binkert.org
2915517Snate@binkert.org    base = '.'.join(filename.split('.')[:-1])
2925517Snate@binkert.org    module = basename(base)
2935517Snate@binkert.org    cc_file = base + '_wrap.cc'
2945517Snate@binkert.org    py_file = base + '.py'
2955517Snate@binkert.org
2965517Snate@binkert.org    env.Command([cc_file, py_file], source,
2975517Snate@binkert.org                '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
2985517Snate@binkert.org                '-o ${TARGETS[0]} $SOURCES')
2995517Snate@binkert.org    env.Depends(py_file, source)
3005517Snate@binkert.org    env.Depends(cc_file, source)
3015517Snate@binkert.org
3025517Snate@binkert.org    swig_modules.append(Value(module))
3035517Snate@binkert.org    Source(cc_file)
3045517Snate@binkert.org    PySource(package, py_file)
3055517Snate@binkert.org
3065517Snate@binkert.org# Generate the main swig init file
3075517Snate@binkert.orgenv.Command('swig/init.cc', swig_modules, generate.makeSwigInit)
3085517Snate@binkert.orgSource('swig/init.cc')
3095522Snate@binkert.org
3105517Snate@binkert.org# Build the zip file
3115517Snate@binkert.orgpy_compiled = []
3125517Snate@binkert.orgpy_zip_depends = []
3135517Snate@binkert.orgfor source in py_sources:
3144762Snate@binkert.org    env.Command(source.compiled, source.source, generate.compilePyFile)
3155517Snate@binkert.org    py_compiled.append(source.compiled)
3165517Snate@binkert.org
3174762Snate@binkert.org    # make the zipfile depend on the archive name so that the archive
3185517Snate@binkert.org    # is rebuilt if the name changes
3194762Snate@binkert.org    py_zip_depends.append(Value(source.arcname))
3205517Snate@binkert.org
3215517Snate@binkert.org# Add the zip file target to the environment.
3225517Snate@binkert.orgm5zip = File('m5py.zip')
3235517Snate@binkert.orgenv.Command(m5zip, py_compiled, generate.buildPyZip)
3245517Snate@binkert.orgenv.Depends(m5zip, py_zip_depends)
3255517Snate@binkert.org
3265517Snate@binkert.org########################################################################
3275517Snate@binkert.org#
3285517Snate@binkert.org# Define binaries.  Each different build type (debug, opt, etc.) gets
3295517Snate@binkert.org# a slightly different build environment.
3305517Snate@binkert.org#
3315517Snate@binkert.org
3325517Snate@binkert.org# List of constructed environments to pass back to SConstruct
3335517Snate@binkert.orgenvList = []
3345517Snate@binkert.org
3355517Snate@binkert.org# This function adds the specified sources to the given build
3365517Snate@binkert.org# environment, and returns a list of all the corresponding SCons
3375517Snate@binkert.org# Object nodes (including an extra one for date.cc).  We explicitly
3385517Snate@binkert.org# add the Object nodes so we can set up special dependencies for
3395517Snate@binkert.org# date.cc.
3405517Snate@binkert.orgdef make_objs(sources, env):
3415517Snate@binkert.org    objs = [env.Object(s) for s in sources]
3425517Snate@binkert.org    # make date.cc depend on all other objects so it always gets
3434762Snate@binkert.org    # recompiled whenever anything else does
3444762Snate@binkert.org    date_obj = env.Object('base/date.cc')
3454762Snate@binkert.org    env.Depends(date_obj, objs)
3464762Snate@binkert.org    objs.append(date_obj)
3474762Snate@binkert.org    return objs
3484762Snate@binkert.org
3495517Snate@binkert.org# Function to create a new build environment as clone of current
3504762Snate@binkert.org# environment 'env' with modified object suffix and optional stripped
3514762Snate@binkert.org# binary.  Additional keyword arguments are appended to corresponding
3524762Snate@binkert.org# build environment vars.
3534762Snate@binkert.orgdef makeEnv(label, objsfx, strip = False, **kwargs):
3544382Sbinkertn@umich.edu    newEnv = env.Copy(OBJSUFFIX=objsfx)
3554382Sbinkertn@umich.edu    newEnv.Label = label
3565517Snate@binkert.org    newEnv.Append(**kwargs)
3575517Snate@binkert.org    exe = 'm5.' + label  # final executable
3585517Snate@binkert.org    bin = exe + '.bin'   # executable w/o appended Python zip archive
3595517Snate@binkert.org    newEnv.Program(bin, make_objs(cc_sources, newEnv))
3605517Snate@binkert.org    if strip:
3615517Snate@binkert.org        stripped_bin = bin + '.stripped'
3625517Snate@binkert.org        if sys.platform == 'sunos5':
3635517Snate@binkert.org            cmd = 'cp $SOURCE $TARGET; strip $TARGET'
3645517Snate@binkert.org        else:
3655517Snate@binkert.org            cmd = 'strip $SOURCE -o $TARGET'
3665517Snate@binkert.org        newEnv.Command(stripped_bin, bin, cmd)
3675517Snate@binkert.org        bin = stripped_bin
3685517Snate@binkert.org    targets = newEnv.Concat(exe, [bin, 'm5py.zip'])
3695517Snate@binkert.org    newEnv.M5Binary = targets[0]
3705517Snate@binkert.org    envList.append(newEnv)
3715517Snate@binkert.org
3725517Snate@binkert.org# Debug binary
3735517Snate@binkert.orgccflags = {}
3745517Snate@binkert.orgif env['GCC']:
3755517Snate@binkert.org    if sys.platform == 'sunos5':
3765517Snate@binkert.org        ccflags['debug'] = '-gstabs+'
3775517Snate@binkert.org    else:
3785517Snate@binkert.org        ccflags['debug'] = '-ggdb3'
3795517Snate@binkert.org    ccflags['opt'] = '-g -O3'
3804762Snate@binkert.org    ccflags['fast'] = '-O3'
3815517Snate@binkert.org    ccflags['prof'] = '-O3 -g -pg'
3824382Sbinkertn@umich.eduelif env['SUNCC']:
3834382Sbinkertn@umich.edu    ccflags['debug'] = '-g0'
3844762Snate@binkert.org    ccflags['opt'] = '-g -O'
3854382Sbinkertn@umich.edu    ccflags['fast'] = '-fast'
3864382Sbinkertn@umich.edu    ccflags['prof'] = '-fast -g -pg'
3875517Snate@binkert.orgelif env['ICC']:
3884382Sbinkertn@umich.edu    ccflags['debug'] = '-g -O0'
3894382Sbinkertn@umich.edu    ccflags['opt'] = '-g -O'
3904762Snate@binkert.org    ccflags['fast'] = '-fast'
3914382Sbinkertn@umich.edu    ccflags['prof'] = '-fast -g -pg'
3924762Snate@binkert.orgelse:
3935517Snate@binkert.org    print 'Unknown compiler, please fix compiler options'
3944382Sbinkertn@umich.edu    Exit(1)
3954382Sbinkertn@umich.edu
3964762Snate@binkert.orgmakeEnv('debug', '.do',
3974762Snate@binkert.org        CCFLAGS = Split(ccflags['debug']),
3984762Snate@binkert.org        CPPDEFINES = ['DEBUG', 'TRACING_ON=1'])
3994762Snate@binkert.org
4004762Snate@binkert.org# Optimized binary
4015517Snate@binkert.orgmakeEnv('opt', '.o',
4025517Snate@binkert.org        CCFLAGS = Split(ccflags['opt']),
4035517Snate@binkert.org        CPPDEFINES = ['TRACING_ON=1'])
4045517Snate@binkert.org
4055517Snate@binkert.org# "Fast" binary
4065517Snate@binkert.orgmakeEnv('fast', '.fo', strip = True,
4075517Snate@binkert.org        CCFLAGS = Split(ccflags['fast']),
4085517Snate@binkert.org        CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'])
4095517Snate@binkert.org
4105517Snate@binkert.org# Profiled binary
4115517Snate@binkert.orgmakeEnv('prof', '.po',
4125517Snate@binkert.org        CCFLAGS = Split(ccflags['prof']),
4135517Snate@binkert.org        CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
4145517Snate@binkert.org        LINKFLAGS = '-pg')
4155517Snate@binkert.org
4165517Snate@binkert.orgReturn('envList')
4175517Snate@binkert.org