SConscript revision 2470
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.eduimport os 30955SN/Aimport sys 31955SN/Afrom os.path import isdir 32955SN/A 333583Sbinkertn@umich.edu# 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. 46955SN/A 47955SN/Abase_sources = Split(''' 482023SN/A base/circlebuf.cc 49955SN/A base/copyright.cc 503089Ssaidi@eecs.umich.edu base/cprintf.cc 51955SN/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 58955SN/A base/match.cc 591031SN/A base/misc.cc 60955SN/A base/output.cc 611388SN/A base/pollevent.cc 62955SN/A base/range.cc 63955SN/A base/random.cc 641296SN/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 773584Ssaidi@eecs.umich.edu 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 83955SN/A cpu/base.cc 84955SN/A cpu/cpu_exec_context.cc 852325SN/A cpu/exetrace.cc 861717SN/A cpu/op_class.cc 872652Ssaidi@eecs.umich.edu cpu/pc_event.cc 88955SN/A cpu/static_inst.cc 892736Sktlim@umich.edu cpu/sampler/sampler.cc 902410SN/A 91955SN/A mem/mem_object.cc 922290SN/A mem/page_table.cc 93955SN/A mem/physical.cc 942683Sktlim@umich.edu mem/port.cc 952683Sktlim@umich.edu mem/translating_port.cc 962669Sktlim@umich.edu 972568SN/A python/pyconfig.cc 982568SN/A python/embedded_py.cc 993012Ssaidi@eecs.umich.edu 1002462SN/A sim/builder.cc 1012568SN/A sim/configfile.cc 1022395SN/A sim/debug.cc 1032405SN/A sim/eventq.cc 1042914Ssaidi@eecs.umich.edu sim/faults.cc 105955SN/A sim/main.cc 1062811Srdreslin@umich.edu sim/param.cc 1072811Srdreslin@umich.edu sim/profile.cc 1082811Srdreslin@umich.edu sim/root.cc 1092811Srdreslin@umich.edu sim/serialize.cc 1102811Srdreslin@umich.edu sim/sim_events.cc 1112811Srdreslin@umich.edu sim/sim_exit.cc 1122811Srdreslin@umich.edu sim/sim_object.cc 1132811Srdreslin@umich.edu sim/startup.cc 1142811Srdreslin@umich.edu sim/stat_context.cc 1152811Srdreslin@umich.edu sim/stat_control.cc 1162811Srdreslin@umich.edu sim/system.cc 1172811Srdreslin@umich.edu sim/trace_context.cc 1182811Srdreslin@umich.edu ''') 1192811Srdreslin@umich.edu 1202811Srdreslin@umich.edu# Old FullCPU sources 1212811Srdreslin@umich.edufull_cpu_sources = Split(''' 1222814Srdreslin@umich.edu encumbered/cpu/full/bpred.cc 1232811Srdreslin@umich.edu encumbered/cpu/full/commit.cc 1242811Srdreslin@umich.edu encumbered/cpu/full/cpu.cc 1252811Srdreslin@umich.edu encumbered/cpu/full/create_vector.cc 1262811Srdreslin@umich.edu encumbered/cpu/full/cv_spec_state.cc 1272811Srdreslin@umich.edu encumbered/cpu/full/dd_queue.cc 1282811Srdreslin@umich.edu encumbered/cpu/full/dep_link.cc 1292811Srdreslin@umich.edu encumbered/cpu/full/dispatch.cc 1302813Srdreslin@umich.edu encumbered/cpu/full/dyn_inst.cc 1312813Srdreslin@umich.edu encumbered/cpu/full/execute.cc 1323624Sbinkertn@umich.edu encumbered/cpu/full/fetch.cc 1333624Sbinkertn@umich.edu encumbered/cpu/full/floss_reasons.cc 134955SN/A encumbered/cpu/full/fu_pool.cc 135955SN/A encumbered/cpu/full/inst_fifo.cc 136955SN/A encumbered/cpu/full/instpipe.cc 1372090SN/A encumbered/cpu/full/issue.cc 138955SN/A encumbered/cpu/full/ls_queue.cc 139955SN/A encumbered/cpu/full/machine_queue.cc 1401696SN/A encumbered/cpu/full/pipetrace.cc 141955SN/A encumbered/cpu/full/readyq.cc 142955SN/A encumbered/cpu/full/reg_info.cc 143955SN/A encumbered/cpu/full/rob_station.cc 1441127SN/A encumbered/cpu/full/spec_memory.cc 145955SN/A encumbered/cpu/full/spec_state.cc 146955SN/A encumbered/cpu/full/storebuffer.cc 1472379SN/A encumbered/cpu/full/writeback.cc 148955SN/A encumbered/cpu/full/iq/iq_station.cc 149955SN/A encumbered/cpu/full/iq/iqueue.cc 150955SN/A encumbered/cpu/full/iq/segmented/chain_info.cc 1512422SN/A encumbered/cpu/full/iq/segmented/chain_wire.cc 1522422SN/A encumbered/cpu/full/iq/segmented/iq_seg.cc 1532422SN/A encumbered/cpu/full/iq/segmented/iq_segmented.cc 1542422SN/A encumbered/cpu/full/iq/segmented/seg_chain.cc 1552422SN/A encumbered/cpu/full/iq/seznec/iq_seznec.cc 1562422SN/A encumbered/cpu/full/iq/standard/iq_standard.cc 1572422SN/A ''') 1582397SN/A 1592397SN/Atrace_reader_sources = Split(''' 1602422SN/A cpu/trace/reader/mem_trace_reader.cc 1612422SN/A cpu/trace/reader/ibm_reader.cc 162955SN/A cpu/trace/reader/itx_reader.cc 163955SN/A cpu/trace/reader/m5_reader.cc 164955SN/A cpu/trace/opt_cpu.cc 165955SN/A cpu/trace/trace_cpu.cc 166955SN/A ''') 167955SN/A 168955SN/A 169955SN/A 1701078SN/A# MySql sources 171955SN/Amysql_sources = Split(''' 172955SN/A base/mysql.cc 173955SN/A base/stats/mysql.cc 174955SN/A ''') 1751917SN/A 176955SN/A# Full-system sources 177955SN/Afull_system_sources = Split(''' 1781730SN/A base/crc.cc 179955SN/A base/inet.cc 1802521SN/A base/remote_gdb.cc 1812521SN/A 1822507SN/A cpu/intr_control.cc 1832507SN/A cpu/profile.cc 1842989Ssaidi@eecs.umich.edu 1853408Ssaidi@eecs.umich.edu dev/alpha_console.cc 1862507SN/A dev/baddev.cc 1872507SN/A dev/simconsole.cc 1882507SN/A dev/disk_image.cc 189955SN/A dev/etherbus.cc 190955SN/A dev/etherdump.cc 191955SN/A dev/etherint.cc 192955SN/A dev/etherlink.cc 193955SN/A dev/etherpkt.cc 194955SN/A dev/ethertap.cc 195955SN/A dev/ide_ctrl.cc 196955SN/A dev/ide_disk.cc 1972520SN/A dev/io_device.cc 1982517SN/A dev/ns_gige.cc 1992253SN/A dev/pciconfigall.cc 2002253SN/A dev/pcidev.cc 2012253SN/A dev/pcifake.cc 2022253SN/A dev/pktfifo.cc 2032553SN/A dev/platform.cc 2042553SN/A dev/sinic.cc 2052553SN/A dev/simple_disk.cc 2062553SN/A dev/tsunami.cc 2072507SN/A dev/tsunami_cchip.cc 2082400SN/A dev/isa_fake.cc 2092400SN/A dev/tsunami_io.cc 210955SN/A dev/tsunami_pchip.cc 211955SN/A dev/uart.cc 2122667Sstever@eecs.umich.edu dev/uart8250.cc 2132667Sstever@eecs.umich.edu 2142667Sstever@eecs.umich.edu kern/kernel_binning.cc 2152667Sstever@eecs.umich.edu kern/kernel_stats.cc 2162667Sstever@eecs.umich.edu kern/system_events.cc 2172667Sstever@eecs.umich.edu kern/linux/events.cc 2182037SN/A kern/linux/linux_syscalls.cc 2192037SN/A kern/linux/printk.cc 2202037SN/A kern/tru64/dump_mbuf.cc 2213534Sgblack@eecs.umich.edu kern/tru64/printf.cc 2222139SN/A kern/tru64/tru64_events.cc 2233534Sgblack@eecs.umich.edu kern/tru64/tru64_syscalls.cc 2243534Sgblack@eecs.umich.edu 2253542Sgblack@eecs.umich.edu mem/functional/memory_control.cc 2263583Sbinkertn@umich.edu sim/pseudo_inst.cc 2273583Sbinkertn@umich.edu ''') 2283542Sgblack@eecs.umich.edu 2293499Ssaidi@eecs.umich.edu# turbolaser encumbered sources 2303583Sbinkertn@umich.eduturbolaser_sources = Split(''' 2313583Sbinkertn@umich.edu encumbered/dev/dma.cc 2323547Sgblack@eecs.umich.edu encumbered/dev/etherdev.cc 2332155SN/A encumbered/dev/scsi.cc 234955SN/A encumbered/dev/scsi_ctrl.cc 2352155SN/A encumbered/dev/scsi_disk.cc 236955SN/A encumbered/dev/scsi_none.cc 2373583Sbinkertn@umich.edu encumbered/dev/tlaser_clock.cc 2383583Sbinkertn@umich.edu encumbered/dev/tlaser_ipi.cc 2393583Sbinkertn@umich.edu encumbered/dev/tlaser_mbox.cc 2403583Sbinkertn@umich.edu encumbered/dev/tlaser_mc146818.cc 2413583Sbinkertn@umich.edu encumbered/dev/tlaser_node.cc 242955SN/A encumbered/dev/tlaser_pcia.cc 243955SN/A encumbered/dev/tlaser_pcidev.cc 244955SN/A encumbered/dev/tlaser_serial.cc 245955SN/A encumbered/dev/turbolaser.cc 246955SN/A encumbered/dev/uart8530.cc 2471858SN/A ''') 248955SN/A 2491858SN/A# Syscall emulation (non-full-system) sources 2501858SN/Asyscall_emulation_sources = Split(''' 2511858SN/A kern/linux/linux.cc 2521085SN/A kern/tru64/tru64.cc 253955SN/A sim/process.cc 254955SN/A sim/syscall_emul.cc 255955SN/A ''') 256955SN/A 257955SN/Aalpha_eio_sources = Split(''' 258955SN/A encumbered/eio/exolex.cc 259955SN/A encumbered/eio/libexo.cc 260955SN/A encumbered/eio/eio.cc 261955SN/A ''') 262955SN/A 263955SN/Aif env['TARGET_ISA'] == 'ALPHA_ISA': 264955SN/A syscall_emulation_sources += alpha_eio_sources 2652667Sstever@eecs.umich.edu 2661045SN/Amemtest_sources = Split(''' 267955SN/A cpu/memtest/memtest.cc 268955SN/A ''') 269955SN/A 270955SN/A# Add a flag defining what THE_ISA should be for all compilation 2711108SN/Aenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 272955SN/A 273955SN/Aarch_sources = SConscript('arch/SConscript', 274955SN/A exports = 'env', duplicate = False) 275955SN/A 276955SN/Acpu_sources = SConscript('cpu/SConscript', 277955SN/A exports = 'env', duplicate = False) 278955SN/A 279955SN/A# This is outside of cpu/SConscript since the source directory isn't 280955SN/A# underneath 'cpu'. 281955SN/Aif 'FullCPU' in env['CPU_MODELS']: 282955SN/A cpu_sources += full_cpu_sources 283955SN/A 284955SN/A# Set up complete list of sources based on configuration. 285955SN/Asources = base_sources + arch_sources + cpu_sources 286955SN/A 287955SN/Aif env['FULL_SYSTEM']: 2882655Sstever@eecs.umich.edu sources += full_system_sources 2892655Sstever@eecs.umich.edu if env['ALPHA_TLASER']: 2902655Sstever@eecs.umich.edu sources += turbolaser_sources 2912655Sstever@eecs.umich.eduelse: 2922655Sstever@eecs.umich.edu sources += syscall_emulation_sources 2932655Sstever@eecs.umich.edu 2942655Sstever@eecs.umich.eduif env['USE_MYSQL']: 2952655Sstever@eecs.umich.edu sources += mysql_sources 2962655Sstever@eecs.umich.edu 2972655Sstever@eecs.umich.edufor opt in env.ExportOptions: 2982655Sstever@eecs.umich.edu env.ConfigFile(opt) 2992655Sstever@eecs.umich.edu 3002655Sstever@eecs.umich.edu################################################### 3012655Sstever@eecs.umich.edu# 3022655Sstever@eecs.umich.edu# Special build rules. 3032655Sstever@eecs.umich.edu# 3042655Sstever@eecs.umich.edu################################################### 3052655Sstever@eecs.umich.edu 3062655Sstever@eecs.umich.edu# base/traceflags.{cc,hh} are generated from base/traceflags.py. 3072655Sstever@eecs.umich.edu# $TARGET.base will expand to "<build-dir>/base/traceflags". 3082655Sstever@eecs.umich.eduenv.Command(Split('base/traceflags.hh base/traceflags.cc'), 3092655Sstever@eecs.umich.edu 'base/traceflags.py', 310955SN/A 'python $SOURCE $TARGET.base') 3113515Ssaidi@eecs.umich.edu 3123515Ssaidi@eecs.umich.edu# libelf build is described in its own SConscript file. 3133515Ssaidi@eecs.umich.edu# SConscript-local is the per-config build, which just copies some 3143515Ssaidi@eecs.umich.edu# header files into a place where they can be found. 3153515Ssaidi@eecs.umich.eduSConscript('libelf/SConscript-local', exports = 'env', duplicate=0) 3163515Ssaidi@eecs.umich.eduSConscript('python/SConscript', exports = ['env'], duplicate=0) 3173515Ssaidi@eecs.umich.edu 3182655Sstever@eecs.umich.edu# This function adds the specified sources to the given build 3193515Ssaidi@eecs.umich.edu# environment, and returns a list of all the corresponding SCons 3203619Sbinkertn@umich.edu# Object nodes (including an extra one for date.cc). We explicitly 321955SN/A# add the Object nodes so we can set up special dependencies for 322955SN/A# date.cc. 3232655Sstever@eecs.umich.edudef make_objs(sources, env): 3243619Sbinkertn@umich.edu objs = [env.Object(s) for s in sources] 3253619Sbinkertn@umich.edu # make date.cc depend on all other objects so it always gets 326955SN/A # recompiled whenever anything else does 327955SN/A date_obj = env.Object('base/date.cc') 3282655Sstever@eecs.umich.edu env.Depends(date_obj, objs) 3292655Sstever@eecs.umich.edu objs.append(date_obj) 3303619Sbinkertn@umich.edu return objs 331955SN/A 332955SN/A################################################### 3332655Sstever@eecs.umich.edu# 3342655Sstever@eecs.umich.edu# Define binaries. Each different build type (debug, opt, etc.) gets 3352655Sstever@eecs.umich.edu# a slightly different build environment. 3361869SN/A# 3371869SN/A################################################### 338 339# Include file paths are rooted in this directory. SCons will 340# automatically expand '.' to refer to both the source directory and 341# the corresponding build directory to pick up generated include 342# files. 343env.Append(CPPPATH='.') 344env.Append(CPPPATH='./libelf') 345 346# Debug binary 347debugEnv = env.Copy(OBJSUFFIX='.do') 348debugEnv.Label = 'debug' 349debugEnv.Append(CCFLAGS=Split('-g -gstabs+ -O0')) 350debugEnv.Append(CPPDEFINES='DEBUG') 351tlist = debugEnv.Program(target = 'm5.debug', 352 source = make_objs(sources, debugEnv)) 353debugEnv.M5Binary = tlist[0] 354 355# Optimized binary 356optEnv = env.Copy() 357optEnv.Label = 'opt' 358optEnv.Append(CCFLAGS=Split('-g -O5')) 359tlist = optEnv.Program(target = 'm5.opt', 360 source = make_objs(sources, optEnv)) 361optEnv.M5Binary = tlist[0] 362 363# "Fast" binary 364fastEnv = env.Copy(OBJSUFFIX='.fo') 365fastEnv.Label = 'fast' 366fastEnv.Append(CCFLAGS=Split('-O5')) 367fastEnv.Append(CPPDEFINES='NDEBUG') 368fastEnv.Program(target = 'm5.fast.unstripped', 369 source = make_objs(sources, fastEnv)) 370tlist = fastEnv.Command(target = 'm5.fast', 371 source = 'm5.fast.unstripped', 372 action = 'strip $SOURCE -o $TARGET') 373fastEnv.M5Binary = tlist[0] 374 375# Profiled binary 376profEnv = env.Copy(OBJSUFFIX='.po') 377profEnv.Label = 'prof' 378profEnv.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg') 379tlist = profEnv.Program(target = 'm5.prof', 380 source = make_objs(sources, profEnv)) 381profEnv.M5Binary = tlist[0] 382 383envList = [debugEnv, optEnv, fastEnv, profEnv] 384 385Return('envList') 386