SConscript revision 2652
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. 28955SN/A 29955SN/Aimport os 30955SN/Aimport sys 311608SN/Afrom os.path import isdir 32955SN/A 33955SN/A# This file defines how to build a particular configuration of M5 34955SN/A# based on variable settings in the 'env' build environment. 35955SN/A 36955SN/A# Import build environment variable from SConstruct. 37955SN/AImport('env') 38955SN/A 39955SN/A################################################### 40955SN/A# 41955SN/A# Define needed sources. 42955SN/A# 43955SN/A################################################### 44955SN/A 45955SN/A# Base sources used by all configurations. 462023SN/A 47955SN/Abase_sources = Split(''' 48955SN/A base/circlebuf.cc 49955SN/A base/copyright.cc 50955SN/A base/cprintf.cc 511310SN/A base/embedfile.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 652609SN/A base/serializer.cc 66955SN/A base/socket.cc 67955SN/A base/statistics.cc 68955SN/A base/str.cc 69955SN/A base/time.cc 70955SN/A base/trace.cc 71955SN/A base/traceflags.cc 72955SN/A base/userinfo.cc 73955SN/A base/compression/lzss_compression.cc 74955SN/A base/loader/aout_object.cc 75955SN/A base/loader/ecoff_object.cc 76955SN/A base/loader/elf_object.cc 77955SN/A base/loader/object_file.cc 78955SN/A base/loader/symtab.cc 79955SN/A base/stats/events.cc 80955SN/A base/stats/statdb.cc 81955SN/A base/stats/visit.cc 82955SN/A base/stats/text.cc 83955SN/A 841717SN/A cpu/base.cc 852190SN/A cpu/cpu_exec_context.cc 862652Ssaidi@eecs.umich.edu cpu/cpuevent.cc 87955SN/A cpu/exetrace.cc 882410SN/A cpu/op_class.cc 89955SN/A cpu/pc_event.cc 90955SN/A cpu/static_inst.cc 911717SN/A cpu/sampler/sampler.cc 922568SN/A 932568SN/A mem/bridge.cc 942568SN/A mem/bus.cc 952499SN/A mem/connector.cc 962462SN/A mem/mem_object.cc 972568SN/A mem/packet.cc 982395SN/A mem/physical.cc 992405SN/A mem/port.cc 1002568SN/A mem/request.cc 101955SN/A 1021511SN/A python/pyconfig.cc 1031511SN/A python/embedded_py.cc 1041511SN/A 105955SN/A sim/builder.cc 106955SN/A sim/configfile.cc 107955SN/A sim/debug.cc 108955SN/A sim/eventq.cc 1092090SN/A sim/faults.cc 110955SN/A sim/main.cc 111955SN/A sim/param.cc 112955SN/A sim/profile.cc 1131696SN/A sim/root.cc 114955SN/A sim/serialize.cc 115955SN/A sim/sim_events.cc 116955SN/A sim/sim_exit.cc 117955SN/A sim/sim_object.cc 1181127SN/A sim/startup.cc 119955SN/A sim/stat_context.cc 120955SN/A sim/stat_control.cc 1212379SN/A sim/system.cc 122955SN/A sim/trace_context.cc 123955SN/A ''') 124955SN/A 1252155SN/A# Old FullCPU sources 1262155SN/Afull_cpu_sources = Split(''' 1272155SN/A encumbered/cpu/full/bpred.cc 1282155SN/A encumbered/cpu/full/commit.cc 1292155SN/A encumbered/cpu/full/cpu.cc 1302155SN/A encumbered/cpu/full/create_vector.cc 1312155SN/A encumbered/cpu/full/cv_spec_state.cc 1322155SN/A encumbered/cpu/full/dd_queue.cc 1332155SN/A encumbered/cpu/full/dep_link.cc 1342155SN/A encumbered/cpu/full/dispatch.cc 1352155SN/A encumbered/cpu/full/dyn_inst.cc 1362155SN/A encumbered/cpu/full/execute.cc 1372155SN/A encumbered/cpu/full/fetch.cc 1382155SN/A encumbered/cpu/full/floss_reasons.cc 1392155SN/A encumbered/cpu/full/fu_pool.cc 1402155SN/A encumbered/cpu/full/inst_fifo.cc 1412155SN/A encumbered/cpu/full/instpipe.cc 1422155SN/A encumbered/cpu/full/issue.cc 1432155SN/A encumbered/cpu/full/ls_queue.cc 1442155SN/A encumbered/cpu/full/machine_queue.cc 1452155SN/A encumbered/cpu/full/pipetrace.cc 1462155SN/A encumbered/cpu/full/readyq.cc 1472155SN/A encumbered/cpu/full/reg_info.cc 1482155SN/A encumbered/cpu/full/rob_station.cc 1492155SN/A encumbered/cpu/full/spec_memory.cc 1502155SN/A encumbered/cpu/full/spec_state.cc 1512155SN/A encumbered/cpu/full/storebuffer.cc 1522155SN/A encumbered/cpu/full/writeback.cc 1532155SN/A encumbered/cpu/full/iq/iq_station.cc 1542155SN/A encumbered/cpu/full/iq/iqueue.cc 1552155SN/A encumbered/cpu/full/iq/segmented/chain_info.cc 1562155SN/A encumbered/cpu/full/iq/segmented/chain_wire.cc 1572155SN/A encumbered/cpu/full/iq/segmented/iq_seg.cc 1582155SN/A encumbered/cpu/full/iq/segmented/iq_segmented.cc 1592155SN/A encumbered/cpu/full/iq/segmented/seg_chain.cc 1602155SN/A encumbered/cpu/full/iq/seznec/iq_seznec.cc 1612155SN/A encumbered/cpu/full/iq/standard/iq_standard.cc 1622155SN/A ''') 1632155SN/A 1642422SN/Atrace_reader_sources = Split(''' 1652422SN/A cpu/trace/reader/mem_trace_reader.cc 1662422SN/A cpu/trace/reader/ibm_reader.cc 1672422SN/A cpu/trace/reader/itx_reader.cc 1682422SN/A cpu/trace/reader/m5_reader.cc 1692422SN/A cpu/trace/opt_cpu.cc 1702422SN/A cpu/trace/trace_cpu.cc 1712397SN/A ''') 1722397SN/A 1732422SN/A 1742422SN/A 175955SN/A# MySql sources 176955SN/Amysql_sources = Split(''' 177955SN/A base/mysql.cc 178955SN/A base/stats/mysql.cc 179955SN/A ''') 180955SN/A 181955SN/A# Full-system sources 182955SN/Afull_system_sources = Split(''' 1831078SN/A base/crc.cc 184955SN/A base/inet.cc 185955SN/A base/remote_gdb.cc 186955SN/A 187955SN/A cpu/intr_control.cc 1881917SN/A cpu/profile.cc 189955SN/A 190955SN/A dev/alpha_console.cc 191955SN/A dev/baddev.cc 192955SN/A dev/disk_image.cc 193974SN/A dev/etherbus.cc 194955SN/A dev/etherdump.cc 195955SN/A dev/etherint.cc 196955SN/A dev/etherlink.cc 197955SN/A dev/etherpkt.cc 1982566SN/A dev/ethertap.cc 1992566SN/A dev/ide_ctrl.cc 200955SN/A dev/ide_disk.cc 201955SN/A dev/io_device.cc 2022539SN/A dev/isa_fake.cc 203955SN/A dev/ns_gige.cc 204955SN/A dev/pciconfigall.cc 205955SN/A dev/pcidev.cc 2061817SN/A dev/pcifake.cc 2071154SN/A dev/pktfifo.cc 2081840SN/A dev/platform.cc 2092522SN/A dev/simconsole.cc 2102522SN/A dev/simple_disk.cc 2112629SN/A dev/sinic.cc 212955SN/A dev/tsunami.cc 213955SN/A dev/tsunami_cchip.cc 214955SN/A dev/tsunami_io.cc 2152539SN/A dev/tsunami_fake.cc 216955SN/A dev/tsunami_pchip.cc 2172539SN/A 218955SN/A dev/uart.cc 2191730SN/A dev/uart8250.cc 220955SN/A 2211070SN/A kern/kernel_binning.cc 222955SN/A kern/kernel_stats.cc 223955SN/A kern/system_events.cc 2242212SN/A kern/linux/events.cc 225955SN/A kern/linux/linux_syscalls.cc 2261040SN/A kern/linux/printk.cc 2272507SN/A 2282521SN/A mem/vport.cc 2292521SN/A 2302507SN/A sim/pseudo_inst.cc 2312507SN/A ''') 2322507SN/A 2332521SN/A 2342507SN/Aif env['TARGET_ISA'] == 'alpha': 2352507SN/A full_system_sources += Split(''' 236955SN/A kern/tru64/dump_mbuf.cc 237955SN/A kern/tru64/printf.cc 238955SN/A kern/tru64/tru64_events.cc 239955SN/A kern/tru64/tru64_syscalls.cc 240955SN/A ''') 241955SN/A 2421742SN/A# turbolaser encumbered sources 2431742SN/Aturbolaser_sources = Split(''' 2441742SN/A encumbered/dev/dma.cc 2451742SN/A encumbered/dev/etherdev.cc 2461742SN/A encumbered/dev/scsi.cc 2471742SN/A encumbered/dev/scsi_ctrl.cc 2481742SN/A encumbered/dev/scsi_disk.cc 2491742SN/A encumbered/dev/scsi_none.cc 2501742SN/A encumbered/dev/tlaser_clock.cc 2511742SN/A encumbered/dev/tlaser_ipi.cc 2521742SN/A encumbered/dev/tlaser_mbox.cc 2531742SN/A encumbered/dev/tlaser_mc146818.cc 2541742SN/A encumbered/dev/tlaser_node.cc 2551742SN/A encumbered/dev/tlaser_pcia.cc 2561742SN/A encumbered/dev/tlaser_pcidev.cc 2571742SN/A encumbered/dev/tlaser_serial.cc 2581742SN/A encumbered/dev/turbolaser.cc 2591742SN/A encumbered/dev/uart8530.cc 2601742SN/A ''') 2611742SN/A 262955SN/A# Syscall emulation (non-full-system) sources 263955SN/Asyscall_emulation_sources = Split(''' 2642520SN/A mem/translating_port.cc 2652517SN/A mem/page_table.cc 2662253SN/A sim/process.cc 2672253SN/A sim/syscall_emul.cc 2682253SN/A ''') 2692253SN/A 2702553SN/A#if env['TARGET_ISA'] == 'alpha': 2712553SN/A# syscall_emulation_sources += Split(''' 2722553SN/A# kern/tru64/tru64.cc 2732553SN/A# ''') 2742507SN/A 2752470SN/Aalpha_eio_sources = Split(''' 2761744SN/A encumbered/eio/exolex.cc 2771744SN/A encumbered/eio/libexo.cc 2782470SN/A encumbered/eio/eio.cc 2792470SN/A ''') 2802470SN/A 2812470SN/Aif env['TARGET_ISA'] == 'ALPHA_ISA': 2822470SN/A syscall_emulation_sources += alpha_eio_sources 2832470SN/A 2842400SN/Amemtest_sources = Split(''' 2852400SN/A cpu/memtest/memtest.cc 286955SN/A ''') 287955SN/A 2882037SN/A# Add a flag defining what THE_ISA should be for all compilation 2892037SN/Aenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 2902037SN/A 2912152SN/Aarch_sources = SConscript('arch/SConscript', 2922152SN/A exports = 'env', duplicate = False) 2932139SN/A 2942155SN/Acpu_sources = SConscript('cpu/SConscript', 2952155SN/A exports = 'env', duplicate = False) 2962155SN/A 2972155SN/A# This is outside of cpu/SConscript since the source directory isn't 2982155SN/A# underneath 'cpu'. 2992155SN/Aif 'FullCPU' in env['CPU_MODELS']: 3002155SN/A cpu_sources += full_cpu_sources 3012155SN/A 302955SN/A# Set up complete list of sources based on configuration. 3032155SN/Asources = base_sources + arch_sources + cpu_sources 304955SN/A 305955SN/Aif env['FULL_SYSTEM']: 306955SN/A sources += full_system_sources 3071742SN/A if env['ALPHA_TLASER']: 3081742SN/A sources += turbolaser_sources 309955SN/Aelse: 310955SN/A sources += syscall_emulation_sources 311955SN/A 3121858SN/Aif env['USE_MYSQL']: 313955SN/A sources += mysql_sources 3141858SN/A 3151858SN/Afor opt in env.ExportOptions: 3161858SN/A env.ConfigFile(opt) 3171085SN/A 318955SN/A################################################### 319955SN/A# 320955SN/A# Special build rules. 321955SN/A# 322955SN/A################################################### 323955SN/A 324955SN/A# base/traceflags.{cc,hh} are generated from base/traceflags.py. 325955SN/A# $TARGET.base will expand to "<build-dir>/base/traceflags". 326955SN/Aenv.Command(Split('base/traceflags.hh base/traceflags.cc'), 327955SN/A 'base/traceflags.py', 328955SN/A 'python $SOURCE $TARGET.base') 329955SN/A 3301511SN/ASConscript('python/SConscript', exports = ['env'], duplicate=0) 3311045SN/A 332955SN/A# This function adds the specified sources to the given build 333955SN/A# environment, and returns a list of all the corresponding SCons 334955SN/A# Object nodes (including an extra one for date.cc). We explicitly 335955SN/A# add the Object nodes so we can set up special dependencies for 3361108SN/A# date.cc. 337955SN/Adef make_objs(sources, env): 338955SN/A objs = [env.Object(s) for s in sources] 339955SN/A # make date.cc depend on all other objects so it always gets 340955SN/A # recompiled whenever anything else does 341955SN/A date_obj = env.Object('base/date.cc') 342955SN/A env.Depends(date_obj, objs) 343955SN/A objs.append(date_obj) 344955SN/A return objs 345955SN/A 346955SN/A################################################### 347955SN/A# 348955SN/A# Define binaries. Each different build type (debug, opt, etc.) gets 349955SN/A# a slightly different build environment. 350955SN/A# 351955SN/A################################################### 352955SN/A 353955SN/A# Include file paths are rooted in this directory. SCons will 354955SN/A# automatically expand '.' to refer to both the source directory and 355955SN/A# the corresponding build directory to pick up generated include 356955SN/A# files. 357955SN/Aenv.Append(CPPPATH='.') 358955SN/A 359955SN/A# Debug binary 3601869SN/AdebugEnv = env.Copy(OBJSUFFIX='.do') 3611869SN/AdebugEnv.Label = 'debug' 3622560SN/AdebugEnv.Append(CCFLAGS=Split('-g3 -gdwarf-2 -O0')) 3631869SN/AdebugEnv.Append(CPPDEFINES='DEBUG') 3641869SN/Atlist = debugEnv.Program(target = 'm5.debug', 3651869SN/A source = make_objs(sources, debugEnv)) 3661869SN/AdebugEnv.M5Binary = tlist[0] 367955SN/A 368955SN/A# Optimized binary 3691869SN/AoptEnv = env.Copy() 3701869SN/AoptEnv.Label = 'opt' 3712560SN/AoptEnv.Append(CCFLAGS=Split('-g -O3')) 3721869SN/Atlist = optEnv.Program(target = 'm5.opt', 3731869SN/A source = make_objs(sources, optEnv)) 3741869SN/AoptEnv.M5Binary = tlist[0] 375955SN/A 376955SN/A# "Fast" binary 3771869SN/AfastEnv = env.Copy(OBJSUFFIX='.fo') 3781869SN/AfastEnv.Label = 'fast' 3792560SN/AfastEnv.Append(CCFLAGS=Split('-O3')) 3801869SN/AfastEnv.Append(CPPDEFINES='NDEBUG') 3811869SN/AfastEnv.Program(target = 'm5.fast.unstripped', 3821869SN/A source = make_objs(sources, fastEnv)) 3831869SN/Atlist = fastEnv.Command(target = 'm5.fast', 3841869SN/A source = 'm5.fast.unstripped', 3851869SN/A action = 'strip $SOURCE -o $TARGET') 3861869SN/AfastEnv.M5Binary = tlist[0] 387955SN/A 388955SN/A# Profiled binary 3891869SN/AprofEnv = env.Copy(OBJSUFFIX='.po') 3901869SN/AprofEnv.Label = 'prof' 3912560SN/AprofEnv.Append(CCFLAGS=Split('-O3 -g -pg'), LINKFLAGS='-pg') 3921869SN/Atlist = profEnv.Program(target = 'm5.prof', 3931869SN/A source = make_objs(sources, profEnv)) 3941869SN/AprofEnv.M5Binary = tlist[0] 3951869SN/A 3961869SN/AenvList = [debugEnv, optEnv, fastEnv, profEnv] 3971869SN/A 3981869SN/AReturn('envList') 399