SConscript revision 974
1955SN/A# -*- mode:python -*- 2955SN/A 31762SN/A# Copyright (c) 2004 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.eduimport os 30955SN/Aimport sys 31955SN/A 32955SN/A# This file defines how to build a particular configuration of M5 33955SN/A# based on variable settings in the 'env' build environment. 34955SN/A 352632Sstever@eecs.umich.edu# Import build environment variable from SConstruct. 362632Sstever@eecs.umich.eduImport('env') 372632Sstever@eecs.umich.edu 382632Sstever@eecs.umich.edu################################################### 39955SN/A# 402632Sstever@eecs.umich.edu# Define needed sources. 412632Sstever@eecs.umich.edu# 422761Sstever@eecs.umich.edu################################################### 432632Sstever@eecs.umich.edu 442632Sstever@eecs.umich.edu# Base sources used by all configurations. 452632Sstever@eecs.umich.edubase_sources = Split(''' 462761Sstever@eecs.umich.edu arch/alpha/decoder.cc 472761Sstever@eecs.umich.edu arch/alpha/fast_cpu_exec.cc 482761Sstever@eecs.umich.edu arch/alpha/simple_cpu_exec.cc 492632Sstever@eecs.umich.edu arch/alpha/full_cpu_exec.cc 502632Sstever@eecs.umich.edu arch/alpha/faults.cc 512761Sstever@eecs.umich.edu arch/alpha/isa_traits.cc 522761Sstever@eecs.umich.edu 532761Sstever@eecs.umich.edu base/circlebuf.cc 542761Sstever@eecs.umich.edu base/copyright.cc 552761Sstever@eecs.umich.edu base/cprintf.cc 562632Sstever@eecs.umich.edu base/fast_alloc.cc 572632Sstever@eecs.umich.edu base/fifo_buffer.cc 582632Sstever@eecs.umich.edu base/hostinfo.cc 592632Sstever@eecs.umich.edu base/hybrid_pred.cc 602632Sstever@eecs.umich.edu base/inifile.cc 612632Sstever@eecs.umich.edu base/intmath.cc 622632Sstever@eecs.umich.edu base/misc.cc 63955SN/A base/pollevent.cc 64955SN/A base/python.cc 65955SN/A base/range.cc 66955SN/A base/sat_counter.cc 67955SN/A base/socket.cc 68955SN/A base/statistics.cc 69955SN/A base/str.cc 702656Sstever@eecs.umich.edu base/time.cc 712656Sstever@eecs.umich.edu base/trace.cc 722656Sstever@eecs.umich.edu base/traceflags.cc 732656Sstever@eecs.umich.edu base/userinfo.cc 742656Sstever@eecs.umich.edu base/compression/lzss_compression.cc 752656Sstever@eecs.umich.edu base/loader/aout_object.cc 762656Sstever@eecs.umich.edu base/loader/ecoff_object.cc 772653Sstever@eecs.umich.edu base/loader/elf_object.cc 782653Sstever@eecs.umich.edu base/loader/object_file.cc 792653Sstever@eecs.umich.edu base/loader/symtab.cc 802653Sstever@eecs.umich.edu base/stats/events.cc 812653Sstever@eecs.umich.edu base/stats/python.cc 822653Sstever@eecs.umich.edu base/stats/statdb.cc 832653Sstever@eecs.umich.edu base/stats/visit.cc 842653Sstever@eecs.umich.edu base/stats/text.cc 852653Sstever@eecs.umich.edu 862653Sstever@eecs.umich.edu cpu/base_cpu.cc 872653Sstever@eecs.umich.edu cpu/exec_context.cc 881852SN/A cpu/exetrace.cc 89955SN/A cpu/pc_event.cc 90955SN/A cpu/static_inst.cc 91955SN/A cpu/fast_cpu/fast_cpu.cc 922632Sstever@eecs.umich.edu cpu/full_cpu/bpred.cc 932632Sstever@eecs.umich.edu cpu/full_cpu/commit.cc 94955SN/A cpu/full_cpu/create_vector.cc 951533SN/A cpu/full_cpu/cv_spec_state.cc 962632Sstever@eecs.umich.edu cpu/full_cpu/dd_queue.cc 971533SN/A cpu/full_cpu/dep_link.cc 98955SN/A cpu/full_cpu/dispatch.cc 99955SN/A cpu/full_cpu/dyn_inst.cc 1002632Sstever@eecs.umich.edu cpu/full_cpu/execute.cc 1012632Sstever@eecs.umich.edu cpu/full_cpu/fetch.cc 102955SN/A cpu/full_cpu/floss_reasons.cc 103955SN/A cpu/full_cpu/fu_pool.cc 104955SN/A cpu/full_cpu/full_cpu.cc 105955SN/A cpu/full_cpu/inst_fifo.cc 1062632Sstever@eecs.umich.edu cpu/full_cpu/instpipe.cc 107955SN/A cpu/full_cpu/issue.cc 1082632Sstever@eecs.umich.edu cpu/full_cpu/ls_queue.cc 109955SN/A cpu/full_cpu/machine_queue.cc 110955SN/A cpu/full_cpu/pipetrace.cc 1112632Sstever@eecs.umich.edu cpu/full_cpu/readyq.cc 1122632Sstever@eecs.umich.edu cpu/full_cpu/reg_info.cc 1132632Sstever@eecs.umich.edu cpu/full_cpu/rob_station.cc 1142632Sstever@eecs.umich.edu cpu/full_cpu/spec_memory.cc 1152632Sstever@eecs.umich.edu cpu/full_cpu/spec_state.cc 1162632Sstever@eecs.umich.edu cpu/full_cpu/storebuffer.cc 1172632Sstever@eecs.umich.edu cpu/full_cpu/writeback.cc 1182632Sstever@eecs.umich.edu cpu/full_cpu/iq/iq_station.cc 1192632Sstever@eecs.umich.edu cpu/full_cpu/iq/iqueue.cc 1202632Sstever@eecs.umich.edu cpu/full_cpu/iq/segmented/chain_info.cc 1212632Sstever@eecs.umich.edu cpu/full_cpu/iq/segmented/chain_wire.cc 1222632Sstever@eecs.umich.edu cpu/full_cpu/iq/segmented/iq_seg.cc 1232632Sstever@eecs.umich.edu cpu/full_cpu/iq/segmented/iq_segmented.cc 1242632Sstever@eecs.umich.edu cpu/full_cpu/iq/segmented/seg_chain.cc 1252632Sstever@eecs.umich.edu cpu/full_cpu/iq/seznec/iq_seznec.cc 1262632Sstever@eecs.umich.edu cpu/full_cpu/iq/standard/iq_standard.cc 1272632Sstever@eecs.umich.edu cpu/sampling_cpu/sampling_cpu.cc 1282634Sstever@eecs.umich.edu cpu/simple_cpu/simple_cpu.cc 1292634Sstever@eecs.umich.edu cpu/trace/reader/mem_trace_reader.cc 1302632Sstever@eecs.umich.edu cpu/trace/reader/ibm_reader.cc 1312638Sstever@eecs.umich.edu cpu/trace/reader/itx_reader.cc 1322632Sstever@eecs.umich.edu cpu/trace/reader/m5_reader.cc 1332632Sstever@eecs.umich.edu 1342632Sstever@eecs.umich.edu mem/base_hier.cc 1352632Sstever@eecs.umich.edu mem/base_mem.cc 1362632Sstever@eecs.umich.edu mem/hier_params.cc 1372632Sstever@eecs.umich.edu mem/mem_cmd.cc 1381858SN/A mem/mem_debug.cc 1392638Sstever@eecs.umich.edu mem/mem_req.cc 1402638Sstever@eecs.umich.edu mem/memory_interface.cc 1412638Sstever@eecs.umich.edu mem/bus/base_interface.cc 1422638Sstever@eecs.umich.edu mem/bus/bus.cc 1432638Sstever@eecs.umich.edu mem/bus/bus_bridge.cc 1442638Sstever@eecs.umich.edu mem/bus/bus_bridge_master.cc 1452638Sstever@eecs.umich.edu mem/bus/bus_bridge_slave.cc 1462638Sstever@eecs.umich.edu mem/bus/bus_interface.cc 1472634Sstever@eecs.umich.edu mem/bus/dma_bus_interface.cc 1482634Sstever@eecs.umich.edu mem/bus/dma_interface.cc 1492634Sstever@eecs.umich.edu mem/bus/master_interface.cc 150955SN/A mem/bus/slave_interface.cc 151955SN/A mem/cache/base_cache.cc 152955SN/A mem/cache/cache.cc 153955SN/A mem/cache/cache_builder.cc 154955SN/A mem/cache/coherence/coherence_protocol.cc 155955SN/A mem/cache/coherence/uni_coherence.cc 156955SN/A mem/cache/miss/blocking_buffer.cc 157955SN/A mem/cache/miss/miss_queue.cc 1581858SN/A mem/cache/miss/mshr.cc 1591858SN/A mem/cache/miss/mshr_queue.cc 1602632Sstever@eecs.umich.edu mem/cache/tags/base_tags.cc 161955SN/A mem/cache/tags/cache_tags.cc 1622776Sstever@eecs.umich.edu mem/cache/tags/fa_lru.cc 1631105SN/A mem/cache/tags/iic.cc 1642667Sstever@eecs.umich.edu mem/cache/tags/lru.cc 1652667Sstever@eecs.umich.edu mem/cache/tags/repl/gen.cc 1662667Sstever@eecs.umich.edu mem/cache/tags/repl/repl.cc 1672667Sstever@eecs.umich.edu mem/functional_mem/functional_memory.cc 1682667Sstever@eecs.umich.edu mem/functional_mem/main_memory.cc 1692667Sstever@eecs.umich.edu mem/timing_mem/base_memory.cc 1701869SN/A mem/timing_mem/memory_builder.cc 1711869SN/A mem/timing_mem/simple_mem_bank.cc 1721869SN/A mem/trace/mem_trace_writer.cc 1731869SN/A mem/trace/m5_writer.cc 1741869SN/A 1751065SN/A sim/builder.cc 1762632Sstever@eecs.umich.edu sim/configfile.cc 1772632Sstever@eecs.umich.edu sim/debug.cc 178955SN/A sim/eventq.cc 1791858SN/A sim/main.cc 1801858SN/A sim/param.cc 1811858SN/A sim/profile.cc 1821858SN/A sim/serialize.cc 1831851SN/A sim/sim_events.cc 1841851SN/A sim/sim_exit.cc 1851858SN/A sim/sim_init.cc 1862632Sstever@eecs.umich.edu sim/sim_object.cc 187955SN/A sim/stat_context.cc 1882656Sstever@eecs.umich.edu sim/stat_control.cc 1892656Sstever@eecs.umich.edu sim/sw_context.cc 1902656Sstever@eecs.umich.edu sim/trace_context.cc 1912656Sstever@eecs.umich.edu sim/universe.cc 1922656Sstever@eecs.umich.edu ''') 1932656Sstever@eecs.umich.edu 1942656Sstever@eecs.umich.edu# MySql sources 1952656Sstever@eecs.umich.edumysql_sources = Split(''' 1962656Sstever@eecs.umich.edu base/mysql.cc 1972656Sstever@eecs.umich.edu base/stats/mysql.cc 1982656Sstever@eecs.umich.edu ''') 1992656Sstever@eecs.umich.edu 2002656Sstever@eecs.umich.edu# Full-system sources 2012656Sstever@eecs.umich.edufull_system_sources = Split(''' 2022656Sstever@eecs.umich.edu arch/alpha/alpha_memory.cc 2032656Sstever@eecs.umich.edu arch/alpha/arguments.cc 2042655Sstever@eecs.umich.edu arch/alpha/ev5.cc 2052667Sstever@eecs.umich.edu arch/alpha/osfpal.cc 2062667Sstever@eecs.umich.edu arch/alpha/pseudo_inst.cc 2072667Sstever@eecs.umich.edu arch/alpha/vtophys.cc 2082667Sstever@eecs.umich.edu 2092667Sstever@eecs.umich.edu base/inet.cc 2102667Sstever@eecs.umich.edu base/remote_gdb.cc 2112667Sstever@eecs.umich.edu 2122667Sstever@eecs.umich.edu cpu/intr_control.cc 2132667Sstever@eecs.umich.edu 2142667Sstever@eecs.umich.edu dev/alpha_console.cc 2152667Sstever@eecs.umich.edu dev/baddev.cc 2162667Sstever@eecs.umich.edu dev/simconsole.cc 2172667Sstever@eecs.umich.edu dev/disk_image.cc 2182655Sstever@eecs.umich.edu dev/dma.cc 2191858SN/A dev/etherbus.cc 2201858SN/A dev/etherdump.cc 2212638Sstever@eecs.umich.edu dev/etherint.cc 2222638Sstever@eecs.umich.edu dev/etherlink.cc 2232638Sstever@eecs.umich.edu dev/etherpkt.cc 2242638Sstever@eecs.umich.edu dev/ethertap.cc 2252638Sstever@eecs.umich.edu dev/ide_ctrl.cc 2261858SN/A dev/ide_disk.cc 2271858SN/A dev/io_device.cc 2281858SN/A dev/ns_gige.cc 2291858SN/A dev/etherdev.cc 2301858SN/A dev/pciconfigall.cc 2311858SN/A dev/pcidev.cc 2321858SN/A dev/scsi.cc 2331859SN/A dev/scsi_ctrl.cc 2341858SN/A dev/scsi_disk.cc 2351858SN/A dev/scsi_none.cc 2361858SN/A dev/simple_disk.cc 2371859SN/A dev/tlaser_clock.cc 2381859SN/A dev/tlaser_ipi.cc 2391862SN/A dev/tlaser_mbox.cc 2401862SN/A dev/tlaser_mc146818.cc 2411862SN/A dev/tlaser_node.cc 2421862SN/A dev/tlaser_pcia.cc 2431859SN/A dev/tlaser_pcidev.cc 2441859SN/A dev/tlaser_serial.cc 2451963SN/A dev/turbolaser.cc 2461963SN/A dev/tsunami.cc 2471859SN/A dev/tsunami_cchip.cc 2481859SN/A dev/tsunami_fake.cc 2491859SN/A dev/tsunami_io.cc 2501859SN/A dev/tsunami_pchip.cc 2511859SN/A dev/uart.cc 2521859SN/A 2531859SN/A kern/kernel_stats.cc 2541859SN/A kern/system_events.cc 2551862SN/A kern/linux/linux_events.cc 2561859SN/A kern/linux/linux_syscalls.cc 2571859SN/A kern/linux/linux_system.cc 2581859SN/A kern/tru64/dump_mbuf.cc 2591858SN/A kern/tru64/printf.cc 2601858SN/A kern/tru64/tru64_events.cc 2612139SN/A kern/tru64/tru64_syscalls.cc 2622139SN/A kern/tru64/tru64_system.cc 2632139SN/A 2642155SN/A mem/functional_mem/memory_control.cc 2652623SN/A mem/functional_mem/physical_memory.cc 2662817Sksewell@umich.edu dev/platform.cc 2672792Sktlim@umich.edu 2682155SN/A sim/system.cc 2691869SN/A ''') 2701869SN/A 2711869SN/A# Syscall emulation (non-full-system) sources 2721869SN/Asyscall_emulation_sources = Split(''' 2731869SN/A arch/alpha/alpha_common_syscall_emul.cc 2742139SN/A arch/alpha/alpha_linux_process.cc 2751869SN/A arch/alpha/alpha_tru64_process.cc 2762508SN/A cpu/memtest/memtest.cc 2772508SN/A cpu/trace/trace_cpu.cc 2782508SN/A eio/eio.cc 2792508SN/A eio/exolex.cc 2802635Sstever@eecs.umich.edu eio/libexo.cc 2812635Sstever@eecs.umich.edu sim/process.cc 2821869SN/A sim/syscall_emul.cc 2831869SN/A ''') 2841869SN/A 2851869SN/A# Set up complete list of sources based on configuration. 2861869SN/Asources = base_sources 2871869SN/A 2881869SN/Aif env['FULL_SYSTEM']: 2891869SN/A sources += full_system_sources 2901965SN/Aelse: 2911965SN/A sources += syscall_emulation_sources 2921965SN/A 2931869SN/Aif env['USE_MYSQL']: 2941869SN/A sources += mysql_sources 2952733Sktlim@umich.edu 2961869SN/A################################################### 2971884SN/A# 2981884SN/A# Special build rules. 2991884SN/A# 3001869SN/A################################################### 3011858SN/A 3021869SN/A# base/traceflags.{cc,hh} are generated from base/traceflags.py. 3031869SN/A# $TARGET.base will expand to "<build-dir>/base/traceflags". 3041869SN/Aenv.Command(Split('base/traceflags.hh base/traceflags.cc'), 3051869SN/A 'base/traceflags.py', 3061869SN/A 'python $SOURCE $TARGET.base') 3071858SN/A 3082761Sstever@eecs.umich.edu# several files are generated from arch/$TARGET_ISA/isa_desc. 3091869SN/Aenv.Command(Split('''arch/alpha/decoder.cc 3102733Sktlim@umich.edu arch/alpha/decoder.hh 3112733Sktlim@umich.edu arch/alpha/fast_cpu_exec.cc 3121869SN/A arch/alpha/simple_cpu_exec.cc 3131869SN/A arch/alpha/full_cpu_exec.cc'''), 3141869SN/A 'arch/alpha/isa_desc', 3151869SN/A '$SRCDIR/arch/isa_parser.py $SOURCE $TARGET.dir arch/alpha') 3161869SN/A 3171869SN/A 3181858SN/A# 'targetarch' is a symlink to arch/$TARGET_ISA. 319955SN/Adef link_targetarch(target, source, env): 320955SN/A link_target = str(target[0]) 3211869SN/A link_source = env.subst('$SRCDIR/arch/$TARGET_ISA') 3221869SN/A if not os.path.isdir(link_target): 3231869SN/A print "symlinking", link_source, "to", link_target 3241869SN/A try: 3251869SN/A os.symlink(link_source, link_target) 3261869SN/A except OSError, desc: 3271869SN/A print "Error creating symlink %s: %s" % (link_target, desc) 3281869SN/A sys.exit(-1) 3291869SN/A 3301869SN/A# Tell SCons to use the link_targetarch function to make 'targetarch' 3311869SN/Aenv.Command('targetarch', None, link_targetarch) 3321869SN/A 3331869SN/A 3341869SN/A# This function adds the specified sources to the given build 3351869SN/A# environment, and returns a list of all the corresponding SCons 3361869SN/A# Object nodes (including an extra one for date.cc). We explicitly 3371869SN/A# add the Object nodes so we can set up special dependencies for 3381869SN/A# targetarch and date.cc. 3391869SN/Adef make_objs(sources, env): 3401869SN/A objs = [env.Object(s) for s in sources] 3411869SN/A # make all objects depend on the targetarch link so it gets made first. 3421869SN/A env.Depends(objs, 'targetarch') 3431869SN/A # make date.cc depend on all other objects so it always gets 3441869SN/A # recompiled whenever anything else does 3451869SN/A date_obj = env.Object('base/date.cc') 3461869SN/A env.Depends(date_obj, objs) 3471869SN/A objs.append(date_obj) 3481869SN/A return objs 3491869SN/A 3501869SN/A################################################### 3511869SN/A# 3521869SN/A# Define binaries. Each different build type (debug, opt, etc.) gets 3531869SN/A# a slightly different build environment. 3541869SN/A# 3551869SN/A################################################### 3561869SN/A 3571869SN/A# Include file paths are rooted in this directory. SCons will 3581869SN/A# automatically expand '.' to refer to both the source directory and 3591869SN/A# the corresponding build directory to pick up generated include 3602655Sstever@eecs.umich.edu# files. 3612655Sstever@eecs.umich.eduenv.Append(CPPPATH='.') 3622655Sstever@eecs.umich.edu 3632655Sstever@eecs.umich.edu# Debug binary 3642655Sstever@eecs.umich.edudebug = env.Copy(OBJSUFFIX='.do') 3652655Sstever@eecs.umich.edudebug.Append(CCFLAGS=Split('-g -gstabs+ -O0')) 3662655Sstever@eecs.umich.edudebug.Append(CPPDEFINES='DEBUG') 3672655Sstever@eecs.umich.edudebug.Program(target = 'm5.debug', source = make_objs(sources, debug)) 3682655Sstever@eecs.umich.edu 3692655Sstever@eecs.umich.edu# Optimized binary 3702655Sstever@eecs.umich.eduopt = env.Copy() 3712655Sstever@eecs.umich.eduopt.Append(CCFLAGS=Split('-g -O5')) 3722655Sstever@eecs.umich.eduopt.Program(target = 'm5.opt', source = make_objs(sources, opt)) 3732655Sstever@eecs.umich.edu 3742655Sstever@eecs.umich.edu# "Fast" binary 3752655Sstever@eecs.umich.edufast = env.Copy(OBJSUFFIX='.fo') 3762655Sstever@eecs.umich.edufast.Append(CCFLAGS=Split('-O5')) 3772655Sstever@eecs.umich.edufast.Append(CPPDEFINES='NDEBUG') 3782655Sstever@eecs.umich.edufast.Program(target = 'm5.fast.unstripped', source = make_objs(sources, fast)) 3792655Sstever@eecs.umich.edufast.Command(target = 'm5.fast', source = 'm5.fast.unstripped', 3802655Sstever@eecs.umich.edu action = 'strip $SOURCE -o $TARGET') 3812655Sstever@eecs.umich.edu 3822655Sstever@eecs.umich.edu# Profiled binary 3832655Sstever@eecs.umich.eduprof = env.Copy(OBJSUFFIX='.po') 3842655Sstever@eecs.umich.eduprof.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg') 3852655Sstever@eecs.umich.eduprof.Program(target = 'm5.prof', source = make_objs(sources, prof)) 3862634Sstever@eecs.umich.edu