SConscript revision 2821
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 921717SN/A cpu/sampler/sampler.cc 932683Sktlim@umich.edu cpu/simple_thread.cc 942683Sktlim@umich.edu cpu/thread_state.cc 952669Sktlim@umich.edu 962568SN/A mem/bridge.cc 972568SN/A mem/bus.cc 982462SN/A mem/mem_object.cc 992568SN/A mem/packet.cc 1002395SN/A mem/physical.cc 1012405SN/A mem/port.cc 102955SN/A 103955SN/A sim/builder.cc 104955SN/A sim/debug.cc 105955SN/A sim/eventq.cc 1062090SN/A sim/faults.cc 107955SN/A sim/main.cc 1082763Sstever@eecs.umich.edu python/swig/cc_main_wrap.cc 109955SN/A sim/param.cc 1101696SN/A sim/root.cc 111955SN/A sim/serialize.cc 112955SN/A sim/sim_events.cc 113955SN/A sim/sim_object.cc 1141127SN/A sim/startup.cc 115955SN/A sim/stat_context.cc 116955SN/A sim/stat_control.cc 1172379SN/A sim/system.cc 118955SN/A sim/trace_context.cc 119955SN/A ''') 120955SN/A 1212155SN/A# Old FullCPU sources 1222155SN/Afull_cpu_sources = Split(''' 1232155SN/A encumbered/cpu/full/bpred.cc 1242155SN/A encumbered/cpu/full/commit.cc 1252155SN/A encumbered/cpu/full/cpu.cc 1262155SN/A encumbered/cpu/full/create_vector.cc 1272155SN/A encumbered/cpu/full/cv_spec_state.cc 1282155SN/A encumbered/cpu/full/dd_queue.cc 1292155SN/A encumbered/cpu/full/dep_link.cc 1302155SN/A encumbered/cpu/full/dispatch.cc 1312155SN/A encumbered/cpu/full/dyn_inst.cc 1322155SN/A encumbered/cpu/full/execute.cc 1332155SN/A encumbered/cpu/full/fetch.cc 1342155SN/A encumbered/cpu/full/floss_reasons.cc 1352155SN/A encumbered/cpu/full/fu_pool.cc 1362155SN/A encumbered/cpu/full/inst_fifo.cc 1372155SN/A encumbered/cpu/full/instpipe.cc 1382155SN/A encumbered/cpu/full/issue.cc 1392155SN/A encumbered/cpu/full/ls_queue.cc 1402155SN/A encumbered/cpu/full/machine_queue.cc 1412155SN/A encumbered/cpu/full/pipetrace.cc 1422155SN/A encumbered/cpu/full/readyq.cc 1432155SN/A encumbered/cpu/full/reg_info.cc 1442155SN/A encumbered/cpu/full/rob_station.cc 1452155SN/A encumbered/cpu/full/spec_memory.cc 1462155SN/A encumbered/cpu/full/spec_state.cc 1472155SN/A encumbered/cpu/full/storebuffer.cc 1482155SN/A encumbered/cpu/full/writeback.cc 1492155SN/A encumbered/cpu/full/iq/iq_station.cc 1502155SN/A encumbered/cpu/full/iq/iqueue.cc 1512155SN/A encumbered/cpu/full/iq/segmented/chain_info.cc 1522155SN/A encumbered/cpu/full/iq/segmented/chain_wire.cc 1532155SN/A encumbered/cpu/full/iq/segmented/iq_seg.cc 1542155SN/A encumbered/cpu/full/iq/segmented/iq_segmented.cc 1552155SN/A encumbered/cpu/full/iq/segmented/seg_chain.cc 1562155SN/A encumbered/cpu/full/iq/seznec/iq_seznec.cc 1572155SN/A encumbered/cpu/full/iq/standard/iq_standard.cc 1582155SN/A ''') 1592155SN/A 1602422SN/Atrace_reader_sources = Split(''' 1612422SN/A cpu/trace/reader/mem_trace_reader.cc 1622422SN/A cpu/trace/reader/ibm_reader.cc 1632422SN/A cpu/trace/reader/itx_reader.cc 1642422SN/A cpu/trace/reader/m5_reader.cc 1652422SN/A cpu/trace/opt_cpu.cc 1662422SN/A cpu/trace/trace_cpu.cc 1672397SN/A ''') 1682397SN/A 1692422SN/A 1702422SN/A 171955SN/A# MySql sources 172955SN/Amysql_sources = Split(''' 173955SN/A base/mysql.cc 174955SN/A base/stats/mysql.cc 175955SN/A ''') 176955SN/A 177955SN/A# Full-system sources 178955SN/Afull_system_sources = Split(''' 1791078SN/A base/crc.cc 180955SN/A base/inet.cc 181955SN/A base/remote_gdb.cc 182955SN/A 183955SN/A cpu/intr_control.cc 1841917SN/A cpu/profile.cc 185955SN/A 186955SN/A dev/alpha_console.cc 187955SN/A dev/baddev.cc 188955SN/A dev/disk_image.cc 189974SN/A dev/etherbus.cc 190955SN/A dev/etherdump.cc 191955SN/A dev/etherint.cc 192955SN/A dev/etherlink.cc 193955SN/A dev/etherpkt.cc 1942566SN/A dev/ethertap.cc 1952566SN/A dev/ide_ctrl.cc 196955SN/A dev/ide_disk.cc 197955SN/A dev/io_device.cc 1982539SN/A dev/isa_fake.cc 199955SN/A dev/ns_gige.cc 200955SN/A dev/pciconfigall.cc 201955SN/A dev/pcidev.cc 2021817SN/A dev/pcifake.cc 2031154SN/A dev/pktfifo.cc 2041840SN/A dev/platform.cc 2052522SN/A dev/simconsole.cc 2062522SN/A dev/simple_disk.cc 2072629SN/A dev/sinic.cc 208955SN/A dev/tsunami.cc 209955SN/A dev/tsunami_cchip.cc 210955SN/A dev/tsunami_io.cc 2112539SN/A dev/tsunami_fake.cc 212955SN/A dev/tsunami_pchip.cc 2132539SN/A 214955SN/A dev/uart.cc 2151730SN/A dev/uart8250.cc 216955SN/A 217955SN/A kern/kernel_stats.cc 218955SN/A kern/system_events.cc 2192212SN/A kern/linux/events.cc 220955SN/A kern/linux/linux_syscalls.cc 2211040SN/A kern/linux/printk.cc 2222507SN/A 2232521SN/A mem/vport.cc 2242521SN/A 2252507SN/A sim/pseudo_inst.cc 2262507SN/A ''') 2272507SN/A 2282521SN/A 2292507SN/Aif env['TARGET_ISA'] == 'alpha': 2302507SN/A full_system_sources += Split(''' 231955SN/A kern/tru64/dump_mbuf.cc 232955SN/A kern/tru64/printf.cc 233955SN/A kern/tru64/tru64_events.cc 234955SN/A kern/tru64/tru64_syscalls.cc 235955SN/A ''') 236955SN/A 2371742SN/A# turbolaser encumbered sources 2381742SN/Aturbolaser_sources = Split(''' 2391742SN/A encumbered/dev/dma.cc 2401742SN/A encumbered/dev/etherdev.cc 2411742SN/A encumbered/dev/scsi.cc 2421742SN/A encumbered/dev/scsi_ctrl.cc 2431742SN/A encumbered/dev/scsi_disk.cc 2441742SN/A encumbered/dev/scsi_none.cc 2451742SN/A encumbered/dev/tlaser_clock.cc 2461742SN/A encumbered/dev/tlaser_ipi.cc 2471742SN/A encumbered/dev/tlaser_mbox.cc 2481742SN/A encumbered/dev/tlaser_mc146818.cc 2491742SN/A encumbered/dev/tlaser_node.cc 2501742SN/A encumbered/dev/tlaser_pcia.cc 2511742SN/A encumbered/dev/tlaser_pcidev.cc 2521742SN/A encumbered/dev/tlaser_serial.cc 2531742SN/A encumbered/dev/turbolaser.cc 2541742SN/A encumbered/dev/uart8530.cc 2551742SN/A ''') 2561742SN/A 257955SN/A# Syscall emulation (non-full-system) sources 258955SN/Asyscall_emulation_sources = Split(''' 2592520SN/A mem/translating_port.cc 2602517SN/A mem/page_table.cc 2612253SN/A sim/process.cc 2622253SN/A sim/syscall_emul.cc 2632253SN/A ''') 2642253SN/A 2652553SN/A#if env['TARGET_ISA'] == 'alpha': 2662553SN/A# syscall_emulation_sources += Split(''' 2672553SN/A# kern/tru64/tru64.cc 2682553SN/A# ''') 2692507SN/A 2702470SN/Aalpha_eio_sources = Split(''' 2711744SN/A encumbered/eio/exolex.cc 2721744SN/A encumbered/eio/libexo.cc 2732470SN/A encumbered/eio/eio.cc 2742470SN/A ''') 2752470SN/A 2762470SN/Aif env['TARGET_ISA'] == 'ALPHA_ISA': 2772470SN/A syscall_emulation_sources += alpha_eio_sources 2782470SN/A 2792400SN/Amemtest_sources = Split(''' 2802400SN/A cpu/memtest/memtest.cc 281955SN/A ''') 282955SN/A 2832667Sstever@eecs.umich.edu# Include file paths are rooted in this directory. SCons will 2842667Sstever@eecs.umich.edu# automatically expand '.' to refer to both the source directory and 2852667Sstever@eecs.umich.edu# the corresponding build directory to pick up generated include 2862667Sstever@eecs.umich.edu# files. 2872667Sstever@eecs.umich.eduenv.Append(CPPPATH=Dir('.')) 2882667Sstever@eecs.umich.edu 2892037SN/A# Add a flag defining what THE_ISA should be for all compilation 2902037SN/Aenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())]) 2912037SN/A 2922667Sstever@eecs.umich.eduarch_sources = SConscript('arch/SConscript', exports = 'env') 2932139SN/A 2942667Sstever@eecs.umich.educpu_sources = SConscript('cpu/SConscript', exports = 'env') 2952155SN/A 2962155SN/A# This is outside of cpu/SConscript since the source directory isn't 2972155SN/A# underneath 'cpu'. 2982155SN/Aif 'FullCPU' in env['CPU_MODELS']: 2992155SN/A cpu_sources += full_cpu_sources 3002155SN/A 301955SN/A# Set up complete list of sources based on configuration. 3022155SN/Asources = base_sources + arch_sources + cpu_sources 303955SN/A 304955SN/Aif env['FULL_SYSTEM']: 305955SN/A sources += full_system_sources 3061742SN/A if env['ALPHA_TLASER']: 3071742SN/A sources += turbolaser_sources 308955SN/Aelse: 309955SN/A sources += syscall_emulation_sources 310955SN/A 3111858SN/Aif env['USE_MYSQL']: 312955SN/A sources += mysql_sources 3131858SN/A 3141858SN/Afor opt in env.ExportOptions: 3151858SN/A env.ConfigFile(opt) 3161085SN/A 317955SN/A################################################### 318955SN/A# 319955SN/A# Special build rules. 320955SN/A# 321955SN/A################################################### 322955SN/A 323955SN/A# base/traceflags.{cc,hh} are generated from base/traceflags.py. 324955SN/A# $TARGET.base will expand to "<build-dir>/base/traceflags". 325955SN/Aenv.Command(Split('base/traceflags.hh base/traceflags.cc'), 326955SN/A 'base/traceflags.py', 327955SN/A 'python $SOURCE $TARGET.base') 328955SN/A 3292667Sstever@eecs.umich.eduSConscript('python/SConscript', exports = ['env']) 3301045SN/A 331955SN/A# This function adds the specified sources to the given build 332955SN/A# environment, and returns a list of all the corresponding SCons 333955SN/A# Object nodes (including an extra one for date.cc). We explicitly 334955SN/A# add the Object nodes so we can set up special dependencies for 3351108SN/A# date.cc. 336955SN/Adef make_objs(sources, env): 337955SN/A objs = [env.Object(s) for s in sources] 338955SN/A # make date.cc depend on all other objects so it always gets 339955SN/A # recompiled whenever anything else does 340955SN/A date_obj = env.Object('base/date.cc') 341955SN/A env.Depends(date_obj, objs) 342955SN/A objs.append(date_obj) 343955SN/A return objs 344955SN/A 345955SN/A################################################### 346955SN/A# 347955SN/A# Define binaries. Each different build type (debug, opt, etc.) gets 348955SN/A# a slightly different build environment. 349955SN/A# 350955SN/A################################################### 351955SN/A 3522655Sstever@eecs.umich.edu# List of constructed environments to pass back to SConstruct 3532655Sstever@eecs.umich.eduenvList = [] 3542655Sstever@eecs.umich.edu 3552655Sstever@eecs.umich.edu# Function to create a new build environment as clone of current 3562655Sstever@eecs.umich.edu# environment 'env' with modified object suffix and optional stripped 3572655Sstever@eecs.umich.edu# binary. Additional keyword arguments are appended to corresponding 3582655Sstever@eecs.umich.edu# build environment vars. 3592655Sstever@eecs.umich.edudef makeEnv(label, objsfx, strip = False, **kwargs): 3602655Sstever@eecs.umich.edu newEnv = env.Copy(OBJSUFFIX=objsfx) 3612655Sstever@eecs.umich.edu newEnv.Label = label 3622655Sstever@eecs.umich.edu newEnv.Append(**kwargs) 3632655Sstever@eecs.umich.edu exe = 'm5.' + label # final executable 3642655Sstever@eecs.umich.edu bin = exe + '.bin' # executable w/o appended Python zip archive 3652655Sstever@eecs.umich.edu newEnv.Program(bin, make_objs(sources, newEnv)) 3662655Sstever@eecs.umich.edu if strip: 3672655Sstever@eecs.umich.edu stripped_bin = bin + '.stripped' 3682655Sstever@eecs.umich.edu newEnv.Command(stripped_bin, bin, 'strip $SOURCE -o $TARGET') 3692655Sstever@eecs.umich.edu bin = stripped_bin 3702655Sstever@eecs.umich.edu targets = newEnv.Concat(exe, [bin, 'python/m5py.zip']) 3712655Sstever@eecs.umich.edu newEnv.M5Binary = targets[0] 3722655Sstever@eecs.umich.edu envList.append(newEnv) 3732655Sstever@eecs.umich.edu 374955SN/A# Debug binary 3752655Sstever@eecs.umich.edumakeEnv('debug', '.do', 3762655Sstever@eecs.umich.edu CCFLAGS = Split('-g3 -gdwarf-2 -O0'), 3772655Sstever@eecs.umich.edu CPPDEFINES = 'DEBUG') 378955SN/A 379955SN/A# Optimized binary 3802655Sstever@eecs.umich.edumakeEnv('opt', '.o', 3812655Sstever@eecs.umich.edu CCFLAGS = Split('-g -O3')) 382955SN/A 383955SN/A# "Fast" binary 3842655Sstever@eecs.umich.edumakeEnv('fast', '.fo', strip = True, 3852655Sstever@eecs.umich.edu CCFLAGS = Split('-O3'), 3862655Sstever@eecs.umich.edu CPPDEFINES = 'NDEBUG') 387955SN/A 388955SN/A# Profiled binary 3892655Sstever@eecs.umich.edumakeEnv('prof', '.po', 3902655Sstever@eecs.umich.edu CCFLAGS = Split('-O3 -g -pg'), 3912655Sstever@eecs.umich.edu LINKFLAGS = '-pg') 3921869SN/A 3931869SN/AReturn('envList') 394