SConscript revision 2736
12929Sktlim@umich.edu# -*- mode:python -*- 22929Sktlim@umich.edu 32932Sktlim@umich.edu# Copyright (c) 2004-2005 The Regents of The University of Michigan 42929Sktlim@umich.edu# All rights reserved. 52929Sktlim@umich.edu# 62929Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without 72929Sktlim@umich.edu# modification, are permitted provided that the following conditions are 82929Sktlim@umich.edu# met: redistributions of source code must retain the above copyright 92929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer; 102929Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright 112929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the 122929Sktlim@umich.edu# documentation and/or other materials provided with the distribution; 132929Sktlim@umich.edu# neither the name of the copyright holders nor the names of its 142929Sktlim@umich.edu# contributors may be used to endorse or promote products derived from 152929Sktlim@umich.edu# this software without specific prior written permission. 162929Sktlim@umich.edu# 172929Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182929Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192929Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202929Sktlim@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212929Sktlim@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222929Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232929Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242929Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252929Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262929Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272929Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282932Sktlim@umich.edu# 292932Sktlim@umich.edu# Authors: Steve Reinhardt 302932Sktlim@umich.edu 312929Sktlim@umich.eduimport os 322929Sktlim@umich.eduimport sys 332929Sktlim@umich.edufrom os.path import isdir 342929Sktlim@umich.edu 352929Sktlim@umich.edu# This file defines how to build a particular configuration of M5 362929Sktlim@umich.edu# based on variable settings in the 'env' build environment. 372929Sktlim@umich.edu 382929Sktlim@umich.edu# Import build environment variable from SConstruct. 392929Sktlim@umich.eduImport('env') 402929Sktlim@umich.edu 412929Sktlim@umich.edu################################################### 422929Sktlim@umich.edu# 432929Sktlim@umich.edu# Define needed sources. 442929Sktlim@umich.edu# 452929Sktlim@umich.edu################################################### 462929Sktlim@umich.edu 472929Sktlim@umich.edu# Base sources used by all configurations. 482929Sktlim@umich.edu 492929Sktlim@umich.edubase_sources = Split(''' 502929Sktlim@umich.edu base/circlebuf.cc 512929Sktlim@umich.edu base/cprintf.cc 522929Sktlim@umich.edu base/fast_alloc.cc 532929Sktlim@umich.edu base/fifo_buffer.cc 542929Sktlim@umich.edu base/hostinfo.cc 552929Sktlim@umich.edu base/hybrid_pred.cc 562929Sktlim@umich.edu base/inifile.cc 572929Sktlim@umich.edu base/intmath.cc 582929Sktlim@umich.edu base/match.cc 592929Sktlim@umich.edu base/misc.cc 602929Sktlim@umich.edu base/output.cc 612929Sktlim@umich.edu base/pollevent.cc 622929Sktlim@umich.edu base/range.cc 632929Sktlim@umich.edu base/random.cc 643020Sstever@eecs.umich.edu base/sat_counter.cc 653020Sstever@eecs.umich.edu base/serializer.cc 663020Sstever@eecs.umich.edu base/socket.cc 672929Sktlim@umich.edu base/statistics.cc 682929Sktlim@umich.edu base/str.cc 693021Sstever@eecs.umich.edu base/time.cc 702929Sktlim@umich.edu base/trace.cc 712929Sktlim@umich.edu base/traceflags.cc 722929Sktlim@umich.edu base/userinfo.cc 732929Sktlim@umich.edu base/compression/lzss_compression.cc 742929Sktlim@umich.edu base/loader/aout_object.cc 752929Sktlim@umich.edu base/loader/ecoff_object.cc 762929Sktlim@umich.edu base/loader/elf_object.cc 772929Sktlim@umich.edu base/loader/object_file.cc 782929Sktlim@umich.edu base/loader/symtab.cc 792929Sktlim@umich.edu base/stats/events.cc 802929Sktlim@umich.edu base/stats/statdb.cc 812929Sktlim@umich.edu base/stats/visit.cc 822929Sktlim@umich.edu base/stats/text.cc 832929Sktlim@umich.edu 842929Sktlim@umich.edu cpu/activity.cc 852929Sktlim@umich.edu cpu/base.cc 862929Sktlim@umich.edu cpu/cpuevent.cc 872929Sktlim@umich.edu cpu/exetrace.cc 882929Sktlim@umich.edu cpu/func_unit.cc 892929Sktlim@umich.edu cpu/op_class.cc 902929Sktlim@umich.edu cpu/pc_event.cc 912929Sktlim@umich.edu cpu/quiesce_event.cc 922929Sktlim@umich.edu cpu/static_inst.cc 932929Sktlim@umich.edu cpu/sampler/sampler.cc 942929Sktlim@umich.edu cpu/simple_thread.cc 952929Sktlim@umich.edu cpu/thread_state.cc 962929Sktlim@umich.edu 972929Sktlim@umich.edu mem/bridge.cc 982929Sktlim@umich.edu mem/bus.cc 992929Sktlim@umich.edu mem/connector.cc 1002929Sktlim@umich.edu mem/mem_object.cc 1012929Sktlim@umich.edu mem/packet.cc 1022929Sktlim@umich.edu mem/physical.cc 1032929Sktlim@umich.edu mem/port.cc 1042929Sktlim@umich.edu 1052929Sktlim@umich.edu sim/builder.cc 1062929Sktlim@umich.edu sim/configfile.cc 1072929Sktlim@umich.edu sim/debug.cc 1082929Sktlim@umich.edu sim/eventq.cc 1092929Sktlim@umich.edu sim/faults.cc 1102929Sktlim@umich.edu sim/main.cc 1112929Sktlim@umich.edu python/swig/main_wrap.cc 1122929Sktlim@umich.edu sim/param.cc 1132929Sktlim@umich.edu sim/profile.cc 1142929Sktlim@umich.edu sim/root.cc 1152929Sktlim@umich.edu sim/serialize.cc 1162929Sktlim@umich.edu sim/sim_events.cc 1173701Sstever@eecs.umich.edu sim/sim_object.cc 1182929Sktlim@umich.edu sim/startup.cc 1192929Sktlim@umich.edu sim/stat_context.cc 1202929Sktlim@umich.edu sim/stat_control.cc 1212929Sktlim@umich.edu sim/system.cc 1222929Sktlim@umich.edu sim/trace_context.cc 1232929Sktlim@umich.edu ''') 1242929Sktlim@umich.edu 1252929Sktlim@umich.edu# Old FullCPU sources 1262929Sktlim@umich.edufull_cpu_sources = Split(''' 1272929Sktlim@umich.edu encumbered/cpu/full/bpred.cc 1282929Sktlim@umich.edu encumbered/cpu/full/commit.cc 1292929Sktlim@umich.edu encumbered/cpu/full/cpu.cc 1302929Sktlim@umich.edu encumbered/cpu/full/create_vector.cc 1312929Sktlim@umich.edu encumbered/cpu/full/cv_spec_state.cc 1322929Sktlim@umich.edu encumbered/cpu/full/dd_queue.cc 1332929Sktlim@umich.edu encumbered/cpu/full/dep_link.cc 1342929Sktlim@umich.edu encumbered/cpu/full/dispatch.cc 1352929Sktlim@umich.edu encumbered/cpu/full/dyn_inst.cc 1362929Sktlim@umich.edu encumbered/cpu/full/execute.cc 1372929Sktlim@umich.edu encumbered/cpu/full/fetch.cc 1382929Sktlim@umich.edu encumbered/cpu/full/floss_reasons.cc 1392929Sktlim@umich.edu encumbered/cpu/full/fu_pool.cc 1402997Sstever@eecs.umich.edu encumbered/cpu/full/inst_fifo.cc 1412997Sstever@eecs.umich.edu encumbered/cpu/full/instpipe.cc 1422929Sktlim@umich.edu encumbered/cpu/full/issue.cc 1432997Sstever@eecs.umich.edu encumbered/cpu/full/ls_queue.cc 1442997Sstever@eecs.umich.edu encumbered/cpu/full/machine_queue.cc 1452929Sktlim@umich.edu encumbered/cpu/full/pipetrace.cc 1462997Sstever@eecs.umich.edu encumbered/cpu/full/readyq.cc 1472997Sstever@eecs.umich.edu encumbered/cpu/full/reg_info.cc 1482997Sstever@eecs.umich.edu encumbered/cpu/full/rob_station.cc 1492929Sktlim@umich.edu encumbered/cpu/full/spec_memory.cc 1502997Sstever@eecs.umich.edu encumbered/cpu/full/spec_state.cc 1512997Sstever@eecs.umich.edu encumbered/cpu/full/storebuffer.cc 1522997Sstever@eecs.umich.edu encumbered/cpu/full/writeback.cc 1532997Sstever@eecs.umich.edu encumbered/cpu/full/iq/iq_station.cc 1542997Sstever@eecs.umich.edu encumbered/cpu/full/iq/iqueue.cc 1552997Sstever@eecs.umich.edu encumbered/cpu/full/iq/segmented/chain_info.cc 1562997Sstever@eecs.umich.edu encumbered/cpu/full/iq/segmented/chain_wire.cc 1572997Sstever@eecs.umich.edu encumbered/cpu/full/iq/segmented/iq_seg.cc 1582997Sstever@eecs.umich.edu encumbered/cpu/full/iq/segmented/iq_segmented.cc 1592997Sstever@eecs.umich.edu encumbered/cpu/full/iq/segmented/seg_chain.cc 1602997Sstever@eecs.umich.edu encumbered/cpu/full/iq/seznec/iq_seznec.cc 1612997Sstever@eecs.umich.edu encumbered/cpu/full/iq/standard/iq_standard.cc 1622997Sstever@eecs.umich.edu ''') 1632997Sstever@eecs.umich.edu 1642997Sstever@eecs.umich.edutrace_reader_sources = Split(''' 1652997Sstever@eecs.umich.edu cpu/trace/reader/mem_trace_reader.cc 1662997Sstever@eecs.umich.edu cpu/trace/reader/ibm_reader.cc 1672997Sstever@eecs.umich.edu cpu/trace/reader/itx_reader.cc 1682997Sstever@eecs.umich.edu cpu/trace/reader/m5_reader.cc 1692997Sstever@eecs.umich.edu cpu/trace/opt_cpu.cc 1703045Sstever@eecs.umich.edu cpu/trace/trace_cpu.cc 1712997Sstever@eecs.umich.edu ''') 1722997Sstever@eecs.umich.edu 1732997Sstever@eecs.umich.edu 1742953Sktlim@umich.edu 1752997Sstever@eecs.umich.edu# MySql sources 1762997Sstever@eecs.umich.edumysql_sources = Split(''' 1772997Sstever@eecs.umich.edu base/mysql.cc 1782997Sstever@eecs.umich.edu base/stats/mysql.cc 1792929Sktlim@umich.edu ''') 1802997Sstever@eecs.umich.edu 1812997Sstever@eecs.umich.edu# Full-system sources 1822997Sstever@eecs.umich.edufull_system_sources = Split(''' 1832997Sstever@eecs.umich.edu base/crc.cc 1842929Sktlim@umich.edu base/inet.cc 1852997Sstever@eecs.umich.edu base/remote_gdb.cc 1862997Sstever@eecs.umich.edu 1872997Sstever@eecs.umich.edu cpu/intr_control.cc 1882997Sstever@eecs.umich.edu cpu/profile.cc 1892997Sstever@eecs.umich.edu 1902997Sstever@eecs.umich.edu dev/alpha_console.cc 1912997Sstever@eecs.umich.edu dev/baddev.cc 1922929Sktlim@umich.edu dev/disk_image.cc 1932997Sstever@eecs.umich.edu dev/etherbus.cc 1942929Sktlim@umich.edu dev/etherdump.cc 1952929Sktlim@umich.edu dev/etherint.cc 1963005Sstever@eecs.umich.edu dev/etherlink.cc 1973005Sstever@eecs.umich.edu dev/etherpkt.cc 1983005Sstever@eecs.umich.edu dev/ethertap.cc 1993005Sstever@eecs.umich.edu dev/ide_ctrl.cc 2003005Sstever@eecs.umich.edu dev/ide_disk.cc 2013005Sstever@eecs.umich.edu dev/io_device.cc 2023005Sstever@eecs.umich.edu dev/isa_fake.cc 2033005Sstever@eecs.umich.edu dev/ns_gige.cc 2043691Shsul@eecs.umich.edu dev/pciconfigall.cc 2053691Shsul@eecs.umich.edu dev/pcidev.cc 2064130Ssaidi@eecs.umich.edu dev/pcifake.cc 2074130Ssaidi@eecs.umich.edu dev/pktfifo.cc 2084130Ssaidi@eecs.umich.edu dev/platform.cc 2093691Shsul@eecs.umich.edu dev/simconsole.cc 2103005Sstever@eecs.umich.edu dev/simple_disk.cc 2114019Sstever@eecs.umich.edu dev/sinic.cc 2123005Sstever@eecs.umich.edu dev/tsunami.cc 2132929Sktlim@umich.edu dev/tsunami_cchip.cc 2142929Sktlim@umich.edu dev/tsunami_io.cc 2153005Sstever@eecs.umich.edu dev/tsunami_fake.cc 2162997Sstever@eecs.umich.edu dev/tsunami_pchip.cc 2172997Sstever@eecs.umich.edu 2182997Sstever@eecs.umich.edu dev/uart.cc 2192929Sktlim@umich.edu dev/uart8250.cc 220 221 kern/kernel_stats.cc 222 kern/system_events.cc 223 kern/linux/events.cc 224 kern/linux/linux_syscalls.cc 225 kern/linux/printk.cc 226 227 mem/vport.cc 228 229 sim/pseudo_inst.cc 230 ''') 231 232 233if env['TARGET_ISA'] == 'alpha': 234 full_system_sources += Split(''' 235 kern/tru64/dump_mbuf.cc 236 kern/tru64/printf.cc 237 kern/tru64/tru64_events.cc 238 kern/tru64/tru64_syscalls.cc 239 ''') 240 241# turbolaser encumbered sources 242turbolaser_sources = Split(''' 243 encumbered/dev/dma.cc 244 encumbered/dev/etherdev.cc 245 encumbered/dev/scsi.cc 246 encumbered/dev/scsi_ctrl.cc 247 encumbered/dev/scsi_disk.cc 248 encumbered/dev/scsi_none.cc 249 encumbered/dev/tlaser_clock.cc 250 encumbered/dev/tlaser_ipi.cc 251 encumbered/dev/tlaser_mbox.cc 252 encumbered/dev/tlaser_mc146818.cc 253 encumbered/dev/tlaser_node.cc 254 encumbered/dev/tlaser_pcia.cc 255 encumbered/dev/tlaser_pcidev.cc 256 encumbered/dev/tlaser_serial.cc 257 encumbered/dev/turbolaser.cc 258 encumbered/dev/uart8530.cc 259 ''') 260 261# Syscall emulation (non-full-system) sources 262syscall_emulation_sources = Split(''' 263 mem/translating_port.cc 264 mem/page_table.cc 265 sim/process.cc 266 sim/syscall_emul.cc 267 ''') 268 269#if env['TARGET_ISA'] == 'alpha': 270# syscall_emulation_sources += Split(''' 271# kern/tru64/tru64.cc 272# ''') 273 274alpha_eio_sources = Split(''' 275 encumbered/eio/exolex.cc 276 encumbered/eio/libexo.cc 277 encumbered/eio/eio.cc 278 ''') 279 280if env['TARGET_ISA'] == 'ALPHA_ISA': 281 syscall_emulation_sources += alpha_eio_sources 282 283memtest_sources = Split(''' 284 cpu/memtest/memtest.cc 285 ''') 286 287# Include file paths are rooted in this directory. SCons will 288# automatically expand '.' to refer to both the source directory and 289# the corresponding build directory to pick up generated include 290# files. 291env.Append(CPPPATH=Dir('.')) 292 293# Add a flag defining what THE_ISA should be for all compilation 294env.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 295 296arch_sources = SConscript('arch/SConscript', exports = 'env') 297 298cpu_sources = SConscript('cpu/SConscript', exports = 'env') 299 300# This is outside of cpu/SConscript since the source directory isn't 301# underneath 'cpu'. 302if 'FullCPU' in env['CPU_MODELS']: 303 cpu_sources += full_cpu_sources 304 305# Set up complete list of sources based on configuration. 306sources = base_sources + arch_sources + cpu_sources 307 308if env['FULL_SYSTEM']: 309 sources += full_system_sources 310 if env['ALPHA_TLASER']: 311 sources += turbolaser_sources 312else: 313 sources += syscall_emulation_sources 314 315if env['USE_MYSQL']: 316 sources += mysql_sources 317 318for opt in env.ExportOptions: 319 env.ConfigFile(opt) 320 321################################################### 322# 323# Special build rules. 324# 325################################################### 326 327# base/traceflags.{cc,hh} are generated from base/traceflags.py. 328# $TARGET.base will expand to "<build-dir>/base/traceflags". 329env.Command(Split('base/traceflags.hh base/traceflags.cc'), 330 'base/traceflags.py', 331 'python $SOURCE $TARGET.base') 332 333SConscript('python/SConscript', exports = ['env']) 334 335# This function adds the specified sources to the given build 336# environment, and returns a list of all the corresponding SCons 337# Object nodes (including an extra one for date.cc). We explicitly 338# add the Object nodes so we can set up special dependencies for 339# date.cc. 340def make_objs(sources, env): 341 objs = [env.Object(s) for s in sources] 342 # make date.cc depend on all other objects so it always gets 343 # recompiled whenever anything else does 344 date_obj = env.Object('base/date.cc') 345 env.Depends(date_obj, objs) 346 objs.append(date_obj) 347 return objs 348 349################################################### 350# 351# Define binaries. Each different build type (debug, opt, etc.) gets 352# a slightly different build environment. 353# 354################################################### 355 356# List of constructed environments to pass back to SConstruct 357envList = [] 358 359# Function to create a new build environment as clone of current 360# environment 'env' with modified object suffix and optional stripped 361# binary. Additional keyword arguments are appended to corresponding 362# build environment vars. 363def makeEnv(label, objsfx, strip = False, **kwargs): 364 newEnv = env.Copy(OBJSUFFIX=objsfx) 365 newEnv.Label = label 366 newEnv.Append(**kwargs) 367 exe = 'm5.' + label # final executable 368 bin = exe + '.bin' # executable w/o appended Python zip archive 369 newEnv.Program(bin, make_objs(sources, newEnv)) 370 if strip: 371 stripped_bin = bin + '.stripped' 372 newEnv.Command(stripped_bin, bin, 'strip $SOURCE -o $TARGET') 373 bin = stripped_bin 374 targets = newEnv.Concat(exe, [bin, 'python/m5py.zip']) 375 newEnv.M5Binary = targets[0] 376 envList.append(newEnv) 377 378# Debug binary 379makeEnv('debug', '.do', 380 CCFLAGS = Split('-g3 -gdwarf-2 -O0'), 381 CPPDEFINES = 'DEBUG') 382 383# Optimized binary 384makeEnv('opt', '.o', 385 CCFLAGS = Split('-g -O3')) 386 387# "Fast" binary 388makeEnv('fast', '.fo', strip = True, 389 CCFLAGS = Split('-O3'), 390 CPPDEFINES = 'NDEBUG') 391 392# Profiled binary 393makeEnv('prof', '.po', 394 CCFLAGS = Split('-O3 -g -pg'), 395 LINKFLAGS = '-pg') 396 397Return('envList') 398