SConscript revision 3045
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/Aimport os 32955SN/Aimport sys 331608SN/Afrom os.path import isdir 34955SN/A 35955SN/A# This file defines how to build a particular configuration of M5 36955SN/A# based on variable settings in the 'env' build environment. 37955SN/A 38955SN/A# Import build environment variable from SConstruct. 39955SN/AImport('env') 40955SN/A 41955SN/A################################################### 42955SN/A# 43955SN/A# Define needed sources. 44955SN/A# 45955SN/A################################################### 46955SN/A 47955SN/A# Base sources used by all configurations. 482023SN/A 49955SN/Abase_sources = Split(''' 50955SN/A base/circlebuf.cc 51955SN/A base/cprintf.cc 52955SN/A base/fast_alloc.cc 53955SN/A base/fifo_buffer.cc 54955SN/A base/hostinfo.cc 55955SN/A base/hybrid_pred.cc 56955SN/A base/inifile.cc 57955SN/A base/intmath.cc 581031SN/A base/match.cc 59955SN/A base/misc.cc 601388SN/A base/output.cc 61955SN/A base/pollevent.cc 62955SN/A base/range.cc 631296SN/A base/random.cc 64955SN/A base/sat_counter.cc 65955SN/A base/socket.cc 66955SN/A base/statistics.cc 67955SN/A base/str.cc 68955SN/A base/time.cc 69955SN/A base/trace.cc 70955SN/A base/traceflags.cc 71955SN/A base/userinfo.cc 72955SN/A base/compression/lzss_compression.cc 73955SN/A base/loader/aout_object.cc 74955SN/A base/loader/ecoff_object.cc 75955SN/A base/loader/elf_object.cc 76955SN/A base/loader/object_file.cc 77955SN/A base/loader/symtab.cc 78955SN/A base/stats/events.cc 79955SN/A base/stats/statdb.cc 80955SN/A base/stats/visit.cc 81955SN/A base/stats/text.cc 82955SN/A 832325SN/A cpu/activity.cc 841717SN/A cpu/base.cc 852652Ssaidi@eecs.umich.edu cpu/cpuevent.cc 86955SN/A cpu/exetrace.cc 872736Sktlim@umich.edu cpu/func_unit.cc 882410SN/A cpu/op_class.cc 89955SN/A cpu/pc_event.cc 902290SN/A cpu/quiesce_event.cc 91955SN/A cpu/static_inst.cc 922683Sktlim@umich.edu cpu/simple_thread.cc 932683Sktlim@umich.edu cpu/thread_state.cc 942669Sktlim@umich.edu 952568SN/A mem/bridge.cc 962568SN/A mem/bus.cc 973012Ssaidi@eecs.umich.edu mem/dram.cc 982462SN/A mem/mem_object.cc 992568SN/A mem/packet.cc 1002395SN/A mem/physical.cc 1012405SN/A mem/port.cc 1022914Ssaidi@eecs.umich.edu mem/tport.cc 103955SN/A 1042811Srdreslin@umich.edu mem/cache/base_cache.cc 1052811Srdreslin@umich.edu mem/cache/cache.cc 1062811Srdreslin@umich.edu mem/cache/coherence/coherence_protocol.cc 1072811Srdreslin@umich.edu mem/cache/coherence/uni_coherence.cc 1082811Srdreslin@umich.edu mem/cache/miss/blocking_buffer.cc 1092811Srdreslin@umich.edu mem/cache/miss/miss_queue.cc 1102811Srdreslin@umich.edu mem/cache/miss/mshr.cc 1112811Srdreslin@umich.edu mem/cache/miss/mshr_queue.cc 1122811Srdreslin@umich.edu mem/cache/prefetch/base_prefetcher.cc 1132811Srdreslin@umich.edu mem/cache/prefetch/ghb_prefetcher.cc 1142811Srdreslin@umich.edu mem/cache/prefetch/prefetcher.cc 1152811Srdreslin@umich.edu mem/cache/prefetch/stride_prefetcher.cc 1162811Srdreslin@umich.edu mem/cache/prefetch/tagged_prefetcher.cc 1172811Srdreslin@umich.edu mem/cache/tags/base_tags.cc 1182811Srdreslin@umich.edu mem/cache/tags/cache_tags.cc 1192811Srdreslin@umich.edu mem/cache/tags/fa_lru.cc 1202814Srdreslin@umich.edu mem/cache/tags/iic.cc 1212811Srdreslin@umich.edu mem/cache/tags/lru.cc 1222811Srdreslin@umich.edu mem/cache/tags/repl/gen.cc 1232811Srdreslin@umich.edu mem/cache/tags/repl/repl.cc 1242811Srdreslin@umich.edu mem/cache/tags/split.cc 1252811Srdreslin@umich.edu mem/cache/tags/split_lifo.cc 1262811Srdreslin@umich.edu mem/cache/tags/split_lru.cc 1272811Srdreslin@umich.edu 1282813Srdreslin@umich.edu mem/cache/cache_builder.cc 1292813Srdreslin@umich.edu 130955SN/A sim/builder.cc 131955SN/A sim/debug.cc 132955SN/A sim/eventq.cc 1332090SN/A sim/faults.cc 134955SN/A sim/main.cc 1352763Sstever@eecs.umich.edu python/swig/cc_main_wrap.cc 136955SN/A sim/param.cc 1371696SN/A sim/root.cc 138955SN/A sim/serialize.cc 139955SN/A sim/sim_events.cc 140955SN/A sim/sim_object.cc 1411127SN/A sim/startup.cc 142955SN/A sim/stat_context.cc 143955SN/A sim/stat_control.cc 1442379SN/A sim/system.cc 145955SN/A sim/trace_context.cc 146955SN/A ''') 147955SN/A 1482155SN/A# Old FullCPU sources 1492155SN/Afull_cpu_sources = Split(''' 1502155SN/A encumbered/cpu/full/bpred.cc 1512155SN/A encumbered/cpu/full/commit.cc 1522155SN/A encumbered/cpu/full/cpu.cc 1532155SN/A encumbered/cpu/full/create_vector.cc 1542155SN/A encumbered/cpu/full/cv_spec_state.cc 1552155SN/A encumbered/cpu/full/dd_queue.cc 1562155SN/A encumbered/cpu/full/dep_link.cc 1572155SN/A encumbered/cpu/full/dispatch.cc 1582155SN/A encumbered/cpu/full/dyn_inst.cc 1592155SN/A encumbered/cpu/full/execute.cc 1602155SN/A encumbered/cpu/full/fetch.cc 1612155SN/A encumbered/cpu/full/floss_reasons.cc 1622155SN/A encumbered/cpu/full/fu_pool.cc 1632155SN/A encumbered/cpu/full/inst_fifo.cc 1642155SN/A encumbered/cpu/full/instpipe.cc 1652155SN/A encumbered/cpu/full/issue.cc 1662155SN/A encumbered/cpu/full/ls_queue.cc 1672155SN/A encumbered/cpu/full/machine_queue.cc 1682155SN/A encumbered/cpu/full/pipetrace.cc 1692155SN/A encumbered/cpu/full/readyq.cc 1702155SN/A encumbered/cpu/full/reg_info.cc 1712155SN/A encumbered/cpu/full/rob_station.cc 1722155SN/A encumbered/cpu/full/spec_memory.cc 1732155SN/A encumbered/cpu/full/spec_state.cc 1742155SN/A encumbered/cpu/full/storebuffer.cc 1752155SN/A encumbered/cpu/full/writeback.cc 1762155SN/A encumbered/cpu/full/iq/iq_station.cc 1772155SN/A encumbered/cpu/full/iq/iqueue.cc 1782155SN/A encumbered/cpu/full/iq/segmented/chain_info.cc 1792155SN/A encumbered/cpu/full/iq/segmented/chain_wire.cc 1802155SN/A encumbered/cpu/full/iq/segmented/iq_seg.cc 1812155SN/A encumbered/cpu/full/iq/segmented/iq_segmented.cc 1822155SN/A encumbered/cpu/full/iq/segmented/seg_chain.cc 1832155SN/A encumbered/cpu/full/iq/seznec/iq_seznec.cc 1842155SN/A encumbered/cpu/full/iq/standard/iq_standard.cc 1852155SN/A ''') 1862155SN/A 1872422SN/Atrace_reader_sources = Split(''' 1882422SN/A cpu/trace/reader/mem_trace_reader.cc 1892422SN/A cpu/trace/reader/ibm_reader.cc 1902422SN/A cpu/trace/reader/itx_reader.cc 1912422SN/A cpu/trace/reader/m5_reader.cc 1922422SN/A cpu/trace/opt_cpu.cc 1932422SN/A cpu/trace/trace_cpu.cc 1942397SN/A ''') 1952397SN/A 1962422SN/A 1972422SN/A 198955SN/A# MySql sources 199955SN/Amysql_sources = Split(''' 200955SN/A base/mysql.cc 201955SN/A base/stats/mysql.cc 202955SN/A ''') 203955SN/A 204955SN/A# Full-system sources 205955SN/Afull_system_sources = Split(''' 2061078SN/A base/crc.cc 207955SN/A base/inet.cc 208955SN/A base/remote_gdb.cc 209955SN/A 210955SN/A cpu/intr_control.cc 2111917SN/A cpu/profile.cc 212955SN/A 213955SN/A dev/alpha_console.cc 214955SN/A dev/baddev.cc 215955SN/A dev/disk_image.cc 216974SN/A dev/etherbus.cc 217955SN/A dev/etherdump.cc 218955SN/A dev/etherint.cc 219955SN/A dev/etherlink.cc 220955SN/A dev/etherpkt.cc 2212566SN/A dev/ethertap.cc 2222566SN/A dev/ide_ctrl.cc 223955SN/A dev/ide_disk.cc 224955SN/A dev/io_device.cc 2252539SN/A dev/isa_fake.cc 226955SN/A dev/ns_gige.cc 227955SN/A dev/pciconfigall.cc 228955SN/A dev/pcidev.cc 2291817SN/A dev/pcifake.cc 2301154SN/A dev/pktfifo.cc 2311840SN/A dev/platform.cc 2322522SN/A dev/simconsole.cc 2332522SN/A dev/simple_disk.cc 234955SN/A dev/tsunami.cc 235955SN/A dev/tsunami_cchip.cc 236955SN/A dev/tsunami_io.cc 2372539SN/A dev/tsunami_fake.cc 238955SN/A dev/tsunami_pchip.cc 2392539SN/A 240955SN/A dev/uart.cc 2411730SN/A dev/uart8250.cc 242955SN/A 243955SN/A kern/kernel_stats.cc 244955SN/A kern/system_events.cc 2452212SN/A kern/linux/events.cc 246955SN/A kern/linux/linux_syscalls.cc 2471040SN/A kern/linux/printk.cc 2482507SN/A 2492521SN/A mem/vport.cc 2502521SN/A 2512507SN/A sim/pseudo_inst.cc 2522507SN/A ''') 2532989Ssaidi@eecs.umich.edu #dev/sinic.cc 2542507SN/A 2552521SN/A 2562507SN/Aif env['TARGET_ISA'] == 'alpha': 2572507SN/A full_system_sources += Split(''' 258955SN/A kern/tru64/dump_mbuf.cc 259955SN/A kern/tru64/printf.cc 260955SN/A kern/tru64/tru64_events.cc 261955SN/A kern/tru64/tru64_syscalls.cc 262955SN/A ''') 263955SN/A 2641742SN/A# turbolaser encumbered sources 2651742SN/Aturbolaser_sources = Split(''' 2661742SN/A encumbered/dev/dma.cc 2671742SN/A encumbered/dev/etherdev.cc 2681742SN/A encumbered/dev/scsi.cc 2691742SN/A encumbered/dev/scsi_ctrl.cc 2701742SN/A encumbered/dev/scsi_disk.cc 2711742SN/A encumbered/dev/scsi_none.cc 2721742SN/A encumbered/dev/tlaser_clock.cc 2731742SN/A encumbered/dev/tlaser_ipi.cc 2741742SN/A encumbered/dev/tlaser_mbox.cc 2751742SN/A encumbered/dev/tlaser_mc146818.cc 2761742SN/A encumbered/dev/tlaser_node.cc 2771742SN/A encumbered/dev/tlaser_pcia.cc 2781742SN/A encumbered/dev/tlaser_pcidev.cc 2791742SN/A encumbered/dev/tlaser_serial.cc 2801742SN/A encumbered/dev/turbolaser.cc 2811742SN/A encumbered/dev/uart8530.cc 2821742SN/A ''') 2831742SN/A 284955SN/A# Syscall emulation (non-full-system) sources 285955SN/Asyscall_emulation_sources = Split(''' 2862520SN/A mem/translating_port.cc 2872517SN/A mem/page_table.cc 2882253SN/A sim/process.cc 2892253SN/A sim/syscall_emul.cc 2902253SN/A ''') 2912253SN/A 2922553SN/A#if env['TARGET_ISA'] == 'alpha': 2932553SN/A# syscall_emulation_sources += Split(''' 2942553SN/A# kern/tru64/tru64.cc 2952553SN/A# ''') 2962507SN/A 2972470SN/Aalpha_eio_sources = Split(''' 2981744SN/A encumbered/eio/exolex.cc 2991744SN/A encumbered/eio/libexo.cc 3002470SN/A encumbered/eio/eio.cc 3012470SN/A ''') 3022470SN/A 3032919Sktlim@umich.eduif env['TARGET_ISA'] == 'alpha': 3042470SN/A syscall_emulation_sources += alpha_eio_sources 3052470SN/A 3062400SN/Amemtest_sources = Split(''' 3072400SN/A cpu/memtest/memtest.cc 308955SN/A ''') 309955SN/A 3102667Sstever@eecs.umich.edu# Include file paths are rooted in this directory. SCons will 3112667Sstever@eecs.umich.edu# automatically expand '.' to refer to both the source directory and 3122667Sstever@eecs.umich.edu# the corresponding build directory to pick up generated include 3132667Sstever@eecs.umich.edu# files. 3142667Sstever@eecs.umich.eduenv.Append(CPPPATH=Dir('.')) 3152667Sstever@eecs.umich.edu 3162037SN/A# Add a flag defining what THE_ISA should be for all compilation 3172037SN/Aenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 3182037SN/A 3192667Sstever@eecs.umich.eduarch_sources = SConscript('arch/SConscript', exports = 'env') 3202139SN/A 3212667Sstever@eecs.umich.educpu_sources = SConscript('cpu/SConscript', exports = 'env') 3222155SN/A 3232155SN/A# This is outside of cpu/SConscript since the source directory isn't 3242155SN/A# underneath 'cpu'. 3252155SN/Aif 'FullCPU' in env['CPU_MODELS']: 3262155SN/A cpu_sources += full_cpu_sources 3272155SN/A 328955SN/A# Set up complete list of sources based on configuration. 3292155SN/Asources = base_sources + arch_sources + cpu_sources 330955SN/A 331955SN/Aif env['FULL_SYSTEM']: 332955SN/A sources += full_system_sources 3331742SN/A if env['ALPHA_TLASER']: 3341742SN/A sources += turbolaser_sources 335955SN/Aelse: 336955SN/A sources += syscall_emulation_sources 337955SN/A 3381858SN/Aif env['USE_MYSQL']: 339955SN/A sources += mysql_sources 3401858SN/A 3411858SN/Afor opt in env.ExportOptions: 3421858SN/A env.ConfigFile(opt) 3431085SN/A 344955SN/A################################################### 345955SN/A# 346955SN/A# Special build rules. 347955SN/A# 348955SN/A################################################### 349955SN/A 350955SN/A# base/traceflags.{cc,hh} are generated from base/traceflags.py. 351955SN/A# $TARGET.base will expand to "<build-dir>/base/traceflags". 352955SN/Aenv.Command(Split('base/traceflags.hh base/traceflags.cc'), 353955SN/A 'base/traceflags.py', 354955SN/A 'python $SOURCE $TARGET.base') 355955SN/A 3562667Sstever@eecs.umich.eduSConscript('python/SConscript', exports = ['env']) 3571045SN/A 358955SN/A# This function adds the specified sources to the given build 359955SN/A# environment, and returns a list of all the corresponding SCons 360955SN/A# Object nodes (including an extra one for date.cc). We explicitly 361955SN/A# add the Object nodes so we can set up special dependencies for 3621108SN/A# date.cc. 363955SN/Adef make_objs(sources, env): 364955SN/A objs = [env.Object(s) for s in sources] 365955SN/A # make date.cc depend on all other objects so it always gets 366955SN/A # recompiled whenever anything else does 367955SN/A date_obj = env.Object('base/date.cc') 368955SN/A env.Depends(date_obj, objs) 369955SN/A objs.append(date_obj) 370955SN/A return objs 371955SN/A 372955SN/A################################################### 373955SN/A# 374955SN/A# Define binaries. Each different build type (debug, opt, etc.) gets 375955SN/A# a slightly different build environment. 376955SN/A# 377955SN/A################################################### 378955SN/A 3792655Sstever@eecs.umich.edu# List of constructed environments to pass back to SConstruct 3802655Sstever@eecs.umich.eduenvList = [] 3812655Sstever@eecs.umich.edu 3822655Sstever@eecs.umich.edu# Function to create a new build environment as clone of current 3832655Sstever@eecs.umich.edu# environment 'env' with modified object suffix and optional stripped 3842655Sstever@eecs.umich.edu# binary. Additional keyword arguments are appended to corresponding 3852655Sstever@eecs.umich.edu# build environment vars. 3862655Sstever@eecs.umich.edudef makeEnv(label, objsfx, strip = False, **kwargs): 3872655Sstever@eecs.umich.edu newEnv = env.Copy(OBJSUFFIX=objsfx) 3882655Sstever@eecs.umich.edu newEnv.Label = label 3892655Sstever@eecs.umich.edu newEnv.Append(**kwargs) 3902655Sstever@eecs.umich.edu exe = 'm5.' + label # final executable 3912655Sstever@eecs.umich.edu bin = exe + '.bin' # executable w/o appended Python zip archive 3922655Sstever@eecs.umich.edu newEnv.Program(bin, make_objs(sources, newEnv)) 3932655Sstever@eecs.umich.edu if strip: 3942655Sstever@eecs.umich.edu stripped_bin = bin + '.stripped' 3952655Sstever@eecs.umich.edu newEnv.Command(stripped_bin, bin, 'strip $SOURCE -o $TARGET') 3962655Sstever@eecs.umich.edu bin = stripped_bin 3972655Sstever@eecs.umich.edu targets = newEnv.Concat(exe, [bin, 'python/m5py.zip']) 3982655Sstever@eecs.umich.edu newEnv.M5Binary = targets[0] 3992655Sstever@eecs.umich.edu envList.append(newEnv) 4002655Sstever@eecs.umich.edu 401955SN/A# Debug binary 4022655Sstever@eecs.umich.edumakeEnv('debug', '.do', 4032655Sstever@eecs.umich.edu CCFLAGS = Split('-g3 -gdwarf-2 -O0'), 4042655Sstever@eecs.umich.edu CPPDEFINES = 'DEBUG') 405955SN/A 406955SN/A# Optimized binary 4072655Sstever@eecs.umich.edumakeEnv('opt', '.o', 4082655Sstever@eecs.umich.edu CCFLAGS = Split('-g -O3')) 409955SN/A 410955SN/A# "Fast" binary 4112655Sstever@eecs.umich.edumakeEnv('fast', '.fo', strip = True, 4122655Sstever@eecs.umich.edu CCFLAGS = Split('-O3'), 4132655Sstever@eecs.umich.edu CPPDEFINES = 'NDEBUG') 414955SN/A 415955SN/A# Profiled binary 4162655Sstever@eecs.umich.edumakeEnv('prof', '.po', 4172655Sstever@eecs.umich.edu CCFLAGS = Split('-O3 -g -pg'), 4182655Sstever@eecs.umich.edu LINKFLAGS = '-pg') 4191869SN/A 4201869SN/AReturn('envList') 421