SConscript revision 2212
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
294762Snate@binkert.orgimport os
30955SN/Aimport sys
314762Snate@binkert.orgfrom os.path import isdir
32955SN/A
33955SN/A# This file defines how to build a particular configuration of M5
344202Sbinkertn@umich.edu# based on variable settings in the 'env' build environment.
354382Sbinkertn@umich.edu
364202Sbinkertn@umich.edu# Import build environment variable from SConstruct.
374762Snate@binkert.orgImport('env')
384762Snate@binkert.org
394762Snate@binkert.org###################################################
40955SN/A#
414381Sbinkertn@umich.edu# Define needed sources.
424381Sbinkertn@umich.edu#
43955SN/A###################################################
44955SN/A
45955SN/A# Base sources used by all configurations.
464202Sbinkertn@umich.edu
47955SN/Abase_sources = Split('''
484382Sbinkertn@umich.edu	base/circlebuf.cc
494382Sbinkertn@umich.edu	base/copyright.cc
504382Sbinkertn@umich.edu	base/cprintf.cc
514762Snate@binkert.org        base/embedfile.cc
524762Snate@binkert.org	base/fast_alloc.cc
534762Snate@binkert.org	base/fifo_buffer.cc
544762Snate@binkert.org	base/hostinfo.cc
554762Snate@binkert.org	base/hybrid_pred.cc
564762Snate@binkert.org	base/inifile.cc
574762Snate@binkert.org	base/intmath.cc
584762Snate@binkert.org	base/match.cc
594762Snate@binkert.org	base/misc.cc
604762Snate@binkert.org	base/output.cc
614762Snate@binkert.org	base/pollevent.cc
624762Snate@binkert.org	base/range.cc
634762Snate@binkert.org	base/random.cc
644762Snate@binkert.org	base/sat_counter.cc
654762Snate@binkert.org	base/socket.cc
664762Snate@binkert.org	base/statistics.cc
674762Snate@binkert.org	base/str.cc
684762Snate@binkert.org	base/time.cc
694762Snate@binkert.org	base/trace.cc
704762Snate@binkert.org	base/traceflags.cc
714762Snate@binkert.org	base/userinfo.cc
724762Snate@binkert.org	base/compression/lzss_compression.cc
734762Snate@binkert.org	base/loader/aout_object.cc
744762Snate@binkert.org	base/loader/ecoff_object.cc
754762Snate@binkert.org	base/loader/elf_object.cc
764762Snate@binkert.org	base/loader/object_file.cc
774762Snate@binkert.org	base/loader/symtab.cc
784762Snate@binkert.org	base/stats/events.cc
794762Snate@binkert.org	base/stats/statdb.cc
804762Snate@binkert.org	base/stats/visit.cc
814762Snate@binkert.org	base/stats/text.cc
824762Snate@binkert.org
834762Snate@binkert.org	cpu/base.cc
844382Sbinkertn@umich.edu        cpu/base_dyn_inst.cc
854762Snate@binkert.org	cpu/exec_context.cc
864382Sbinkertn@umich.edu	cpu/exetrace.cc
874762Snate@binkert.org	cpu/pc_event.cc
884381Sbinkertn@umich.edu	cpu/static_inst.cc
894762Snate@binkert.org        cpu/sampler/sampler.cc
904762Snate@binkert.org        cpu/trace/reader/mem_trace_reader.cc
914762Snate@binkert.org        cpu/trace/reader/ibm_reader.cc
924762Snate@binkert.org        cpu/trace/reader/itx_reader.cc
934762Snate@binkert.org        cpu/trace/reader/m5_reader.cc
944762Snate@binkert.org        cpu/trace/opt_cpu.cc
954762Snate@binkert.org        cpu/trace/trace_cpu.cc
964762Snate@binkert.org
974762Snate@binkert.org	encumbered/mem/functional/main.cc
984762Snate@binkert.org
994762Snate@binkert.org	mem/base_hier.cc
1004762Snate@binkert.org	mem/base_mem.cc
1014762Snate@binkert.org	mem/hier_params.cc
1024762Snate@binkert.org	mem/mem_cmd.cc
1034762Snate@binkert.org	mem/mem_debug.cc
1044762Snate@binkert.org	mem/mem_req.cc
1054762Snate@binkert.org	mem/memory_interface.cc
1064762Snate@binkert.org	mem/bus/base_interface.cc
1074762Snate@binkert.org	mem/bus/bus.cc
1084762Snate@binkert.org	mem/bus/bus_bridge.cc
1094762Snate@binkert.org	mem/bus/bus_bridge_master.cc
1104762Snate@binkert.org	mem/bus/bus_bridge_slave.cc
1114762Snate@binkert.org	mem/bus/bus_interface.cc
1124762Snate@binkert.org	mem/bus/dma_bus_interface.cc
1134762Snate@binkert.org	mem/bus/dma_interface.cc
1144762Snate@binkert.org	mem/bus/master_interface.cc
1154762Snate@binkert.org	mem/bus/slave_interface.cc
1164762Snate@binkert.org	mem/cache/base_cache.cc
1174762Snate@binkert.org	mem/cache/cache.cc
1184762Snate@binkert.org	mem/cache/cache_builder.cc
1194762Snate@binkert.org	mem/cache/coherence/coherence_protocol.cc
1204762Snate@binkert.org	mem/cache/coherence/uni_coherence.cc
1214762Snate@binkert.org	mem/cache/miss/blocking_buffer.cc
1224762Snate@binkert.org	mem/cache/miss/miss_queue.cc
1234762Snate@binkert.org	mem/cache/miss/mshr.cc
1244762Snate@binkert.org	mem/cache/miss/mshr_queue.cc
1254762Snate@binkert.org        mem/cache/prefetch/base_prefetcher.cc
1264762Snate@binkert.org        mem/cache/prefetch/prefetcher.cc
1274762Snate@binkert.org        mem/cache/prefetch/tagged_prefetcher.cc
1284762Snate@binkert.org	mem/cache/tags/base_tags.cc
129955SN/A	mem/cache/tags/cache_tags.cc	
1304382Sbinkertn@umich.edu	mem/cache/tags/fa_lru.cc
1314202Sbinkertn@umich.edu	mem/cache/tags/iic.cc
1324382Sbinkertn@umich.edu	mem/cache/tags/lru.cc
1334382Sbinkertn@umich.edu	mem/cache/tags/repl/gen.cc
1344382Sbinkertn@umich.edu	mem/cache/tags/repl/repl.cc
1354382Sbinkertn@umich.edu	mem/cache/tags/split.cc
1364382Sbinkertn@umich.edu	mem/cache/tags/split_lru.cc
1374382Sbinkertn@umich.edu	mem/cache/tags/split_lifo.cc
1385192Ssaidi@eecs.umich.edu	mem/functional/functional.cc
1395192Ssaidi@eecs.umich.edu	mem/timing/base_memory.cc
1405192Ssaidi@eecs.umich.edu	mem/timing/memory_builder.cc
1415192Ssaidi@eecs.umich.edu	mem/timing/simple_mem_bank.cc
1425192Ssaidi@eecs.umich.edu        mem/trace/itx_writer.cc
1435192Ssaidi@eecs.umich.edu	mem/trace/mem_trace_writer.cc
1445192Ssaidi@eecs.umich.edu	mem/trace/m5_writer.cc
1455192Ssaidi@eecs.umich.edu
1465192Ssaidi@eecs.umich.edu        python/pyconfig.cc
1475192Ssaidi@eecs.umich.edu        python/embedded_py.cc
1485192Ssaidi@eecs.umich.edu
1495192Ssaidi@eecs.umich.edu	sim/builder.cc
1505192Ssaidi@eecs.umich.edu	sim/configfile.cc
1515192Ssaidi@eecs.umich.edu	sim/debug.cc
1525192Ssaidi@eecs.umich.edu	sim/eventq.cc
1535192Ssaidi@eecs.umich.edu	sim/faults.cc
1545192Ssaidi@eecs.umich.edu	sim/main.cc
1555192Ssaidi@eecs.umich.edu	sim/param.cc
1565192Ssaidi@eecs.umich.edu	sim/profile.cc
1575192Ssaidi@eecs.umich.edu	sim/root.cc
1585192Ssaidi@eecs.umich.edu	sim/serialize.cc
1595192Ssaidi@eecs.umich.edu	sim/sim_events.cc
1605192Ssaidi@eecs.umich.edu	sim/sim_exit.cc
1615192Ssaidi@eecs.umich.edu	sim/sim_object.cc
1625192Ssaidi@eecs.umich.edu	sim/startup.cc
1635192Ssaidi@eecs.umich.edu	sim/stat_context.cc
1645192Ssaidi@eecs.umich.edu	sim/stat_control.cc
1655192Ssaidi@eecs.umich.edu	sim/trace_context.cc
1665192Ssaidi@eecs.umich.edu        ''')
1675192Ssaidi@eecs.umich.edu
1685192Ssaidi@eecs.umich.edu# Old FullCPU sources
1695192Ssaidi@eecs.umich.edufull_cpu_sources = Split('''
1704382Sbinkertn@umich.edu	encumbered/cpu/full/bpred.cc
1714382Sbinkertn@umich.edu	encumbered/cpu/full/commit.cc
1724382Sbinkertn@umich.edu	encumbered/cpu/full/cpu.cc
1732667Sstever@eecs.umich.edu	encumbered/cpu/full/create_vector.cc
1742667Sstever@eecs.umich.edu	encumbered/cpu/full/cv_spec_state.cc
1752667Sstever@eecs.umich.edu	encumbered/cpu/full/dd_queue.cc
1762667Sstever@eecs.umich.edu	encumbered/cpu/full/dep_link.cc
1772667Sstever@eecs.umich.edu	encumbered/cpu/full/dispatch.cc
1782667Sstever@eecs.umich.edu	encumbered/cpu/full/dyn_inst.cc
1792037SN/A	encumbered/cpu/full/execute.cc
1802037SN/A	encumbered/cpu/full/fetch.cc
1812037SN/A	encumbered/cpu/full/floss_reasons.cc
1824382Sbinkertn@umich.edu	encumbered/cpu/full/fu_pool.cc
1834762Snate@binkert.org	encumbered/cpu/full/inst_fifo.cc
1844202Sbinkertn@umich.edu	encumbered/cpu/full/instpipe.cc
1854382Sbinkertn@umich.edu	encumbered/cpu/full/issue.cc
1864202Sbinkertn@umich.edu	encumbered/cpu/full/ls_queue.cc
1874202Sbinkertn@umich.edu	encumbered/cpu/full/machine_queue.cc
1884202Sbinkertn@umich.edu        encumbered/cpu/full/pipetrace.cc
1894202Sbinkertn@umich.edu        encumbered/cpu/full/readyq.cc
1904202Sbinkertn@umich.edu        encumbered/cpu/full/reg_info.cc
1914762Snate@binkert.org        encumbered/cpu/full/rob_station.cc
1924202Sbinkertn@umich.edu        encumbered/cpu/full/spec_memory.cc
1934202Sbinkertn@umich.edu        encumbered/cpu/full/spec_state.cc
1944202Sbinkertn@umich.edu        encumbered/cpu/full/storebuffer.cc
1954202Sbinkertn@umich.edu        encumbered/cpu/full/writeback.cc
1964202Sbinkertn@umich.edu        encumbered/cpu/full/iq/iq_station.cc
1971858SN/A        encumbered/cpu/full/iq/iqueue.cc
1985068Sgblack@eecs.umich.edu        encumbered/cpu/full/iq/segmented/chain_info.cc
1995068Sgblack@eecs.umich.edu        encumbered/cpu/full/iq/segmented/chain_wire.cc
2005068Sgblack@eecs.umich.edu        encumbered/cpu/full/iq/segmented/iq_seg.cc
2015068Sgblack@eecs.umich.edu        encumbered/cpu/full/iq/segmented/iq_segmented.cc
2025068Sgblack@eecs.umich.edu        encumbered/cpu/full/iq/segmented/seg_chain.cc
2035068Sgblack@eecs.umich.edu        encumbered/cpu/full/iq/seznec/iq_seznec.cc
2045068Sgblack@eecs.umich.edu        encumbered/cpu/full/iq/standard/iq_standard.cc
2055068Sgblack@eecs.umich.edu        ''')
2065068Sgblack@eecs.umich.edu
2075068Sgblack@eecs.umich.edu# MySql sources
2085068Sgblack@eecs.umich.edumysql_sources = Split('''
2094773Snate@binkert.org	base/mysql.cc
2101858SN/A	base/stats/mysql.cc
2111858SN/A        ''')
2121085SN/A
2134382Sbinkertn@umich.edu# Full-system sources
2144382Sbinkertn@umich.edufull_system_sources = Split('''
2154762Snate@binkert.org	arch/alpha/freebsd/system.cc
2164762Snate@binkert.org	arch/alpha/linux/system.cc
2174762Snate@binkert.org        arch/alpha/system.cc
2184762Snate@binkert.org	arch/alpha/tru64/system.cc
2194762Snate@binkert.org
2204762Snate@binkert.org	base/crc.cc
2214762Snate@binkert.org	base/inet.cc
2224762Snate@binkert.org	base/remote_gdb.cc
2234762Snate@binkert.org
2244762Snate@binkert.org	cpu/intr_control.cc
2254762Snate@binkert.org        cpu/profile.cc
2264762Snate@binkert.org
2274762Snate@binkert.org	dev/alpha_console.cc
2284762Snate@binkert.org	dev/baddev.cc
2294762Snate@binkert.org        dev/simconsole.cc
2304762Snate@binkert.org	dev/disk_image.cc
2314762Snate@binkert.org	dev/etherbus.cc
2324762Snate@binkert.org	dev/etherdump.cc
2334762Snate@binkert.org	dev/etherint.cc
2344762Snate@binkert.org	dev/etherlink.cc
2354762Snate@binkert.org	dev/etherpkt.cc
2364762Snate@binkert.org	dev/ethertap.cc
2374762Snate@binkert.org	dev/ide_ctrl.cc
2384762Snate@binkert.org	dev/ide_disk.cc
2394762Snate@binkert.org	dev/io_device.cc
2404762Snate@binkert.org	dev/ns_gige.cc
2414762Snate@binkert.org	dev/pciconfigall.cc
2424762Snate@binkert.org	dev/pcidev.cc
2434762Snate@binkert.org	dev/pcifake.cc
2444762Snate@binkert.org	dev/pktfifo.cc
2454762Snate@binkert.org	dev/platform.cc
2464762Snate@binkert.org	dev/sinic.cc
2474762Snate@binkert.org	dev/simple_disk.cc
2484762Snate@binkert.org	dev/tsunami.cc
2494762Snate@binkert.org	dev/tsunami_cchip.cc
2504382Sbinkertn@umich.edu	dev/isa_fake.cc
2514382Sbinkertn@umich.edu	dev/tsunami_io.cc
2524762Snate@binkert.org	dev/tsunami_pchip.cc
2534762Snate@binkert.org	dev/uart.cc
2544762Snate@binkert.org	dev/uart8250.cc
2554382Sbinkertn@umich.edu
2564382Sbinkertn@umich.edu	kern/kernel_binning.cc
2574762Snate@binkert.org	kern/kernel_stats.cc
2584382Sbinkertn@umich.edu	kern/system_events.cc
2594382Sbinkertn@umich.edu	kern/linux/events.cc
2604762Snate@binkert.org	kern/linux/linux_syscalls.cc
2614382Sbinkertn@umich.edu	kern/linux/printk.cc
2624382Sbinkertn@umich.edu	kern/tru64/dump_mbuf.cc
2634762Snate@binkert.org	kern/tru64/printf.cc
2644382Sbinkertn@umich.edu	kern/tru64/tru64_events.cc
2654762Snate@binkert.org	kern/tru64/tru64_syscalls.cc
2664762Snate@binkert.org
2674382Sbinkertn@umich.edu	mem/functional/memory_control.cc
2684382Sbinkertn@umich.edu	mem/functional/physical.cc
2694762Snate@binkert.org
2704762Snate@binkert.org	sim/system.cc
2714762Snate@binkert.org	sim/pseudo_inst.cc
2724762Snate@binkert.org        ''')
2734762Snate@binkert.org
2744762Snate@binkert.org# turbolaser encumbered sources
2754762Snate@binkert.orgturbolaser_sources = Split('''
2764762Snate@binkert.org	encumbered/dev/dma.cc
2774762Snate@binkert.org	encumbered/dev/etherdev.cc
2784762Snate@binkert.org	encumbered/dev/scsi.cc
2794762Snate@binkert.org	encumbered/dev/scsi_ctrl.cc
2804762Snate@binkert.org	encumbered/dev/scsi_disk.cc
2814762Snate@binkert.org	encumbered/dev/scsi_none.cc
2824762Snate@binkert.org	encumbered/dev/tlaser_clock.cc
2834762Snate@binkert.org	encumbered/dev/tlaser_ipi.cc
2844762Snate@binkert.org	encumbered/dev/tlaser_mbox.cc
2854762Snate@binkert.org	encumbered/dev/tlaser_mc146818.cc
2864762Snate@binkert.org	encumbered/dev/tlaser_node.cc
2874762Snate@binkert.org	encumbered/dev/tlaser_pcia.cc
2884762Snate@binkert.org	encumbered/dev/tlaser_pcidev.cc
2894762Snate@binkert.org	encumbered/dev/tlaser_serial.cc
2904762Snate@binkert.org	encumbered/dev/turbolaser.cc
2914762Snate@binkert.org	encumbered/dev/uart8530.cc
2924762Snate@binkert.org        ''')
2934762Snate@binkert.org
2944762Snate@binkert.org# Syscall emulation (non-full-system) sources
2954762Snate@binkert.orgsyscall_emulation_sources = Split('''
2964762Snate@binkert.org	cpu/memtest/memtest.cc
2974762Snate@binkert.org	encumbered/eio/eio.cc
2984762Snate@binkert.org	encumbered/eio/exolex.cc
2994762Snate@binkert.org	encumbered/eio/libexo.cc
3004762Snate@binkert.org        kern/linux/linux.cc
3014762Snate@binkert.org        kern/tru64/tru64.cc
3024762Snate@binkert.org	sim/process.cc
3034762Snate@binkert.org	sim/syscall_emul.cc
3044762Snate@binkert.org        ''')
3054762Snate@binkert.org
3064762Snate@binkert.org# The following stuff (targetarch code and global define of THE_ISA)
3074762Snate@binkert.org# are legacy things that assume we're only compiling one ISA at a
3084762Snate@binkert.org# time.  These will have to go away if we want to build a binary that
3094762Snate@binkert.org# supports multiple ISAs.
3104762Snate@binkert.org
3114762Snate@binkert.org#targetarch_files = Split('''
3124762Snate@binkert.org#        alpha_linux_process.hh
3134762Snate@binkert.org#        alpha_memory.hh
3144762Snate@binkert.org#        alpha_tru64_process.hh
3154762Snate@binkert.org#        aout_machdep.h
3164762Snate@binkert.org#        arguments.hh
3174762Snate@binkert.org#        ecoff_machdep.h
3184382Sbinkertn@umich.edu#        ev5.hh
3194762Snate@binkert.org#        faults.hh
3204382Sbinkertn@umich.edu#        stacktrace.hh
3214762Snate@binkert.org#        vtophys.hh
3224382Sbinkertn@umich.edu#        ''')
3234762Snate@binkert.org
3244762Snate@binkert.org# Set up bridging headers to the architecture specific versions
3254762Snate@binkert.org#for f in targetarch_files:
3264762Snate@binkert.org#    env.Command('targetarch/' + f, 'arch/%s/%s' % (env['TARGET_ISA'], f),
3274382Sbinkertn@umich.edu#                '''echo '#include "arch/%s/%s"' > $TARGET''' % (env['TARGET_ISA'], f))
3284382Sbinkertn@umich.edu
3294382Sbinkertn@umich.edu# Add a flag defining what THE_ISA should be for all compilation
3304382Sbinkertn@umich.eduenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
3314382Sbinkertn@umich.edu
3324382Sbinkertn@umich.eduarch_sources = SConscript('arch/SConscript',
3334762Snate@binkert.org                          exports = 'env', duplicate = False)
3344382Sbinkertn@umich.edu
3354382Sbinkertn@umich.educpu_sources = SConscript('cpu/SConscript',
3364382Sbinkertn@umich.edu                         exports = 'env', duplicate = False)
3374382Sbinkertn@umich.edu
3384762Snate@binkert.org# This is outside of cpu/SConscript since the source directory isn't
3394762Snate@binkert.org# underneath 'cpu'.
3404762Snate@binkert.orgif 'FullCPU' in env['CPU_MODELS']:
3414382Sbinkertn@umich.edu    cpu_sources += full_cpu_sources
3425192Ssaidi@eecs.umich.edu
3435192Ssaidi@eecs.umich.edu# Set up complete list of sources based on configuration.
3445192Ssaidi@eecs.umich.edusources = base_sources + arch_sources + cpu_sources
3455192Ssaidi@eecs.umich.edu
3465192Ssaidi@eecs.umich.eduif env['FULL_SYSTEM']:
3475192Ssaidi@eecs.umich.edu    sources += full_system_sources
3485192Ssaidi@eecs.umich.edu    if env['ALPHA_TLASER']:
3495192Ssaidi@eecs.umich.edu        sources += turbolaser_sources
3505192Ssaidi@eecs.umich.eduelse:
3514762Snate@binkert.org    sources += syscall_emulation_sources
3524382Sbinkertn@umich.edu
3534382Sbinkertn@umich.eduif env['USE_MYSQL']:
3544382Sbinkertn@umich.edu    sources += mysql_sources
3554762Snate@binkert.org
3564762Snate@binkert.orgfor opt in env.ExportOptions:
3574382Sbinkertn@umich.edu    env.ConfigFile(opt)
3584382Sbinkertn@umich.edu
3594382Sbinkertn@umich.edu###################################################
3604762Snate@binkert.org#
3614382Sbinkertn@umich.edu# Special build rules.
3624382Sbinkertn@umich.edu#
3634762Snate@binkert.org###################################################
3644762Snate@binkert.org
3654762Snate@binkert.org# base/traceflags.{cc,hh} are generated from base/traceflags.py.
3664382Sbinkertn@umich.edu# $TARGET.base will expand to "<build-dir>/base/traceflags".
3674382Sbinkertn@umich.eduenv.Command(Split('base/traceflags.hh base/traceflags.cc'),
3684382Sbinkertn@umich.edu            'base/traceflags.py',
3694382Sbinkertn@umich.edu            'python $SOURCE $TARGET.base')
3704382Sbinkertn@umich.edu
3714382Sbinkertn@umich.edu# libelf build is described in its own SConscript file.
3724382Sbinkertn@umich.edu# SConscript-local is the per-config build, which just copies some
3734382Sbinkertn@umich.edu# header files into a place where they can be found.
3744382Sbinkertn@umich.eduSConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
3754382Sbinkertn@umich.eduSConscript('python/SConscript', exports = ['env'], duplicate=0)
376955SN/A
377955SN/A# This function adds the specified sources to the given build
378955SN/A# environment, and returns a list of all the corresponding SCons
379955SN/A# Object nodes (including an extra one for date.cc).  We explicitly
3801108SN/A# add the Object nodes so we can set up special dependencies for
381955SN/A# date.cc.
382955SN/Adef make_objs(sources, env):
383955SN/A    objs = [env.Object(s) for s in sources]
384955SN/A    # make date.cc depend on all other objects so it always gets
385955SN/A    # recompiled whenever anything else does
386955SN/A    date_obj = env.Object('base/date.cc')
387955SN/A    env.Depends(date_obj, objs)
388955SN/A    objs.append(date_obj)
389955SN/A    return objs
3902655Sstever@eecs.umich.edu
3912655Sstever@eecs.umich.edu###################################################
3922655Sstever@eecs.umich.edu#
3932655Sstever@eecs.umich.edu# Define binaries.  Each different build type (debug, opt, etc.) gets
3942655Sstever@eecs.umich.edu# a slightly different build environment.
3952655Sstever@eecs.umich.edu#
3962655Sstever@eecs.umich.edu###################################################
3972655Sstever@eecs.umich.edu
3982655Sstever@eecs.umich.edu# Include file paths are rooted in this directory.  SCons will
3992655Sstever@eecs.umich.edu# automatically expand '.' to refer to both the source directory and
4004762Snate@binkert.org# the corresponding build directory to pick up generated include
4012655Sstever@eecs.umich.edu# files.
4022655Sstever@eecs.umich.eduenv.Append(CPPPATH='.')
4034007Ssaidi@eecs.umich.edu
4044596Sbinkertn@umich.edu# Debug binary
4054007Ssaidi@eecs.umich.edudebugEnv = env.Copy(OBJSUFFIX='.do')
4064596Sbinkertn@umich.edudebugEnv.Label = 'debug'
4074596Sbinkertn@umich.edudebugEnv.Append(CCFLAGS=Split('-g -gstabs+ -O0'))
4082655Sstever@eecs.umich.edudebugEnv.Append(CPPDEFINES='DEBUG')
4094382Sbinkertn@umich.edutlist = debugEnv.Program(target = 'm5.debug',
4102655Sstever@eecs.umich.edu                         source = make_objs(sources, debugEnv))
4112655Sstever@eecs.umich.edudebugEnv.M5Binary = tlist[0]
4122655Sstever@eecs.umich.edu
413955SN/A# Optimized binary
4143918Ssaidi@eecs.umich.eduoptEnv = env.Copy()
4153918Ssaidi@eecs.umich.eduoptEnv.Label = 'opt'
4163918Ssaidi@eecs.umich.eduoptEnv.Append(CCFLAGS=Split('-g -O5'))
4173918Ssaidi@eecs.umich.edutlist = optEnv.Program(target = 'm5.opt',
4183918Ssaidi@eecs.umich.edu                       source = make_objs(sources, optEnv))
4193918Ssaidi@eecs.umich.eduoptEnv.M5Binary = tlist[0]
4203918Ssaidi@eecs.umich.edu
4213918Ssaidi@eecs.umich.edu# "Fast" binary
4223918Ssaidi@eecs.umich.edufastEnv = env.Copy(OBJSUFFIX='.fo')
4233918Ssaidi@eecs.umich.edufastEnv.Label = 'fast'
4243918Ssaidi@eecs.umich.edufastEnv.Append(CCFLAGS=Split('-O5'))
4253918Ssaidi@eecs.umich.edufastEnv.Append(CPPDEFINES='NDEBUG')
4263918Ssaidi@eecs.umich.edufastEnv.Program(target = 'm5.fast.unstripped',
4273918Ssaidi@eecs.umich.edu                source = make_objs(sources, fastEnv))
4283940Ssaidi@eecs.umich.edutlist = fastEnv.Command(target = 'm5.fast',
4293940Ssaidi@eecs.umich.edu                        source = 'm5.fast.unstripped',
4303940Ssaidi@eecs.umich.edu                        action = 'strip $SOURCE -o $TARGET')
4313942Ssaidi@eecs.umich.edufastEnv.M5Binary = tlist[0]
4323940Ssaidi@eecs.umich.edu
4333515Ssaidi@eecs.umich.edu# Profiled binary
4343918Ssaidi@eecs.umich.eduprofEnv = env.Copy(OBJSUFFIX='.po')
4354762Snate@binkert.orgprofEnv.Label = 'prof'
4363515Ssaidi@eecs.umich.eduprofEnv.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg')
4372655Sstever@eecs.umich.edutlist = profEnv.Program(target = 'm5.prof',
4383918Ssaidi@eecs.umich.edu                        source = make_objs(sources, profEnv))
4393619Sbinkertn@umich.eduprofEnv.M5Binary = tlist[0]
440955SN/A
441955SN/AenvList = [debugEnv, optEnv, fastEnv, profEnv]
4422655Sstever@eecs.umich.edu
4433918Ssaidi@eecs.umich.eduReturn('envList')
4443619Sbinkertn@umich.edu