SConscript revision 5192
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: Nathan Binkert 30955SN/A 31955SN/Aimport imp 32955SN/Aimport os 33955SN/Aimport sys 34955SN/A 352632Sstever@eecs.umich.edufrom os.path import basename 362632Sstever@eecs.umich.edufrom os.path import join as joinpath 372632Sstever@eecs.umich.edufrom os.path import exists 382632Sstever@eecs.umich.edufrom os.path import isdir 39955SN/Afrom os.path import isfile 402632Sstever@eecs.umich.edu 412632Sstever@eecs.umich.eduimport SCons 422632Sstever@eecs.umich.edu 432632Sstever@eecs.umich.edu# This file defines how to build a particular configuration of M5 442632Sstever@eecs.umich.edu# based on variable settings in the 'env' build environment. 452632Sstever@eecs.umich.edu 462632Sstever@eecs.umich.eduImport('*') 472632Sstever@eecs.umich.edu 482632Sstever@eecs.umich.edu# Children need to see the environment 492632Sstever@eecs.umich.eduExport('env') 502632Sstever@eecs.umich.edu 512632Sstever@eecs.umich.edudef sort_list(_list): 522632Sstever@eecs.umich.edu """return a sorted copy of '_list'""" 532632Sstever@eecs.umich.edu if isinstance(_list, list): 542632Sstever@eecs.umich.edu _list = _list[:] 552632Sstever@eecs.umich.edu else: 562632Sstever@eecs.umich.edu _list = list(_list) 572632Sstever@eecs.umich.edu _list.sort() 582632Sstever@eecs.umich.edu return _list 592632Sstever@eecs.umich.edu 60955SN/Aclass PySourceFile(object): 61955SN/A def __init__(self, package, source): 62955SN/A filename = str(source) 63955SN/A pyname = basename(filename) 64955SN/A assert pyname.endswith('.py') 65955SN/A name = pyname[:-3] 66955SN/A path = package.split('.') 672656Sstever@eecs.umich.edu modpath = path 682656Sstever@eecs.umich.edu if name != '__init__': 692656Sstever@eecs.umich.edu modpath += [name] 702656Sstever@eecs.umich.edu modpath = '.'.join(modpath) 712656Sstever@eecs.umich.edu 722656Sstever@eecs.umich.edu arcpath = package.split('.') + [ pyname + 'c' ] 732656Sstever@eecs.umich.edu arcname = joinpath(*arcpath) 742653Sstever@eecs.umich.edu 752653Sstever@eecs.umich.edu self.source = source 762653Sstever@eecs.umich.edu self.pyname = pyname 772653Sstever@eecs.umich.edu self.srcpath = source.srcnode().abspath 782653Sstever@eecs.umich.edu self.package = package 792653Sstever@eecs.umich.edu self.modpath = modpath 802653Sstever@eecs.umich.edu self.arcname = arcname 812653Sstever@eecs.umich.edu self.filename = filename 822653Sstever@eecs.umich.edu self.compiled = File(filename + 'c') 832653Sstever@eecs.umich.edu 842653Sstever@eecs.umich.edu######################################################################## 851852SN/A# Code for adding source files of various types 86955SN/A# 87955SN/Acc_sources = [] 88955SN/Adef Source(source): 892632Sstever@eecs.umich.edu '''Add a C/C++ source file to the build''' 902632Sstever@eecs.umich.edu if not isinstance(source, SCons.Node.FS.File): 91955SN/A source = File(source) 921533SN/A 932632Sstever@eecs.umich.edu cc_sources.append(source) 941533SN/A 95955SN/Apy_sources = [] 96955SN/Adef PySource(package, source): 972632Sstever@eecs.umich.edu '''Add a python source file to the named package''' 982632Sstever@eecs.umich.edu if not isinstance(source, SCons.Node.FS.File): 99955SN/A source = File(source) 100955SN/A 101955SN/A source = PySourceFile(package, source) 102955SN/A py_sources.append(source) 1032632Sstever@eecs.umich.edu 104955SN/Asim_objects_fixed = False 1052632Sstever@eecs.umich.edusim_object_modfiles = set() 106955SN/Adef SimObject(source): 107955SN/A '''Add a SimObject python file as a python source object and add 1082632Sstever@eecs.umich.edu it to a list of sim object modules''' 1092632Sstever@eecs.umich.edu 1102632Sstever@eecs.umich.edu if sim_objects_fixed: 1112632Sstever@eecs.umich.edu raise AttributeError, "Too late to call SimObject now." 1122632Sstever@eecs.umich.edu 1132632Sstever@eecs.umich.edu if not isinstance(source, SCons.Node.FS.File): 1142632Sstever@eecs.umich.edu source = File(source) 1152632Sstever@eecs.umich.edu 1162632Sstever@eecs.umich.edu PySource('m5.objects', source) 1172632Sstever@eecs.umich.edu modfile = basename(str(source)) 1182632Sstever@eecs.umich.edu assert modfile.endswith('.py') 1192632Sstever@eecs.umich.edu modname = modfile[:-3] 1202632Sstever@eecs.umich.edu sim_object_modfiles.add(modname) 1212632Sstever@eecs.umich.edu 1222632Sstever@eecs.umich.eduswig_sources = [] 1232632Sstever@eecs.umich.edudef SwigSource(package, source): 1242632Sstever@eecs.umich.edu '''Add a swig file to build''' 1252634Sstever@eecs.umich.edu if not isinstance(source, SCons.Node.FS.File): 1262634Sstever@eecs.umich.edu source = File(source) 1272632Sstever@eecs.umich.edu val = source,package 1282638Sstever@eecs.umich.edu swig_sources.append(val) 1292632Sstever@eecs.umich.edu 1302632Sstever@eecs.umich.edu# Children should have access 1312632Sstever@eecs.umich.eduExport('Source') 1322632Sstever@eecs.umich.eduExport('PySource') 1332632Sstever@eecs.umich.eduExport('SimObject') 1342632Sstever@eecs.umich.eduExport('SwigSource') 1351858SN/A 1362638Sstever@eecs.umich.edu######################################################################## 1372638Sstever@eecs.umich.edu# 1382638Sstever@eecs.umich.edu# Trace Flags 1392638Sstever@eecs.umich.edu# 1402638Sstever@eecs.umich.eduall_flags = {} 1412638Sstever@eecs.umich.edutrace_flags = [] 1422638Sstever@eecs.umich.edudef TraceFlag(name, desc=''): 1432638Sstever@eecs.umich.edu if name in all_flags: 1442634Sstever@eecs.umich.edu raise AttributeError, "Flag %s already specified" % name 1452634Sstever@eecs.umich.edu flag = (name, (), desc) 1462634Sstever@eecs.umich.edu trace_flags.append(flag) 147955SN/A all_flags[name] = () 148955SN/A 149955SN/Adef CompoundFlag(name, flags, desc=''): 150955SN/A if name in all_flags: 151955SN/A raise AttributeError, "Flag %s already specified" % name 152955SN/A 153955SN/A compound = tuple(flags) 154955SN/A for flag in compound: 1551858SN/A if flag not in all_flags: 1561858SN/A raise AttributeError, "Trace flag %s not found" % flag 1572632Sstever@eecs.umich.edu if all_flags[flag]: 158955SN/A raise AttributeError, \ 1591858SN/A "Compound flag can't point to another compound flag" 1601105SN/A 1611869SN/A flag = (name, compound, desc) 1621869SN/A trace_flags.append(flag) 1631869SN/A all_flags[name] = compound 1641869SN/A 1651869SN/AExport('TraceFlag') 1661065SN/AExport('CompoundFlag') 1672632Sstever@eecs.umich.edu 1682632Sstever@eecs.umich.edu######################################################################## 169955SN/A# 1701858SN/A# Set some compiler variables 1711858SN/A# 1721858SN/A 1731858SN/A# Include file paths are rooted in this directory. SCons will 1741851SN/A# automatically expand '.' to refer to both the source directory and 1751851SN/A# the corresponding build directory to pick up generated include 1761858SN/A# files. 1772632Sstever@eecs.umich.eduenv.Append(CPPPATH=Dir('.')) 178955SN/A 1792656Sstever@eecs.umich.edu# Add a flag defining what THE_ISA should be for all compilation 1802656Sstever@eecs.umich.eduenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 1812656Sstever@eecs.umich.edu 1822656Sstever@eecs.umich.edu######################################################################## 1832656Sstever@eecs.umich.edu# 1842656Sstever@eecs.umich.edu# Walk the tree and execute all SConscripts 1852656Sstever@eecs.umich.edu# 1862656Sstever@eecs.umich.edusrcdir = env['SRCDIR'] 1872656Sstever@eecs.umich.edufor root, dirs, files in os.walk(srcdir, topdown=True): 1882656Sstever@eecs.umich.edu if root == srcdir: 1892656Sstever@eecs.umich.edu # we don't want to recurse back into this SConscript 1902656Sstever@eecs.umich.edu continue 1912656Sstever@eecs.umich.edu 1922656Sstever@eecs.umich.edu if 'SConscript' in files: 1932656Sstever@eecs.umich.edu # strip off the srcdir part since scons will try to find the 1942656Sstever@eecs.umich.edu # script in the build directory 1952655Sstever@eecs.umich.edu base = root[len(srcdir) + 1:] 1962655Sstever@eecs.umich.edu SConscript(joinpath(base, 'SConscript')) 1971858SN/A 1981858SN/Aextra_string = env['EXTRAS'] 1992638Sstever@eecs.umich.eduif extra_string and extra_string != '' and not extra_string.isspace(): 2002638Sstever@eecs.umich.edu for extra in extra_string.split(':'): 2012638Sstever@eecs.umich.edu extra = os.path.expanduser(extra) 2022638Sstever@eecs.umich.edu extra = os.path.normpath(extra) 2032638Sstever@eecs.umich.edu env.Append(CPPPATH=[Dir(extra)]) 2041858SN/A for root, dirs, files in os.walk(extra, topdown=True): 2051858SN/A if 'SConscript' in files: 2061858SN/A subdir = root[len(os.path.dirname(extra))+1:] 2071858SN/A build_dir = joinpath(env['BUILDDIR'], subdir) 2081858SN/A SConscript(joinpath(root, 'SConscript'), build_dir=build_dir) 2091858SN/A 2101858SN/Afor opt in env.ExportOptions: 2111859SN/A env.ConfigFile(opt) 2121858SN/A 2131858SN/A######################################################################## 2141858SN/A# 2151859SN/A# Prevent any SimObjects from being added after this point, they 2161859SN/A# should all have been added in the SConscripts above 2171862SN/A# 2181862SN/Asim_objects_fixed = True 2191862SN/A 2201862SN/A######################################################################## 2211859SN/A# 2221859SN/A# Manually turn python/generate.py into a python module and import it 2231963SN/A# 2241963SN/Agenerate_file = File('python/generate.py') 2251859SN/Agenerate_module = imp.new_module('generate') 2261859SN/Asys.modules['generate'] = generate_module 2271859SN/Aexec file(generate_file.srcnode().abspath, 'r') in generate_module.__dict__ 2281859SN/A 2291859SN/A######################################################################## 2301859SN/A# 2311859SN/A# build a generate 2321859SN/A# 2331862SN/Afrom generate import Generate 2341859SN/AoptionDict = dict([(opt, env[opt]) for opt in env.ExportOptions]) 2351859SN/Agenerate = Generate(py_sources, sim_object_modfiles, optionDict) 2361859SN/Am5 = generate.m5 2371858SN/A 2381858SN/A######################################################################## 2392139SN/A# 2402139SN/A# calculate extra dependencies 2412139SN/A# 2422155SN/Amodule_depends = ["m5", "m5.SimObject", "m5.params"] 2432623SN/Amodule_depends = [ File(generate.py_modules[dep]) for dep in module_depends ] 2442637Sstever@eecs.umich.edufile_depends = [ generate_file ] 2452155SN/Adepends = module_depends + file_depends 2461869SN/A 2471869SN/A######################################################################## 2481869SN/A# 2491869SN/A# Commands for the basic automatically generated python files 2501869SN/A# 2512139SN/A 2521869SN/A# Generate a file with all of the compile options in it 2532508SN/Aenv.Command('python/m5/defines.py', Value(optionDict), 2542508SN/A generate.makeDefinesPyFile) 2552508SN/APySource('m5', 'python/m5/defines.py') 2562508SN/A 2572635Sstever@eecs.umich.edu# Generate a file that wraps the basic top level files 2582635Sstever@eecs.umich.eduenv.Command('python/m5/info.py', 2591869SN/A [ '#/AUTHORS', '#/LICENSE', '#/README', '#/RELEASE_NOTES' ], 2601869SN/A generate.makeInfoPyFile) 2611869SN/APySource('m5', 'python/m5/info.py') 2621869SN/A 2631869SN/A# Generate an __init__.py file for the objects package 2641869SN/Aenv.Command('python/m5/objects/__init__.py', 2651869SN/A [ Value(o) for o in sort_list(sim_object_modfiles) ], 2661869SN/A generate.makeObjectsInitFile) 2671965SN/APySource('m5.objects', 'python/m5/objects/__init__.py') 2681965SN/A 2691965SN/A######################################################################## 2701869SN/A# 2711869SN/A# Create all of the SimObject param headers and enum headers 2721869SN/A# 2731869SN/A 2741884SN/A# Generate all of the SimObject param struct header files 2751884SN/Aparams_hh_files = [] 2761884SN/Afor name,simobj in generate.sim_objects.iteritems(): 2771869SN/A extra_deps = [ File(generate.py_modules[simobj.__module__]) ] 2781858SN/A 2791869SN/A hh_file = File('params/%s.hh' % name) 2801869SN/A params_hh_files.append(hh_file) 2811869SN/A env.Command(hh_file, Value(name), generate.createSimObjectParam) 2821869SN/A env.Depends(hh_file, depends + extra_deps) 2831869SN/A 2841858SN/A# Generate any parameter header files needed 2851869SN/Afor name,param in generate.params.iteritems(): 2861869SN/A if isinstance(param, m5.params.VectorParamDesc): 2871869SN/A ext = 'vptype' 2881869SN/A else: 2891869SN/A ext = 'ptype' 2901869SN/A 2911869SN/A i_file = File('params/%s_%s.i' % (name, ext)) 2921869SN/A env.Command(i_file, Value(name), generate.createSwigParam) 2931869SN/A env.Depends(i_file, depends) 2941869SN/A 2951858SN/A# Generate all enum header files 296955SN/Afor name,enum in generate.enums.iteritems(): 297955SN/A extra_deps = [ File(generate.py_modules[enum.__module__]) ] 2981869SN/A 2991869SN/A cc_file = File('enums/%s.cc' % name) 3001869SN/A env.Command(cc_file, Value(name), generate.createEnumStrings) 3011869SN/A env.Depends(cc_file, depends + extra_deps) 3021869SN/A Source(cc_file) 3031869SN/A 3041869SN/A hh_file = File('enums/%s.hh' % name) 3051869SN/A env.Command(hh_file, Value(name), generate.createEnumParam) 3061869SN/A env.Depends(hh_file, depends + extra_deps) 3071869SN/A 3081869SN/A# Build the big monolithic swigged params module (wraps all SimObject 3091869SN/A# param structs and enum structs) 3101869SN/Aparams_file = File('params/params.i') 3111869SN/Anames = sort_list(generate.sim_objects.keys()) 3121869SN/Aenv.Command(params_file, [ Value(v) for v in names ], 3131869SN/A generate.buildParams) 3141869SN/Aenv.Depends(params_file, params_hh_files + depends) 3151869SN/ASwigSource('m5.objects', params_file) 3161869SN/A 3171869SN/A# Build all swig modules 3181869SN/Aswig_modules = [] 3191869SN/Afor source,package in swig_sources: 3201869SN/A filename = str(source) 3211869SN/A assert filename.endswith('.i') 3221869SN/A 3231869SN/A base = '.'.join(filename.split('.')[:-1]) 3241869SN/A module = basename(base) 3251869SN/A cc_file = base + '_wrap.cc' 3261869SN/A py_file = base + '.py' 3271869SN/A 3281869SN/A env.Command([cc_file, py_file], source, 3291869SN/A '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 3301869SN/A '-o ${TARGETS[0]} $SOURCES') 3311869SN/A env.Depends(py_file, source) 3321869SN/A env.Depends(cc_file, source) 3331869SN/A 3341869SN/A swig_modules.append(Value(module)) 3351869SN/A Source(cc_file) 3361869SN/A PySource(package, py_file) 3372655Sstever@eecs.umich.edu 3382655Sstever@eecs.umich.edu# Generate the main swig init file 3392655Sstever@eecs.umich.eduenv.Command('swig/init.cc', swig_modules, generate.makeSwigInit) 3402655Sstever@eecs.umich.eduSource('swig/init.cc') 3412655Sstever@eecs.umich.edu 3422655Sstever@eecs.umich.edu# Generate traceflags.py 3432655Sstever@eecs.umich.eduflags = [ Value(f) for f in trace_flags ] 3442655Sstever@eecs.umich.eduenv.Command('base/traceflags.py', flags, generate.traceFlagsPy) 3452655Sstever@eecs.umich.eduPySource('m5', 'base/traceflags.py') 3462655Sstever@eecs.umich.edu 3472655Sstever@eecs.umich.eduenv.Command('base/traceflags.hh', flags, generate.traceFlagsHH) 3482655Sstever@eecs.umich.eduenv.Command('base/traceflags.cc', flags, generate.traceFlagsCC) 3492655Sstever@eecs.umich.eduSource('base/traceflags.cc') 3502655Sstever@eecs.umich.edu 3512655Sstever@eecs.umich.edu# Build the zip file 3522655Sstever@eecs.umich.edupy_compiled = [] 3532655Sstever@eecs.umich.edupy_zip_depends = [] 3542655Sstever@eecs.umich.edufor source in py_sources: 3552655Sstever@eecs.umich.edu env.Command(source.compiled, source.source, generate.compilePyFile) 3562655Sstever@eecs.umich.edu py_compiled.append(source.compiled) 3572655Sstever@eecs.umich.edu 3582655Sstever@eecs.umich.edu # make the zipfile depend on the archive name so that the archive 3592655Sstever@eecs.umich.edu # is rebuilt if the name changes 3602655Sstever@eecs.umich.edu py_zip_depends.append(Value(source.arcname)) 3612655Sstever@eecs.umich.edu 3622655Sstever@eecs.umich.edu# Add the zip file target to the environment. 3632634Sstever@eecs.umich.edum5zip = File('m5py.zip') 3642634Sstever@eecs.umich.eduenv.Command(m5zip, py_compiled, generate.buildPyZip) 3652634Sstever@eecs.umich.eduenv.Depends(m5zip, py_zip_depends) 3662634Sstever@eecs.umich.edu 3672634Sstever@eecs.umich.edu######################################################################## 3682634Sstever@eecs.umich.edu# 3692638Sstever@eecs.umich.edu# Define binaries. Each different build type (debug, opt, etc.) gets 3702638Sstever@eecs.umich.edu# a slightly different build environment. 3712638Sstever@eecs.umich.edu# 3722638Sstever@eecs.umich.edu 3732638Sstever@eecs.umich.edu# List of constructed environments to pass back to SConstruct 3741869SN/AenvList = [] 3751869SN/A 376955SN/A# This function adds the specified sources to the given build 377955SN/A# environment, and returns a list of all the corresponding SCons 378955SN/A# Object nodes (including an extra one for date.cc). We explicitly 379955SN/A# add the Object nodes so we can set up special dependencies for 3801858SN/A# date.cc. 3811858SN/Adef make_objs(sources, env): 3821858SN/A objs = [env.Object(s) for s in sources] 3832632Sstever@eecs.umich.edu # make date.cc depend on all other objects so it always gets 3842632Sstever@eecs.umich.edu # recompiled whenever anything else does 3852632Sstever@eecs.umich.edu date_obj = env.Object('base/date.cc') 3862632Sstever@eecs.umich.edu env.Depends(date_obj, objs) 3872632Sstever@eecs.umich.edu objs.append(date_obj) 3882634Sstever@eecs.umich.edu return objs 3892638Sstever@eecs.umich.edu 3902023SN/A# Function to create a new build environment as clone of current 3912632Sstever@eecs.umich.edu# environment 'env' with modified object suffix and optional stripped 3922632Sstever@eecs.umich.edu# binary. Additional keyword arguments are appended to corresponding 3932632Sstever@eecs.umich.edu# build environment vars. 3942632Sstever@eecs.umich.edudef makeEnv(label, objsfx, strip = False, **kwargs): 3952632Sstever@eecs.umich.edu newEnv = env.Copy(OBJSUFFIX=objsfx) 3962632Sstever@eecs.umich.edu newEnv.Label = label 3972632Sstever@eecs.umich.edu newEnv.Append(**kwargs) 3982632Sstever@eecs.umich.edu exe = 'm5.' + label # final executable 3992632Sstever@eecs.umich.edu bin = exe + '.bin' # executable w/o appended Python zip archive 4002632Sstever@eecs.umich.edu newEnv.Program(bin, make_objs(cc_sources, newEnv)) 4012632Sstever@eecs.umich.edu if strip: 4022023SN/A stripped_bin = bin + '.stripped' 4032632Sstever@eecs.umich.edu if sys.platform == 'sunos5': 4042632Sstever@eecs.umich.edu cmd = 'cp $SOURCE $TARGET; strip $TARGET' 4051889SN/A else: 4061889SN/A cmd = 'strip $SOURCE -o $TARGET' 4072632Sstever@eecs.umich.edu newEnv.Command(stripped_bin, bin, cmd) 4082632Sstever@eecs.umich.edu bin = stripped_bin 4092632Sstever@eecs.umich.edu targets = newEnv.Concat(exe, [bin, 'm5py.zip']) 4102632Sstever@eecs.umich.edu newEnv.M5Binary = targets[0] 4112632Sstever@eecs.umich.edu envList.append(newEnv) 4122632Sstever@eecs.umich.edu 4132632Sstever@eecs.umich.edu# Debug binary 4142632Sstever@eecs.umich.educcflags = {} 4152632Sstever@eecs.umich.eduif env['GCC']: 4162632Sstever@eecs.umich.edu if sys.platform == 'sunos5': 4172632Sstever@eecs.umich.edu ccflags['debug'] = '-gstabs+' 4182632Sstever@eecs.umich.edu else: 4192632Sstever@eecs.umich.edu ccflags['debug'] = '-ggdb3' 4202632Sstever@eecs.umich.edu ccflags['opt'] = '-g -O3' 4211888SN/A ccflags['fast'] = '-O3' 4221888SN/A ccflags['prof'] = '-O3 -g -pg' 4231869SN/Aelif env['SUNCC']: 4241869SN/A ccflags['debug'] = '-g0' 4251858SN/A ccflags['opt'] = '-g -O' 4262598SN/A ccflags['fast'] = '-fast' 4272598SN/A ccflags['prof'] = '-fast -g -pg' 4282598SN/Aelif env['ICC']: 4292598SN/A ccflags['debug'] = '-g -O0' 4302598SN/A ccflags['opt'] = '-g -O' 4311858SN/A ccflags['fast'] = '-fast' 4321858SN/A ccflags['prof'] = '-fast -g -pg' 4331858SN/Aelse: 4341858SN/A print 'Unknown compiler, please fix compiler options' 4351858SN/A Exit(1) 4361858SN/A 4371858SN/AmakeEnv('debug', '.do', 4381858SN/A CCFLAGS = Split(ccflags['debug']), 4391858SN/A CPPDEFINES = ['DEBUG', 'TRACING_ON=1']) 4401871SN/A 4411858SN/A# Optimized binary 4421858SN/AmakeEnv('opt', '.o', 4431858SN/A CCFLAGS = Split(ccflags['opt']), 4441858SN/A CPPDEFINES = ['TRACING_ON=1']) 4451858SN/A 4461858SN/A# "Fast" binary 4471858SN/AmakeEnv('fast', '.fo', strip = True, 4481858SN/A CCFLAGS = Split(ccflags['fast']), 4491858SN/A CPPDEFINES = ['NDEBUG', 'TRACING_ON=0']) 4501858SN/A 4511858SN/A# Profiled binary 4521859SN/AmakeEnv('prof', '.po', 4531859SN/A CCFLAGS = Split(ccflags['prof']), 4541869SN/A CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'], 4551888SN/A LINKFLAGS = '-pg') 4562632Sstever@eecs.umich.edu 4571869SN/AReturn('envList') 4581884SN/A