SConscript revision 2037
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
335517Snate@binkert.org# This file defines how to build a particular configuration of M5
34955SN/A# based on variable settings in the 'env' build environment.
355517Snate@binkert.org
364202Sbinkertn@umich.edu# Import build environment variable from SConstruct.
375342Sstever@gmail.comImport('env')
38955SN/A
394381Sbinkertn@umich.edu###################################################
404381Sbinkertn@umich.edu#
41955SN/A# Define needed sources.
42955SN/A#
43955SN/A###################################################
444202Sbinkertn@umich.edu
45955SN/A# Base sources used by all configurations.
464382Sbinkertn@umich.edu
474382Sbinkertn@umich.edubase_sources = Split('''
484382Sbinkertn@umich.edu	base/circlebuf.cc
495517Snate@binkert.org	base/copyright.cc
505517Snate@binkert.org	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/o3/2bit_local_pred.cc
904762Snate@binkert.org        cpu/o3/alpha_dyn_inst.cc
914762Snate@binkert.org        cpu/o3/alpha_cpu.cc
924762Snate@binkert.org        cpu/o3/alpha_cpu_builder.cc
934762Snate@binkert.org        cpu/o3/bpred_unit.cc
944762Snate@binkert.org        cpu/o3/btb.cc
954762Snate@binkert.org        cpu/o3/commit.cc
964762Snate@binkert.org        cpu/o3/decode.cc
974762Snate@binkert.org        cpu/o3/fetch.cc
984762Snate@binkert.org        cpu/o3/free_list.cc
994762Snate@binkert.org        cpu/o3/cpu.cc
1004762Snate@binkert.org        cpu/o3/iew.cc
1014762Snate@binkert.org        cpu/o3/inst_queue.cc
1024762Snate@binkert.org        cpu/o3/ldstq.cc
1034762Snate@binkert.org        cpu/o3/mem_dep_unit.cc
1044762Snate@binkert.org        cpu/o3/ras.cc
1054762Snate@binkert.org        cpu/o3/rename.cc
1064762Snate@binkert.org        cpu/o3/rename_map.cc
1074762Snate@binkert.org        cpu/o3/rob.cc
1084762Snate@binkert.org        cpu/o3/sat_counter.cc
1094762Snate@binkert.org        cpu/o3/store_set.cc
1104762Snate@binkert.org        cpu/o3/tournament_pred.cc
1114762Snate@binkert.org	cpu/fast/cpu.cc
1124762Snate@binkert.org        cpu/sampler/sampler.cc
1134762Snate@binkert.org        cpu/simple/cpu.cc
1144762Snate@binkert.org        cpu/trace/reader/mem_trace_reader.cc
1154762Snate@binkert.org        cpu/trace/reader/ibm_reader.cc
1164762Snate@binkert.org        cpu/trace/reader/itx_reader.cc
1174762Snate@binkert.org        cpu/trace/reader/m5_reader.cc
1184762Snate@binkert.org        cpu/trace/opt_cpu.cc
1194762Snate@binkert.org        cpu/trace/trace_cpu.cc
1204762Snate@binkert.org
1214762Snate@binkert.org	encumbered/cpu/full/bpred.cc
1224762Snate@binkert.org	encumbered/cpu/full/commit.cc
1234762Snate@binkert.org	encumbered/cpu/full/cpu.cc
1244762Snate@binkert.org	encumbered/cpu/full/create_vector.cc
1254762Snate@binkert.org	encumbered/cpu/full/cv_spec_state.cc
1264762Snate@binkert.org	encumbered/cpu/full/dd_queue.cc
1274762Snate@binkert.org	encumbered/cpu/full/dep_link.cc
1284762Snate@binkert.org	encumbered/cpu/full/dispatch.cc
129955SN/A	encumbered/cpu/full/dyn_inst.cc
1304382Sbinkertn@umich.edu	encumbered/cpu/full/execute.cc
1314202Sbinkertn@umich.edu	encumbered/cpu/full/fetch.cc
1324382Sbinkertn@umich.edu	encumbered/cpu/full/floss_reasons.cc
1334382Sbinkertn@umich.edu	encumbered/cpu/full/fu_pool.cc
1344382Sbinkertn@umich.edu	encumbered/cpu/full/inst_fifo.cc
1354382Sbinkertn@umich.edu	encumbered/cpu/full/instpipe.cc
1364382Sbinkertn@umich.edu	encumbered/cpu/full/issue.cc
1374382Sbinkertn@umich.edu	encumbered/cpu/full/ls_queue.cc
1385192Ssaidi@eecs.umich.edu	encumbered/cpu/full/machine_queue.cc
1395192Ssaidi@eecs.umich.edu        encumbered/cpu/full/pipetrace.cc
1405192Ssaidi@eecs.umich.edu        encumbered/cpu/full/readyq.cc
1415192Ssaidi@eecs.umich.edu        encumbered/cpu/full/reg_info.cc
1425192Ssaidi@eecs.umich.edu        encumbered/cpu/full/rob_station.cc
1435192Ssaidi@eecs.umich.edu        encumbered/cpu/full/spec_memory.cc
1445192Ssaidi@eecs.umich.edu        encumbered/cpu/full/spec_state.cc
1455192Ssaidi@eecs.umich.edu        encumbered/cpu/full/storebuffer.cc
1465192Ssaidi@eecs.umich.edu        encumbered/cpu/full/writeback.cc
1475192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/iq_station.cc
1485192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/iqueue.cc
1495192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/segmented/chain_info.cc
1505192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/segmented/chain_wire.cc
1515192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/segmented/iq_seg.cc
1525192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/segmented/iq_segmented.cc
1535192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/segmented/seg_chain.cc
1545192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/seznec/iq_seznec.cc
1555192Ssaidi@eecs.umich.edu        encumbered/cpu/full/iq/standard/iq_standard.cc
1565192Ssaidi@eecs.umich.edu	encumbered/mem/functional/main.cc
1575192Ssaidi@eecs.umich.edu
1585192Ssaidi@eecs.umich.edu	mem/base_hier.cc
1595192Ssaidi@eecs.umich.edu	mem/base_mem.cc
1605192Ssaidi@eecs.umich.edu	mem/hier_params.cc
1615192Ssaidi@eecs.umich.edu	mem/mem_cmd.cc
1625192Ssaidi@eecs.umich.edu	mem/mem_debug.cc
1635192Ssaidi@eecs.umich.edu	mem/mem_req.cc
1645192Ssaidi@eecs.umich.edu	mem/memory_interface.cc
1655192Ssaidi@eecs.umich.edu	mem/bus/base_interface.cc
1665192Ssaidi@eecs.umich.edu	mem/bus/bus.cc
1675192Ssaidi@eecs.umich.edu	mem/bus/bus_bridge.cc
1685192Ssaidi@eecs.umich.edu	mem/bus/bus_bridge_master.cc
1695192Ssaidi@eecs.umich.edu	mem/bus/bus_bridge_slave.cc
1704382Sbinkertn@umich.edu	mem/bus/bus_interface.cc
1714382Sbinkertn@umich.edu	mem/bus/dma_bus_interface.cc
1724382Sbinkertn@umich.edu	mem/bus/dma_interface.cc
1732667Sstever@eecs.umich.edu	mem/bus/master_interface.cc
1742667Sstever@eecs.umich.edu	mem/bus/slave_interface.cc
1752667Sstever@eecs.umich.edu	mem/cache/base_cache.cc
1762667Sstever@eecs.umich.edu	mem/cache/cache.cc
1772667Sstever@eecs.umich.edu	mem/cache/cache_builder.cc
1782667Sstever@eecs.umich.edu	mem/cache/coherence/coherence_protocol.cc
1792037SN/A	mem/cache/coherence/uni_coherence.cc
1802037SN/A	mem/cache/miss/blocking_buffer.cc
1812037SN/A	mem/cache/miss/miss_queue.cc
1824382Sbinkertn@umich.edu	mem/cache/miss/mshr.cc
1834762Snate@binkert.org	mem/cache/miss/mshr_queue.cc
1845344Sstever@gmail.com        mem/cache/prefetch/base_prefetcher.cc
1854382Sbinkertn@umich.edu        mem/cache/prefetch/prefetcher.cc
1865341Sstever@gmail.com        mem/cache/prefetch/tagged_prefetcher.cc
1875341Sstever@gmail.com	mem/cache/tags/base_tags.cc
1885341Sstever@gmail.com	mem/cache/tags/cache_tags.cc	
1895344Sstever@gmail.com	mem/cache/tags/fa_lru.cc
1905341Sstever@gmail.com	mem/cache/tags/iic.cc
1915341Sstever@gmail.com	mem/cache/tags/lru.cc
1925341Sstever@gmail.com	mem/cache/tags/repl/gen.cc
1934762Snate@binkert.org	mem/cache/tags/repl/repl.cc
1945341Sstever@gmail.com	mem/cache/tags/split.cc
1955344Sstever@gmail.com	mem/cache/tags/split_lru.cc
1965341Sstever@gmail.com	mem/cache/tags/split_lifo.cc
1974773Snate@binkert.org	mem/functional/functional.cc
1981858SN/A	mem/timing/base_memory.cc
1991858SN/A	mem/timing/memory_builder.cc
2001085SN/A	mem/timing/simple_mem_bank.cc
2014382Sbinkertn@umich.edu        mem/trace/itx_writer.cc
2024382Sbinkertn@umich.edu	mem/trace/mem_trace_writer.cc
2034762Snate@binkert.org	mem/trace/m5_writer.cc
2044762Snate@binkert.org
2054762Snate@binkert.org        python/pyconfig.cc
2065517Snate@binkert.org        python/embedded_py.cc
2075517Snate@binkert.org
2085517Snate@binkert.org	sim/builder.cc
2095517Snate@binkert.org	sim/configfile.cc
2105517Snate@binkert.org	sim/debug.cc
2115517Snate@binkert.org	sim/eventq.cc
2125517Snate@binkert.org	sim/main.cc
2135517Snate@binkert.org	sim/param.cc
2145517Snate@binkert.org	sim/profile.cc
2155517Snate@binkert.org	sim/root.cc
2165517Snate@binkert.org	sim/serialize.cc
2175517Snate@binkert.org	sim/sim_events.cc
2185517Snate@binkert.org	sim/sim_exit.cc
2195517Snate@binkert.org	sim/sim_object.cc
2205517Snate@binkert.org	sim/startup.cc
2215517Snate@binkert.org	sim/stat_context.cc
2225517Snate@binkert.org	sim/stat_control.cc
2235517Snate@binkert.org	sim/trace_context.cc
2245517Snate@binkert.org        ''')
2255517Snate@binkert.org# These are now included by the architecture specific SConscript
2265517Snate@binkert.org#	arch/alpha/decoder.cc
2275517Snate@binkert.org#	arch/alpha/alpha_o3_exec.cc
2285517Snate@binkert.org#	arch/alpha/fast_cpu_exec.cc
2295517Snate@binkert.org#	arch/alpha/simple_cpu_exec.cc
2305517Snate@binkert.org#	arch/alpha/full_cpu_exec.cc
2315517Snate@binkert.org#	arch/alpha/faults.cc
2325517Snate@binkert.org#	arch/alpha/isa_traits.cc
2335517Snate@binkert.org
2345517Snate@binkert.org# MySql sources
2355517Snate@binkert.orgmysql_sources = Split('''
2365517Snate@binkert.org	base/mysql.cc
2375517Snate@binkert.org	base/stats/mysql.cc
2385517Snate@binkert.org        ''')
2395517Snate@binkert.org
2405517Snate@binkert.org# Full-system sources
2415517Snate@binkert.orgfull_system_sources = Split('''
2425517Snate@binkert.org	base/crc.cc
2435517Snate@binkert.org	base/inet.cc
2445517Snate@binkert.org	base/remote_gdb.cc
2455517Snate@binkert.org
2465517Snate@binkert.org	cpu/intr_control.cc
2475517Snate@binkert.org        cpu/profile.cc
2485517Snate@binkert.org
2495517Snate@binkert.org	dev/alpha_console.cc
2505517Snate@binkert.org	dev/baddev.cc
2515517Snate@binkert.org        dev/simconsole.cc
2525517Snate@binkert.org	dev/disk_image.cc
2535517Snate@binkert.org	dev/etherbus.cc
2545517Snate@binkert.org	dev/etherdump.cc
2555517Snate@binkert.org	dev/etherint.cc
2565517Snate@binkert.org	dev/etherlink.cc
2575517Snate@binkert.org	dev/etherpkt.cc
2585517Snate@binkert.org	dev/ethertap.cc
2595517Snate@binkert.org	dev/ide_ctrl.cc
2605517Snate@binkert.org	dev/ide_disk.cc
2615517Snate@binkert.org	dev/io_device.cc
2625517Snate@binkert.org	dev/ns_gige.cc
2635517Snate@binkert.org	dev/pciconfigall.cc
2645517Snate@binkert.org	dev/pcidev.cc
2655517Snate@binkert.org	dev/pcifake.cc
2665517Snate@binkert.org	dev/pktfifo.cc
2675517Snate@binkert.org	dev/platform.cc
2685517Snate@binkert.org	dev/sinic.cc
2695517Snate@binkert.org	dev/simple_disk.cc
2705517Snate@binkert.org	dev/tsunami.cc
2715517Snate@binkert.org	dev/tsunami_cchip.cc
2725517Snate@binkert.org	dev/isa_fake.cc
2735517Snate@binkert.org	dev/tsunami_io.cc
2745517Snate@binkert.org	dev/tsunami_pchip.cc
2755517Snate@binkert.org	dev/uart.cc
2765517Snate@binkert.org	dev/uart8250.cc
2775517Snate@binkert.org
2785517Snate@binkert.org	kern/kernel_binning.cc
2795517Snate@binkert.org	kern/kernel_stats.cc
2805517Snate@binkert.org	kern/system_events.cc
2815517Snate@binkert.org	kern/freebsd/freebsd_system.cc
2825517Snate@binkert.org	kern/linux/linux_syscalls.cc
2835517Snate@binkert.org	kern/linux/linux_system.cc
2845517Snate@binkert.org	kern/linux/printk.cc
2855517Snate@binkert.org	kern/tru64/dump_mbuf.cc
2865517Snate@binkert.org	kern/tru64/printf.cc
2875517Snate@binkert.org	kern/tru64/tru64_events.cc
2885517Snate@binkert.org	kern/tru64/tru64_syscalls.cc
2895517Snate@binkert.org	kern/tru64/tru64_system.cc
2905517Snate@binkert.org
2914762Snate@binkert.org	mem/functional/memory_control.cc
2925517Snate@binkert.org	mem/functional/physical.cc
2935517Snate@binkert.org
2944762Snate@binkert.org	sim/system.cc
2955517Snate@binkert.org        ''')
2964762Snate@binkert.org
2975517Snate@binkert.org# These are now included by the architecture specific SConscript
2985517Snate@binkert.org#	arch/alpha/alpha_memory.cc
2995517Snate@binkert.org#	arch/alpha/arguments.cc
3005517Snate@binkert.org#	arch/alpha/ev5.cc
3015517Snate@binkert.org#	arch/alpha/osfpal.cc
3025517Snate@binkert.org#	arch/alpha/pseudo_inst.cc
3035517Snate@binkert.org#	arch/alpha/stacktrace.cc
3045517Snate@binkert.org#	arch/alpha/vtophys.cc
3055517Snate@binkert.org
3065517Snate@binkert.org# turbolaser encumbered sources
3075517Snate@binkert.orgturbolaser_sources = Split('''
3085517Snate@binkert.org	encumbered/dev/dma.cc
3095517Snate@binkert.org	encumbered/dev/etherdev.cc
3105517Snate@binkert.org	encumbered/dev/scsi.cc
3115517Snate@binkert.org	encumbered/dev/scsi_ctrl.cc
3125517Snate@binkert.org	encumbered/dev/scsi_disk.cc
3135517Snate@binkert.org	encumbered/dev/scsi_none.cc
3145517Snate@binkert.org	encumbered/dev/tlaser_clock.cc
3155517Snate@binkert.org	encumbered/dev/tlaser_ipi.cc
3165517Snate@binkert.org	encumbered/dev/tlaser_mbox.cc
3175517Snate@binkert.org	encumbered/dev/tlaser_mc146818.cc
3185517Snate@binkert.org	encumbered/dev/tlaser_node.cc
3195517Snate@binkert.org	encumbered/dev/tlaser_pcia.cc
3204762Snate@binkert.org	encumbered/dev/tlaser_pcidev.cc
3214762Snate@binkert.org	encumbered/dev/tlaser_serial.cc
3224762Snate@binkert.org	encumbered/dev/turbolaser.cc
3234762Snate@binkert.org	encumbered/dev/uart8530.cc
3244762Snate@binkert.org        ''')
3254762Snate@binkert.org
3265517Snate@binkert.org# Syscall emulation (non-full-system) sources
3274762Snate@binkert.orgsyscall_emulation_sources = Split('''
3284762Snate@binkert.org	cpu/memtest/memtest.cc
3294762Snate@binkert.org	encumbered/eio/eio.cc
3304762Snate@binkert.org	encumbered/eio/exolex.cc
3314382Sbinkertn@umich.edu	encumbered/eio/libexo.cc
3324382Sbinkertn@umich.edu	sim/process.cc
3335517Snate@binkert.org	sim/syscall_emul.cc
3345517Snate@binkert.org        ''')
3355517Snate@binkert.org
3365517Snate@binkert.org# These are now included by the architecture specific SConscript
3375517Snate@binkert.org#	arch/alpha/alpha_common_syscall_emul.cc
3385517Snate@binkert.org#	arch/alpha/alpha_linux_process.cc
3395517Snate@binkert.org#	arch/alpha/alpha_tru64_process.cc
3405517Snate@binkert.org
3415517Snate@binkert.orgtargetarch_files = Split('''
3425517Snate@binkert.org        alpha_linux_process.hh
3435517Snate@binkert.org        alpha_memory.hh
3445517Snate@binkert.org        alpha_tru64_process.hh
3455517Snate@binkert.org        aout_machdep.h
3465517Snate@binkert.org        arguments.hh
3475517Snate@binkert.org        ecoff_machdep.h
3485517Snate@binkert.org        ev5.hh
3495517Snate@binkert.org        faults.hh
3505517Snate@binkert.org        isa_fullsys_traits.hh
3515517Snate@binkert.org        isa_traits.hh
3525517Snate@binkert.org        pseudo_inst.hh
3535517Snate@binkert.org        stacktrace.hh
3545517Snate@binkert.org        vptr.hh
3555517Snate@binkert.org        vtophys.hh
3565517Snate@binkert.org        ''')
3574762Snate@binkert.org#        osfpal.hh
3585517Snate@binkert.org#        byte_swap.hh
3594382Sbinkertn@umich.edu#        alpha_common_syscall_emul.hh
3604382Sbinkertn@umich.edu
3614762Snate@binkert.org# Set up bridging headers to the architecture specific versions
3624382Sbinkertn@umich.edufor f in targetarch_files:
3634382Sbinkertn@umich.edu    env.Command('targetarch/' + f, 'arch/%s/%s' % (env['TARGET_ISA'], f),
3645517Snate@binkert.org                '''echo '#include "arch/%s/%s"' > $TARGET''' % (env['TARGET_ISA'], f))
3654382Sbinkertn@umich.edu
3664382Sbinkertn@umich.edu# Let the target architecture define what sources it needs
3674762Snate@binkert.orgarch_source = SConscript('arch/%s/SConscript' % env['TARGET_ISA'],
3684382Sbinkertn@umich.edu	build_dir = 'build/%s/' % env['BUILD_DIR'],
3694762Snate@binkert.org	exports = 'env', duplicate = False)
3705517Snate@binkert.org
3714382Sbinkertn@umich.edu# Add a flag defining what THE_ISA should be for all compilation
3724382Sbinkertn@umich.eduenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
3734762Snate@binkert.org
3744762Snate@binkert.org# Set up complete list of sources based on configuration.
3754762Snate@binkert.orgsources = base_sources + arch_source
3764762Snate@binkert.org
3774762Snate@binkert.orgif env['FULL_SYSTEM']:
3785517Snate@binkert.org    sources += full_system_sources
3795517Snate@binkert.org    if env['ALPHA_TLASER']:
3805517Snate@binkert.org        sources += turbolaser_sources
3815517Snate@binkert.orgelse:
3825517Snate@binkert.org    sources += syscall_emulation_sources
3835517Snate@binkert.org
3845517Snate@binkert.orgif env['USE_MYSQL']:
3855517Snate@binkert.org    sources += mysql_sources
3865517Snate@binkert.org
3875517Snate@binkert.orgfor opt in env.ExportOptions:
3885517Snate@binkert.org    env.ConfigFile(opt)
3895517Snate@binkert.org
3905517Snate@binkert.org###################################################
3915517Snate@binkert.org#
3925517Snate@binkert.org# Add an SCons scanner for ISA files
3935517Snate@binkert.org#
3945517Snate@binkert.org###################################################
3955517Snate@binkert.orgimport SCons.Scanner
3965517Snate@binkert.org
3975517Snate@binkert.orgdef ISAScan():
3985517Snate@binkert.org   return SCons.Scanner.Classic("ISAScan",
3995517Snate@binkert.org                                "$ISASUFFIXES",
4005517Snate@binkert.org                                "SRCDIR",
4015517Snate@binkert.org                                '^[ \t]*##[ \t]*include[ \t]*"([^>"]+)"')
4025517Snate@binkert.org
4035517Snate@binkert.orgdef ISAPath(env, dir, a=None):
4045517Snate@binkert.org   return (Dir(env['SRCDIR']), Dir('.'))   
4055517Snate@binkert.org
4065517Snate@binkert.orgiscan = Scanner(function = ISAScan().scan, skeys = [".isa", ".ISA"],
4075517Snate@binkert.org                path_function = ISAPath)
4085517Snate@binkert.orgenv.Append(SCANNERS = iscan)
4095517Snate@binkert.org
4105517Snate@binkert.org 
4115517Snate@binkert.org###################################################
4125517Snate@binkert.org#
4135517Snate@binkert.org# Special build rules.
4145517Snate@binkert.org#
4155517Snate@binkert.org###################################################
4164762Snate@binkert.org
4174762Snate@binkert.org# base/traceflags.{cc,hh} are generated from base/traceflags.py.
4185517Snate@binkert.org# $TARGET.base will expand to "<build-dir>/base/traceflags".
4195517Snate@binkert.orgenv.Command(Split('base/traceflags.hh base/traceflags.cc'),
4204762Snate@binkert.org            'base/traceflags.py',
4214762Snate@binkert.org            'python $SOURCE $TARGET.base')
4224762Snate@binkert.org
4235517Snate@binkert.org# several files are generated from arch/$TARGET_ISA/isa_desc.
4244762Snate@binkert.orgenv.Command(Split('''
4254762Snate@binkert.org	arch/%s/decoder.cc
4264762Snate@binkert.org	arch/%s/decoder.hh
4275463Snate@binkert.org        arch/%s/alpha_o3_exec.cc
4285517Snate@binkert.org	arch/%s/fast_cpu_exec.cc
4294762Snate@binkert.org        arch/%s/simple_cpu_exec.cc
4304762Snate@binkert.org        arch/%s/full_cpu_exec.cc''' %
4314762Snate@binkert.org	(env['TARGET_ISA'],
4324762Snate@binkert.org	env['TARGET_ISA'],
4334762Snate@binkert.org	env['TARGET_ISA'],
4344762Snate@binkert.org	env['TARGET_ISA'],
4355463Snate@binkert.org	env['TARGET_ISA'],
4365517Snate@binkert.org	env['TARGET_ISA'])),
4374762Snate@binkert.org	Split('''
4384762Snate@binkert.org	arch/%s/isa/main.isa
4394762Snate@binkert.org	arch/isa_parser.py''' %
4405517Snate@binkert.org	env['TARGET_ISA']),
4415517Snate@binkert.org	'$SRCDIR/arch/isa_parser.py $SOURCE $TARGET.dir arch/%s' % env['TARGET_ISA'])
4424762Snate@binkert.org
4434762Snate@binkert.org
4445517Snate@binkert.org# libelf build is described in its own SConscript file.
4454762Snate@binkert.org# SConscript-local is the per-config build, which just copies some
4464762Snate@binkert.org# header files into a place where they can be found.
4474762Snate@binkert.orgSConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
4484762Snate@binkert.orgSConscript('python/SConscript', exports = ['env'], duplicate=0)
4495517Snate@binkert.org
4504762Snate@binkert.org# This function adds the specified sources to the given build
4514762Snate@binkert.org# environment, and returns a list of all the corresponding SCons
4524762Snate@binkert.org# Object nodes (including an extra one for date.cc).  We explicitly
4534762Snate@binkert.org# add the Object nodes so we can set up special dependencies for
4545517Snate@binkert.org# date.cc.
4555517Snate@binkert.orgdef make_objs(sources, env):
4565517Snate@binkert.org    objs = [env.Object(s) for s in sources]
4575517Snate@binkert.org    # make date.cc depend on all other objects so it always gets
4585517Snate@binkert.org    # recompiled whenever anything else does
4595517Snate@binkert.org    date_obj = env.Object('base/date.cc')
4605517Snate@binkert.org    env.Depends(date_obj, objs)
4615517Snate@binkert.org    objs.append(date_obj)
4625517Snate@binkert.org    return objs
4635517Snate@binkert.org
4645517Snate@binkert.org###################################################
4655517Snate@binkert.org#
4665517Snate@binkert.org# Define binaries.  Each different build type (debug, opt, etc.) gets
4675517Snate@binkert.org# a slightly different build environment.
4685517Snate@binkert.org#
4695517Snate@binkert.org###################################################
4705517Snate@binkert.org
4715517Snate@binkert.org# Include file paths are rooted in this directory.  SCons will
4725517Snate@binkert.org# automatically expand '.' to refer to both the source directory and
4735517Snate@binkert.org# the corresponding build directory to pick up generated include
4745517Snate@binkert.org# files.
4755517Snate@binkert.orgenv.Append(CPPPATH='.')
4765517Snate@binkert.org
4775517Snate@binkert.org# Debug binary
4785517Snate@binkert.orgdebugEnv = env.Copy(OBJSUFFIX='.do')
4795517Snate@binkert.orgdebugEnv.Label = 'debug'
4805517Snate@binkert.orgdebugEnv.Append(CCFLAGS=Split('-g -gstabs+ -O0'))
4815517Snate@binkert.orgdebugEnv.Append(CPPDEFINES='DEBUG')
4825517Snate@binkert.orgtlist = debugEnv.Program(target = 'm5.debug',
4835517Snate@binkert.org                         source = make_objs(sources, debugEnv))
4845517Snate@binkert.orgdebugEnv.M5Binary = tlist[0]
4855517Snate@binkert.org
4865517Snate@binkert.org# Optimized binary
4875517Snate@binkert.orgoptEnv = env.Copy()
4885517Snate@binkert.orgoptEnv.Label = 'opt'
4895517Snate@binkert.orgoptEnv.Append(CCFLAGS=Split('-g -O5'))
4905517Snate@binkert.orgtlist = optEnv.Program(target = 'm5.opt',
4915517Snate@binkert.org                       source = make_objs(sources, optEnv))
4925517Snate@binkert.orgoptEnv.M5Binary = tlist[0]
4935517Snate@binkert.org
4945517Snate@binkert.org# "Fast" binary
4955517Snate@binkert.orgfastEnv = env.Copy(OBJSUFFIX='.fo')
4965517Snate@binkert.orgfastEnv.Label = 'fast'
4975517Snate@binkert.orgfastEnv.Append(CCFLAGS=Split('-O5'))
4985517Snate@binkert.orgfastEnv.Append(CPPDEFINES='NDEBUG')
4995517Snate@binkert.orgfastEnv.Program(target = 'm5.fast.unstripped',
5005517Snate@binkert.org                source = make_objs(sources, fastEnv))
5015517Snate@binkert.orgtlist = fastEnv.Command(target = 'm5.fast',
5025517Snate@binkert.org                        source = 'm5.fast.unstripped',
5035517Snate@binkert.org                        action = 'strip $SOURCE -o $TARGET')
5045517Snate@binkert.orgfastEnv.M5Binary = tlist[0]
5055517Snate@binkert.org
5065517Snate@binkert.org# Profiled binary
5075517Snate@binkert.orgprofEnv = env.Copy(OBJSUFFIX='.po')
5085517Snate@binkert.orgprofEnv.Label = 'prof'
5095517Snate@binkert.orgprofEnv.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg')
5105517Snate@binkert.orgtlist = profEnv.Program(target = 'm5.prof',
5115517Snate@binkert.org                        source = make_objs(sources, profEnv))
5125517Snate@binkert.orgprofEnv.M5Binary = tlist[0]
5135517Snate@binkert.org
5145517Snate@binkert.orgenvList = [debugEnv, optEnv, fastEnv, profEnv]
5155517Snate@binkert.org
5165517Snate@binkert.orgReturn('envList')
5175517Snate@binkert.org