SConscript revision 1031
12632Sstever@eecs.umich.edu# -*- mode:python -*- 22632Sstever@eecs.umich.edu 32632Sstever@eecs.umich.edu# Copyright (c) 2004 The Regents of The University of Michigan 42632Sstever@eecs.umich.edu# All rights reserved. 52632Sstever@eecs.umich.edu# 62632Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 72632Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are 82632Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright 92632Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 102632Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 112632Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 122632Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution; 132632Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its 142632Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from 152632Sstever@eecs.umich.edu# this software without specific prior written permission. 162632Sstever@eecs.umich.edu# 172632Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182632Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192632Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202632Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212632Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222632Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232632Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242632Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252632Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262632Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272632Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282632Sstever@eecs.umich.edu 292632Sstever@eecs.umich.eduimport os 302632Sstever@eecs.umich.eduimport sys 312030SN/A 322030SN/A# This file defines how to build a particular configuration of M5 332030SN/A# based on variable settings in the 'env' build environment. 342030SN/A 352030SN/A# Import build environment variable from SConstruct. 362030SN/AImport('env') 372224SN/A 382482SN/A################################################### 392224SN/A# 402482SN/A# Define needed sources. 412482SN/A# 422482SN/A################################################### 432482SN/A 442482SN/A# Base sources used by all configurations. 452482SN/Abase_sources = Split(''' 462482SN/A arch/alpha/decoder.cc 472482SN/A arch/alpha/fast_cpu_exec.cc 482458SN/A arch/alpha/simple_cpu_exec.cc 492224SN/A arch/alpha/full_cpu_exec.cc 502482SN/A arch/alpha/faults.cc 512224SN/A arch/alpha/isa_traits.cc 522224SN/A 532224SN/A base/circlebuf.cc 542224SN/A base/copyright.cc 552224SN/A base/cprintf.cc 562224SN/A base/fast_alloc.cc 572224SN/A base/fifo_buffer.cc 582224SN/A base/hostinfo.cc 592224SN/A base/hybrid_pred.cc 602224SN/A base/inifile.cc 612224SN/A base/intmath.cc 622224SN/A base/match.cc 632224SN/A base/misc.cc 642224SN/A base/pollevent.cc 652224SN/A base/python.cc 662224SN/A base/range.cc 672224SN/A base/sat_counter.cc 682458SN/A base/socket.cc 692224SN/A base/statistics.cc 702561SN/A base/str.cc 712561SN/A base/time.cc 722030SN/A base/trace.cc 732030SN/A base/traceflags.cc 742030SN/A base/userinfo.cc 752224SN/A base/compression/lzss_compression.cc 762030SN/A base/loader/aout_object.cc 772224SN/A base/loader/ecoff_object.cc 782224SN/A base/loader/elf_object.cc 792224SN/A base/loader/object_file.cc 802224SN/A base/loader/symtab.cc 812224SN/A base/stats/events.cc 822030SN/A base/stats/python.cc 832030SN/A base/stats/statdb.cc 842030SN/A base/stats/visit.cc 852224SN/A base/stats/text.cc 862224SN/A 872469SN/A cpu/base_cpu.cc 882944Sgblack@eecs.umich.edu cpu/exec_context.cc 892944Sgblack@eecs.umich.edu cpu/exetrace.cc 902944Sgblack@eecs.umich.edu cpu/pc_event.cc 912944Sgblack@eecs.umich.edu cpu/static_inst.cc 922944Sgblack@eecs.umich.edu cpu/fast_cpu/fast_cpu.cc 932944Sgblack@eecs.umich.edu cpu/full_cpu/bpred.cc 942030SN/A cpu/full_cpu/commit.cc 952030SN/A cpu/full_cpu/create_vector.cc 962482SN/A cpu/full_cpu/cv_spec_state.cc 972516SN/A cpu/full_cpu/dd_queue.cc 982516SN/A cpu/full_cpu/dep_link.cc 992516SN/A cpu/full_cpu/dispatch.cc 1002526SN/A cpu/full_cpu/dyn_inst.cc 1012516SN/A cpu/full_cpu/execute.cc 1022516SN/A cpu/full_cpu/fetch.cc 1032482SN/A cpu/full_cpu/floss_reasons.cc 1042482SN/A cpu/full_cpu/fu_pool.cc 1052561SN/A cpu/full_cpu/full_cpu.cc 1062561SN/A cpu/full_cpu/inst_fifo.cc 1072561SN/A cpu/full_cpu/instpipe.cc 1082561SN/A cpu/full_cpu/issue.cc 1092561SN/A cpu/full_cpu/ls_queue.cc 1102561SN/A cpu/full_cpu/machine_queue.cc 1112561SN/A cpu/full_cpu/pipetrace.cc 1122561SN/A cpu/full_cpu/readyq.cc 1132561SN/A cpu/full_cpu/reg_info.cc 1142561SN/A cpu/full_cpu/rob_station.cc 1152561SN/A cpu/full_cpu/spec_memory.cc 1162561SN/A cpu/full_cpu/spec_state.cc 1172561SN/A cpu/full_cpu/storebuffer.cc 1182561SN/A cpu/full_cpu/writeback.cc 1192561SN/A cpu/full_cpu/iq/iq_station.cc 1202561SN/A cpu/full_cpu/iq/iqueue.cc 1212561SN/A cpu/full_cpu/iq/segmented/chain_info.cc 1222561SN/A cpu/full_cpu/iq/segmented/chain_wire.cc 1232561SN/A cpu/full_cpu/iq/segmented/iq_seg.cc 1242561SN/A cpu/full_cpu/iq/segmented/iq_segmented.cc 1252561SN/A cpu/full_cpu/iq/segmented/seg_chain.cc 1262561SN/A cpu/full_cpu/iq/seznec/iq_seznec.cc 1272561SN/A cpu/full_cpu/iq/standard/iq_standard.cc 1282482SN/A cpu/sampling_cpu/sampling_cpu.cc 1292482SN/A cpu/simple_cpu/simple_cpu.cc 1302482SN/A cpu/trace/reader/mem_trace_reader.cc 1312482SN/A cpu/trace/reader/ibm_reader.cc 1322482SN/A cpu/trace/reader/itx_reader.cc 1332482SN/A cpu/trace/reader/m5_reader.cc 1342482SN/A 1352482SN/A mem/base_hier.cc 1362482SN/A mem/base_mem.cc 1372614SN/A mem/hier_params.cc 1382482SN/A mem/mem_cmd.cc 1392482SN/A mem/mem_debug.cc 1402516SN/A mem/mem_req.cc 1412516SN/A mem/memory_interface.cc 1422614SN/A mem/bus/base_interface.cc 1432614SN/A mem/bus/bus.cc 1442516SN/A mem/bus/bus_bridge.cc 1452482SN/A mem/bus/bus_bridge_master.cc 1462614SN/A mem/bus/bus_bridge_slave.cc 1472482SN/A mem/bus/bus_interface.cc 1482516SN/A mem/bus/dma_bus_interface.cc 1492030SN/A mem/bus/dma_interface.cc 1502030SN/A mem/bus/master_interface.cc 1512030SN/A mem/bus/slave_interface.cc 1522030SN/A mem/cache/base_cache.cc 1532516SN/A mem/cache/cache.cc 1542516SN/A mem/cache/cache_builder.cc 1552516SN/A mem/cache/coherence/coherence_protocol.cc 1562516SN/A mem/cache/coherence/uni_coherence.cc 1572516SN/A mem/cache/miss/blocking_buffer.cc 1582944Sgblack@eecs.umich.edu mem/cache/miss/miss_queue.cc 1592944Sgblack@eecs.umich.edu mem/cache/miss/mshr.cc 1602944Sgblack@eecs.umich.edu mem/cache/miss/mshr_queue.cc 1612944Sgblack@eecs.umich.edu mem/cache/tags/base_tags.cc 1622944Sgblack@eecs.umich.edu mem/cache/tags/cache_tags.cc 1632944Sgblack@eecs.umich.edu mem/cache/tags/fa_lru.cc 1642944Sgblack@eecs.umich.edu mem/cache/tags/iic.cc 1652944Sgblack@eecs.umich.edu mem/cache/tags/lru.cc 1662944Sgblack@eecs.umich.edu mem/cache/tags/split.cc 1672944Sgblack@eecs.umich.edu mem/cache/tags/split_lifo.cc 1682944Sgblack@eecs.umich.edu mem/cache/tags/split_lru.cc 1692944Sgblack@eecs.umich.edu mem/cache/tags/repl/gen.cc 1702944Sgblack@eecs.umich.edu mem/cache/tags/repl/repl.cc 1712469SN/A mem/functional_mem/functional_memory.cc 1722944Sgblack@eecs.umich.edu mem/functional_mem/main_memory.cc 1732944Sgblack@eecs.umich.edu mem/timing_mem/base_memory.cc 1742944Sgblack@eecs.umich.edu mem/timing_mem/memory_builder.cc 1752944Sgblack@eecs.umich.edu mem/timing_mem/simple_mem_bank.cc 1762944Sgblack@eecs.umich.edu mem/trace/mem_trace_writer.cc 1772944Sgblack@eecs.umich.edu mem/trace/m5_writer.cc 1782944Sgblack@eecs.umich.edu 1792944Sgblack@eecs.umich.edu sim/builder.cc 1802944Sgblack@eecs.umich.edu sim/configfile.cc 1812944Sgblack@eecs.umich.edu sim/debug.cc 1822944Sgblack@eecs.umich.edu sim/eventq.cc 1832944Sgblack@eecs.umich.edu sim/main.cc 1842944Sgblack@eecs.umich.edu sim/param.cc 1852944Sgblack@eecs.umich.edu sim/profile.cc 1862944Sgblack@eecs.umich.edu sim/serialize.cc 1872469SN/A sim/sim_events.cc 1882516SN/A sim/sim_exit.cc 1892516SN/A sim/sim_init.cc 1902516SN/A sim/sim_object.cc 1912516SN/A sim/stat_context.cc 1922516SN/A sim/stat_control.cc 1932516SN/A sim/sw_context.cc 1942516SN/A sim/trace_context.cc 1952516SN/A sim/universe.cc 1962516SN/A ''') 1972516SN/A 1982516SN/A# MySql sources 1992516SN/Amysql_sources = Split(''' 2002516SN/A base/mysql.cc 2012516SN/A base/stats/mysql.cc 2022516SN/A ''') 2032516SN/A 2042469SN/A# Full-system sources 2052516SN/Afull_system_sources = Split(''' 2062469SN/A arch/alpha/alpha_memory.cc 2072469SN/A arch/alpha/arguments.cc 2082469SN/A arch/alpha/ev5.cc 2092224SN/A arch/alpha/osfpal.cc 2102224SN/A arch/alpha/pseudo_inst.cc 2112030SN/A arch/alpha/vtophys.cc 2122224SN/A 2132030SN/A base/inet.cc 2142516SN/A base/remote_gdb.cc 2152030SN/A 2162224SN/A cpu/intr_control.cc 2172224SN/A 2182224SN/A dev/alpha_console.cc 2192224SN/A dev/baddev.cc 2202224SN/A dev/simconsole.cc 2212224SN/A dev/disk_image.cc 2222224SN/A dev/dma.cc 2232224SN/A dev/etherbus.cc 2242224SN/A dev/etherdump.cc 2252224SN/A dev/etherint.cc 2262224SN/A dev/etherlink.cc 2272224SN/A dev/etherpkt.cc 2282224SN/A dev/ethertap.cc 2292224SN/A dev/ide_ctrl.cc 2302224SN/A dev/ide_disk.cc 2312224SN/A dev/io_device.cc 2322224SN/A dev/ns_gige.cc 2332030SN/A dev/etherdev.cc 2342224SN/A dev/pciconfigall.cc 2352224SN/A dev/pcidev.cc 2362224SN/A dev/scsi.cc 2372030SN/A dev/scsi_ctrl.cc 2382224SN/A dev/scsi_disk.cc 2392030SN/A dev/scsi_none.cc 2402030SN/A dev/simple_disk.cc 2412482SN/A dev/tlaser_clock.cc 2422030SN/A dev/tlaser_ipi.cc 2432482SN/A dev/tlaser_mbox.cc 2442482SN/A dev/tlaser_mc146818.cc 2452224SN/A dev/tlaser_node.cc 2462224SN/A dev/tlaser_pcia.cc 2472224SN/A dev/tlaser_pcidev.cc 2482224SN/A dev/tlaser_serial.cc 2492224SN/A dev/turbolaser.cc 2502224SN/A dev/tsunami.cc 2512224SN/A dev/tsunami_cchip.cc 2522482SN/A dev/tsunami_fake.cc 2532224SN/A dev/tsunami_io.cc 2542482SN/A dev/tsunami_pchip.cc 2552224SN/A dev/uart.cc 2562482SN/A 2572224SN/A kern/kernel_stats.cc 2582482SN/A kern/system_events.cc 2592224SN/A kern/linux/linux_events.cc 2602482SN/A kern/linux/linux_syscalls.cc 2612224SN/A kern/linux/linux_system.cc 2622482SN/A kern/tru64/dump_mbuf.cc 2632224SN/A kern/tru64/printf.cc 2642482SN/A kern/tru64/tru64_events.cc 2652224SN/A kern/tru64/tru64_syscalls.cc 2662482SN/A kern/tru64/tru64_system.cc 2672224SN/A 2682482SN/A mem/functional_mem/memory_control.cc 2692224SN/A mem/functional_mem/physical_memory.cc 2702482SN/A dev/platform.cc 2712224SN/A 2722482SN/A sim/system.cc 2732224SN/A ''') 2742482SN/A 2752224SN/A# Syscall emulation (non-full-system) sources 2762482SN/Asyscall_emulation_sources = Split(''' 2772224SN/A arch/alpha/alpha_common_syscall_emul.cc 2782482SN/A arch/alpha/alpha_linux_process.cc 2792224SN/A arch/alpha/alpha_tru64_process.cc 2802469SN/A cpu/memtest/memtest.cc 2812469SN/A cpu/trace/trace_cpu.cc 2822030SN/A eio/eio.cc 2832030SN/A eio/exolex.cc 2842030SN/A eio/libexo.cc 285 sim/process.cc 286 sim/syscall_emul.cc 287 ''') 288 289# Set up complete list of sources based on configuration. 290sources = base_sources 291 292if env['FULL_SYSTEM']: 293 sources += full_system_sources 294else: 295 sources += syscall_emulation_sources 296 297if env['USE_MYSQL']: 298 sources += mysql_sources 299 300################################################### 301# 302# Special build rules. 303# 304################################################### 305 306# base/traceflags.{cc,hh} are generated from base/traceflags.py. 307# $TARGET.base will expand to "<build-dir>/base/traceflags". 308env.Command(Split('base/traceflags.hh base/traceflags.cc'), 309 'base/traceflags.py', 310 'python $SOURCE $TARGET.base') 311 312# several files are generated from arch/$TARGET_ISA/isa_desc. 313env.Command(Split('''arch/alpha/decoder.cc 314 arch/alpha/decoder.hh 315 arch/alpha/fast_cpu_exec.cc 316 arch/alpha/simple_cpu_exec.cc 317 arch/alpha/full_cpu_exec.cc'''), 318 Split('''arch/alpha/isa_desc 319 arch/isa_parser.py'''), 320 '$SRCDIR/arch/isa_parser.py $SOURCE $TARGET.dir arch/alpha') 321 322 323# 'targetarch' is a symlink to arch/$TARGET_ISA. 324def link_targetarch(target, source, env): 325 link_target = str(target[0]) 326 link_source = env.subst('$SRCDIR/arch/$TARGET_ISA') 327 if not os.path.isdir(link_target): 328 print "symlinking", link_source, "to", link_target 329 try: 330 os.symlink(link_source, link_target) 331 except OSError, desc: 332 print "Error creating symlink %s: %s" % (link_target, desc) 333 sys.exit(-1) 334 335# Tell SCons to use the link_targetarch function to make 'targetarch' 336env.Command('targetarch', None, link_targetarch) 337 338 339# This function adds the specified sources to the given build 340# environment, and returns a list of all the corresponding SCons 341# Object nodes (including an extra one for date.cc). We explicitly 342# add the Object nodes so we can set up special dependencies for 343# targetarch and date.cc. 344def make_objs(sources, env): 345 objs = [env.Object(s) for s in sources] 346 # make all objects depend on the targetarch link so it gets made first. 347 env.Depends(objs, 'targetarch') 348 # make date.cc depend on all other objects so it always gets 349 # recompiled whenever anything else does 350 date_obj = env.Object('base/date.cc') 351 env.Depends(date_obj, objs) 352 objs.append(date_obj) 353 return objs 354 355################################################### 356# 357# Define binaries. Each different build type (debug, opt, etc.) gets 358# a slightly different build environment. 359# 360################################################### 361 362# Include file paths are rooted in this directory. SCons will 363# automatically expand '.' to refer to both the source directory and 364# the corresponding build directory to pick up generated include 365# files. 366env.Append(CPPPATH='.') 367 368# Debug binary 369debug = env.Copy(OBJSUFFIX='.do') 370debug.Append(CCFLAGS=Split('-g -gstabs+ -O0')) 371debug.Append(CPPDEFINES='DEBUG') 372debug.Program(target = 'm5.debug', source = make_objs(sources, debug)) 373 374# Optimized binary 375opt = env.Copy() 376opt.Append(CCFLAGS=Split('-g -O5')) 377opt.Program(target = 'm5.opt', source = make_objs(sources, opt)) 378 379# "Fast" binary 380fast = env.Copy(OBJSUFFIX='.fo') 381fast.Append(CCFLAGS=Split('-O5')) 382fast.Append(CPPDEFINES='NDEBUG') 383fast.Program(target = 'm5.fast.unstripped', source = make_objs(sources, fast)) 384fast.Command(target = 'm5.fast', source = 'm5.fast.unstripped', 385 action = 'strip $SOURCE -o $TARGET') 386 387# Profiled binary 388prof = env.Copy(OBJSUFFIX='.po') 389prof.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg') 390prof.Program(target = 'm5.prof', source = make_objs(sources, prof)) 391