SConscript revision 2090
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
315522Snate@binkert.orgfrom os.path import isdir
326143Snate@binkert.org
334762Snate@binkert.org# This file defines how to build a particular configuration of M5
345522Snate@binkert.org# based on variable settings in the 'env' build environment.
35955SN/A
365522Snate@binkert.org# Import build environment variable from SConstruct.
3711974Sgabeblack@google.comImport('env')
38955SN/A
395522Snate@binkert.org###################################################
404202Sbinkertn@umich.edu#
415742Snate@binkert.org# Define needed sources.
42955SN/A#
434381Sbinkertn@umich.edu###################################################
444381Sbinkertn@umich.edu
4512246Sgabeblack@google.com# Base sources used by all configurations.
4612246Sgabeblack@google.com
478334Snate@binkert.orgbase_sources = Split('''
48955SN/A	base/circlebuf.cc
49955SN/A	base/copyright.cc
504202Sbinkertn@umich.edu	base/cprintf.cc
51955SN/A        base/embedfile.cc
524382Sbinkertn@umich.edu	base/fast_alloc.cc
534382Sbinkertn@umich.edu	base/fifo_buffer.cc
544382Sbinkertn@umich.edu	base/hostinfo.cc
556654Snate@binkert.org	base/hybrid_pred.cc
565517Snate@binkert.org	base/inifile.cc
578614Sgblack@eecs.umich.edu	base/intmath.cc
587674Snate@binkert.org	base/match.cc
596143Snate@binkert.org	base/misc.cc
606143Snate@binkert.org	base/output.cc
616143Snate@binkert.org	base/pollevent.cc
6212302Sgabeblack@google.com	base/range.cc
6312302Sgabeblack@google.com	base/random.cc
6412302Sgabeblack@google.com	base/sat_counter.cc
6512302Sgabeblack@google.com	base/socket.cc
6612302Sgabeblack@google.com	base/statistics.cc
6712302Sgabeblack@google.com	base/str.cc
6812302Sgabeblack@google.com	base/time.cc
6912302Sgabeblack@google.com	base/trace.cc
7012302Sgabeblack@google.com	base/traceflags.cc
7112302Sgabeblack@google.com	base/userinfo.cc
7212302Sgabeblack@google.com	base/compression/lzss_compression.cc
7312302Sgabeblack@google.com	base/loader/aout_object.cc
7412302Sgabeblack@google.com	base/loader/ecoff_object.cc
7512302Sgabeblack@google.com	base/loader/elf_object.cc
7612302Sgabeblack@google.com	base/loader/object_file.cc
7712302Sgabeblack@google.com	base/loader/symtab.cc
7812302Sgabeblack@google.com	base/stats/events.cc
7912302Sgabeblack@google.com	base/stats/statdb.cc
8012302Sgabeblack@google.com	base/stats/visit.cc
8112302Sgabeblack@google.com	base/stats/text.cc
8212302Sgabeblack@google.com
8312302Sgabeblack@google.com	cpu/base.cc
8412302Sgabeblack@google.com        cpu/base_dyn_inst.cc
8512302Sgabeblack@google.com	cpu/exec_context.cc
8612302Sgabeblack@google.com	cpu/exetrace.cc
8712302Sgabeblack@google.com	cpu/pc_event.cc
8812302Sgabeblack@google.com	cpu/static_inst.cc
8912302Sgabeblack@google.com        cpu/o3/2bit_local_pred.cc
9012302Sgabeblack@google.com        cpu/o3/alpha_dyn_inst.cc
9111983Sgabeblack@google.com        cpu/o3/alpha_cpu.cc
926143Snate@binkert.org        cpu/o3/alpha_cpu_builder.cc
938233Snate@binkert.org        cpu/o3/bpred_unit.cc
9412302Sgabeblack@google.com        cpu/o3/btb.cc
956143Snate@binkert.org        cpu/o3/commit.cc
966143Snate@binkert.org        cpu/o3/decode.cc
9712302Sgabeblack@google.com        cpu/o3/fetch.cc
984762Snate@binkert.org        cpu/o3/free_list.cc
996143Snate@binkert.org        cpu/o3/cpu.cc
1008233Snate@binkert.org        cpu/o3/iew.cc
1018233Snate@binkert.org        cpu/o3/inst_queue.cc
10212302Sgabeblack@google.com        cpu/o3/ldstq.cc
10312302Sgabeblack@google.com        cpu/o3/mem_dep_unit.cc
1046143Snate@binkert.org        cpu/o3/ras.cc
10512302Sgabeblack@google.com        cpu/o3/rename.cc
10612302Sgabeblack@google.com        cpu/o3/rename_map.cc
10712302Sgabeblack@google.com        cpu/o3/rob.cc
10812302Sgabeblack@google.com        cpu/o3/sat_counter.cc
10912302Sgabeblack@google.com        cpu/o3/store_set.cc
11012302Sgabeblack@google.com        cpu/o3/tournament_pred.cc
11112302Sgabeblack@google.com	cpu/fast/cpu.cc
11212302Sgabeblack@google.com        cpu/sampler/sampler.cc
11312302Sgabeblack@google.com        cpu/simple/cpu.cc
11412302Sgabeblack@google.com        cpu/trace/reader/mem_trace_reader.cc
1158233Snate@binkert.org        cpu/trace/reader/ibm_reader.cc
1166143Snate@binkert.org        cpu/trace/reader/itx_reader.cc
1176143Snate@binkert.org        cpu/trace/reader/m5_reader.cc
1186143Snate@binkert.org        cpu/trace/opt_cpu.cc
1196143Snate@binkert.org        cpu/trace/trace_cpu.cc
1206143Snate@binkert.org
1216143Snate@binkert.org	encumbered/cpu/full/bpred.cc
1226143Snate@binkert.org	encumbered/cpu/full/commit.cc
1236143Snate@binkert.org	encumbered/cpu/full/cpu.cc
1246143Snate@binkert.org	encumbered/cpu/full/create_vector.cc
1257065Snate@binkert.org	encumbered/cpu/full/cv_spec_state.cc
1266143Snate@binkert.org	encumbered/cpu/full/dd_queue.cc
1278233Snate@binkert.org	encumbered/cpu/full/dep_link.cc
1288233Snate@binkert.org	encumbered/cpu/full/dispatch.cc
1298233Snate@binkert.org	encumbered/cpu/full/dyn_inst.cc
1308233Snate@binkert.org	encumbered/cpu/full/execute.cc
1318233Snate@binkert.org	encumbered/cpu/full/fetch.cc
1328233Snate@binkert.org	encumbered/cpu/full/floss_reasons.cc
1338233Snate@binkert.org	encumbered/cpu/full/fu_pool.cc
1348233Snate@binkert.org	encumbered/cpu/full/inst_fifo.cc
1358233Snate@binkert.org	encumbered/cpu/full/instpipe.cc
1368233Snate@binkert.org	encumbered/cpu/full/issue.cc
1378233Snate@binkert.org	encumbered/cpu/full/ls_queue.cc
1388233Snate@binkert.org	encumbered/cpu/full/machine_queue.cc
1398233Snate@binkert.org        encumbered/cpu/full/pipetrace.cc
1408233Snate@binkert.org        encumbered/cpu/full/readyq.cc
1418233Snate@binkert.org        encumbered/cpu/full/reg_info.cc
1428233Snate@binkert.org        encumbered/cpu/full/rob_station.cc
1438233Snate@binkert.org        encumbered/cpu/full/spec_memory.cc
1448233Snate@binkert.org        encumbered/cpu/full/spec_state.cc
1458233Snate@binkert.org        encumbered/cpu/full/storebuffer.cc
1468233Snate@binkert.org        encumbered/cpu/full/writeback.cc
1478233Snate@binkert.org        encumbered/cpu/full/iq/iq_station.cc
1486143Snate@binkert.org        encumbered/cpu/full/iq/iqueue.cc
1496143Snate@binkert.org        encumbered/cpu/full/iq/segmented/chain_info.cc
1506143Snate@binkert.org        encumbered/cpu/full/iq/segmented/chain_wire.cc
1516143Snate@binkert.org        encumbered/cpu/full/iq/segmented/iq_seg.cc
1526143Snate@binkert.org        encumbered/cpu/full/iq/segmented/iq_segmented.cc
1536143Snate@binkert.org        encumbered/cpu/full/iq/segmented/seg_chain.cc
1549982Satgutier@umich.edu        encumbered/cpu/full/iq/seznec/iq_seznec.cc
1556143Snate@binkert.org        encumbered/cpu/full/iq/standard/iq_standard.cc
15612302Sgabeblack@google.com	encumbered/mem/functional/main.cc
15712302Sgabeblack@google.com
15812302Sgabeblack@google.com	mem/base_hier.cc
15912302Sgabeblack@google.com	mem/base_mem.cc
16012302Sgabeblack@google.com	mem/hier_params.cc
16112302Sgabeblack@google.com	mem/mem_cmd.cc
16212302Sgabeblack@google.com	mem/mem_debug.cc
16312302Sgabeblack@google.com	mem/mem_req.cc
16411983Sgabeblack@google.com	mem/memory_interface.cc
16511983Sgabeblack@google.com	mem/bus/base_interface.cc
16611983Sgabeblack@google.com	mem/bus/bus.cc
16712302Sgabeblack@google.com	mem/bus/bus_bridge.cc
16812302Sgabeblack@google.com	mem/bus/bus_bridge_master.cc
16912302Sgabeblack@google.com	mem/bus/bus_bridge_slave.cc
17012302Sgabeblack@google.com	mem/bus/bus_interface.cc
17112302Sgabeblack@google.com	mem/bus/dma_bus_interface.cc
17212302Sgabeblack@google.com	mem/bus/dma_interface.cc
17311983Sgabeblack@google.com	mem/bus/master_interface.cc
1746143Snate@binkert.org	mem/bus/slave_interface.cc
17512305Sgabeblack@google.com	mem/cache/base_cache.cc
17612302Sgabeblack@google.com	mem/cache/cache.cc
17712302Sgabeblack@google.com	mem/cache/cache_builder.cc
17812302Sgabeblack@google.com	mem/cache/coherence/coherence_protocol.cc
1796143Snate@binkert.org	mem/cache/coherence/uni_coherence.cc
1806143Snate@binkert.org	mem/cache/miss/blocking_buffer.cc
1816143Snate@binkert.org	mem/cache/miss/miss_queue.cc
1825522Snate@binkert.org	mem/cache/miss/mshr.cc
1836143Snate@binkert.org	mem/cache/miss/mshr_queue.cc
1846143Snate@binkert.org        mem/cache/prefetch/base_prefetcher.cc
1856143Snate@binkert.org        mem/cache/prefetch/prefetcher.cc
1869982Satgutier@umich.edu        mem/cache/prefetch/tagged_prefetcher.cc
18712302Sgabeblack@google.com	mem/cache/tags/base_tags.cc
18812302Sgabeblack@google.com	mem/cache/tags/cache_tags.cc	
18912302Sgabeblack@google.com	mem/cache/tags/fa_lru.cc
1906143Snate@binkert.org	mem/cache/tags/iic.cc
1916143Snate@binkert.org	mem/cache/tags/lru.cc
1926143Snate@binkert.org	mem/cache/tags/repl/gen.cc
1936143Snate@binkert.org	mem/cache/tags/repl/repl.cc
1945522Snate@binkert.org	mem/cache/tags/split.cc
1955522Snate@binkert.org	mem/cache/tags/split_lru.cc
1965522Snate@binkert.org	mem/cache/tags/split_lifo.cc
1975522Snate@binkert.org	mem/functional/functional.cc
1985604Snate@binkert.org	mem/timing/base_memory.cc
1995604Snate@binkert.org	mem/timing/memory_builder.cc
2006143Snate@binkert.org	mem/timing/simple_mem_bank.cc
2016143Snate@binkert.org        mem/trace/itx_writer.cc
2024762Snate@binkert.org	mem/trace/mem_trace_writer.cc
2034762Snate@binkert.org	mem/trace/m5_writer.cc
2046143Snate@binkert.org
2056727Ssteve.reinhardt@amd.com        python/pyconfig.cc
2066727Ssteve.reinhardt@amd.com        python/embedded_py.cc
2076727Ssteve.reinhardt@amd.com
2084762Snate@binkert.org	sim/builder.cc
2096143Snate@binkert.org	sim/configfile.cc
2106143Snate@binkert.org	sim/debug.cc
2116143Snate@binkert.org	sim/eventq.cc
2126143Snate@binkert.org	sim/faults.cc
2136727Ssteve.reinhardt@amd.com	sim/main.cc
2146143Snate@binkert.org	sim/param.cc
2157674Snate@binkert.org	sim/profile.cc
2167674Snate@binkert.org	sim/root.cc
2175604Snate@binkert.org	sim/serialize.cc
2186143Snate@binkert.org	sim/sim_events.cc
2196143Snate@binkert.org	sim/sim_exit.cc
2206143Snate@binkert.org	sim/sim_object.cc
2214762Snate@binkert.org	sim/startup.cc
2226143Snate@binkert.org	sim/stat_context.cc
2234762Snate@binkert.org	sim/stat_control.cc
2244762Snate@binkert.org	sim/trace_context.cc
2254762Snate@binkert.org        ''')
2266143Snate@binkert.org# These are now included by the architecture specific SConscript
2276143Snate@binkert.org#	arch/alpha/decoder.cc
2284762Snate@binkert.org#	arch/alpha/alpha_o3_exec.cc
22912302Sgabeblack@google.com#	arch/alpha/fast_cpu_exec.cc
23012302Sgabeblack@google.com#	arch/alpha/simple_cpu_exec.cc
2318233Snate@binkert.org#	arch/alpha/full_cpu_exec.cc
23212302Sgabeblack@google.com#	arch/alpha/faults.cc
2336143Snate@binkert.org#	arch/alpha/isa_traits.cc
2346143Snate@binkert.org
2354762Snate@binkert.org# MySql sources
2366143Snate@binkert.orgmysql_sources = Split('''
2374762Snate@binkert.org	base/mysql.cc
2389396Sandreas.hansson@arm.com	base/stats/mysql.cc
2399396Sandreas.hansson@arm.com        ''')
2409396Sandreas.hansson@arm.com
24112302Sgabeblack@google.com# Full-system sources
24212302Sgabeblack@google.comfull_system_sources = Split('''
24312302Sgabeblack@google.com	base/crc.cc
2449396Sandreas.hansson@arm.com	base/inet.cc
2459396Sandreas.hansson@arm.com	base/remote_gdb.cc
2469396Sandreas.hansson@arm.com
2479396Sandreas.hansson@arm.com	cpu/intr_control.cc
2489396Sandreas.hansson@arm.com        cpu/profile.cc
2499396Sandreas.hansson@arm.com
2509396Sandreas.hansson@arm.com	dev/alpha_console.cc
2519930Sandreas.hansson@arm.com	dev/baddev.cc
2529930Sandreas.hansson@arm.com        dev/simconsole.cc
2539396Sandreas.hansson@arm.com	dev/disk_image.cc
2548235Snate@binkert.org	dev/etherbus.cc
2558235Snate@binkert.org	dev/etherdump.cc
2566143Snate@binkert.org	dev/etherint.cc
2578235Snate@binkert.org	dev/etherlink.cc
2589003SAli.Saidi@ARM.com	dev/etherpkt.cc
2598235Snate@binkert.org	dev/ethertap.cc
2608235Snate@binkert.org	dev/ide_ctrl.cc
26112302Sgabeblack@google.com	dev/ide_disk.cc
2628235Snate@binkert.org	dev/io_device.cc
26312302Sgabeblack@google.com	dev/ns_gige.cc
2648235Snate@binkert.org	dev/pciconfigall.cc
2658235Snate@binkert.org	dev/pcidev.cc
26612302Sgabeblack@google.com	dev/pcifake.cc
2678235Snate@binkert.org	dev/pktfifo.cc
2688235Snate@binkert.org	dev/platform.cc
2698235Snate@binkert.org	dev/sinic.cc
2708235Snate@binkert.org	dev/simple_disk.cc
2719003SAli.Saidi@ARM.com	dev/tsunami.cc
2728235Snate@binkert.org	dev/tsunami_cchip.cc
2735584Snate@binkert.org	dev/isa_fake.cc
2744382Sbinkertn@umich.edu	dev/tsunami_io.cc
2754202Sbinkertn@umich.edu	dev/tsunami_pchip.cc
2764382Sbinkertn@umich.edu	dev/uart.cc
2774382Sbinkertn@umich.edu	dev/uart8250.cc
2789396Sandreas.hansson@arm.com
2795584Snate@binkert.org	kern/kernel_binning.cc
2804382Sbinkertn@umich.edu	kern/kernel_stats.cc
2814382Sbinkertn@umich.edu	kern/system_events.cc
2824382Sbinkertn@umich.edu	kern/freebsd/freebsd_system.cc
2838232Snate@binkert.org	kern/linux/linux_syscalls.cc
2845192Ssaidi@eecs.umich.edu	kern/linux/linux_system.cc
2858232Snate@binkert.org	kern/linux/printk.cc
2868232Snate@binkert.org	kern/tru64/dump_mbuf.cc
2878232Snate@binkert.org	kern/tru64/printf.cc
2885192Ssaidi@eecs.umich.edu	kern/tru64/tru64_events.cc
2898232Snate@binkert.org	kern/tru64/tru64_syscalls.cc
2905192Ssaidi@eecs.umich.edu	kern/tru64/tru64_system.cc
2915799Snate@binkert.org
2928232Snate@binkert.org	mem/functional/memory_control.cc
2935192Ssaidi@eecs.umich.edu	mem/functional/physical.cc
2945192Ssaidi@eecs.umich.edu
2955192Ssaidi@eecs.umich.edu	sim/system.cc
2968232Snate@binkert.org	sim/pseudo_inst.cc
2975192Ssaidi@eecs.umich.edu        ''')
2988232Snate@binkert.org
2995192Ssaidi@eecs.umich.edu# These are now included by the architecture specific SConscript
3005192Ssaidi@eecs.umich.edu#	arch/alpha/alpha_memory.cc
3015192Ssaidi@eecs.umich.edu#	arch/alpha/arguments.cc
3025192Ssaidi@eecs.umich.edu#	arch/alpha/ev5.cc
3034382Sbinkertn@umich.edu#	arch/alpha/osfpal.cc
3044382Sbinkertn@umich.edu#	arch/alpha/pseudo_inst.cc
3054382Sbinkertn@umich.edu#	arch/alpha/stacktrace.cc
3062667Sstever@eecs.umich.edu#	arch/alpha/vtophys.cc
3072667Sstever@eecs.umich.edu
3082667Sstever@eecs.umich.edu# turbolaser encumbered sources
3092667Sstever@eecs.umich.eduturbolaser_sources = Split('''
3102667Sstever@eecs.umich.edu	encumbered/dev/dma.cc
3112667Sstever@eecs.umich.edu	encumbered/dev/etherdev.cc
3125742Snate@binkert.org	encumbered/dev/scsi.cc
3135742Snate@binkert.org	encumbered/dev/scsi_ctrl.cc
3145742Snate@binkert.org	encumbered/dev/scsi_disk.cc
3155793Snate@binkert.org	encumbered/dev/scsi_none.cc
3168334Snate@binkert.org	encumbered/dev/tlaser_clock.cc
3175793Snate@binkert.org	encumbered/dev/tlaser_ipi.cc
3185793Snate@binkert.org	encumbered/dev/tlaser_mbox.cc
3195793Snate@binkert.org	encumbered/dev/tlaser_mc146818.cc
3204382Sbinkertn@umich.edu	encumbered/dev/tlaser_node.cc
3214762Snate@binkert.org	encumbered/dev/tlaser_pcia.cc
3225344Sstever@gmail.com	encumbered/dev/tlaser_pcidev.cc
3234382Sbinkertn@umich.edu	encumbered/dev/tlaser_serial.cc
3245341Sstever@gmail.com	encumbered/dev/turbolaser.cc
3255742Snate@binkert.org	encumbered/dev/uart8530.cc
3265742Snate@binkert.org        ''')
3275742Snate@binkert.org
3285742Snate@binkert.org# Syscall emulation (non-full-system) sources
3295742Snate@binkert.orgsyscall_emulation_sources = Split('''
3304762Snate@binkert.org	cpu/memtest/memtest.cc
3315742Snate@binkert.org	encumbered/eio/eio.cc
3325742Snate@binkert.org	encumbered/eio/exolex.cc
33311984Sgabeblack@google.com	encumbered/eio/libexo.cc
3347722Sgblack@eecs.umich.edu	sim/process.cc
3355742Snate@binkert.org	sim/syscall_emul.cc
3365742Snate@binkert.org        ''')
3375742Snate@binkert.org
3389930Sandreas.hansson@arm.com# These are now included by the architecture specific SConscript
3399930Sandreas.hansson@arm.com#	arch/alpha/alpha_common_syscall_emul.cc
3409930Sandreas.hansson@arm.com#	arch/alpha/alpha_linux_process.cc
3419930Sandreas.hansson@arm.com#	arch/alpha/alpha_tru64_process.cc
3429930Sandreas.hansson@arm.com
3435742Snate@binkert.orgtargetarch_files = Split('''
3448242Sbradley.danofsky@amd.com        alpha_linux_process.hh
3458242Sbradley.danofsky@amd.com        alpha_memory.hh
3468242Sbradley.danofsky@amd.com        alpha_tru64_process.hh
3478242Sbradley.danofsky@amd.com        aout_machdep.h
3485341Sstever@gmail.com        arguments.hh
3495742Snate@binkert.org        ecoff_machdep.h
3507722Sgblack@eecs.umich.edu        ev5.hh
3514773Snate@binkert.org        faults.hh
3526108Snate@binkert.org        stacktrace.hh
3531858SN/A        vtophys.hh
3541085SN/A        ''')
3556658Snate@binkert.org#        pseudo_inst.hh
3566658Snate@binkert.org#        isa_traits.hh
3577673Snate@binkert.org#        osfpal.hh
3586658Snate@binkert.org#        byte_swap.hh
3596658Snate@binkert.org#        alpha_common_syscall_emul.hh
36011308Santhony.gutierrez@amd.com#        vptr.hh
3616658Snate@binkert.org#        isa_fullsys_traits.hh
36211308Santhony.gutierrez@amd.com
3636658Snate@binkert.org# Set up bridging headers to the architecture specific versions
3646658Snate@binkert.orgfor f in targetarch_files:
3657673Snate@binkert.org    env.Command('targetarch/' + f, 'arch/%s/%s' % (env['TARGET_ISA'], f),
3667673Snate@binkert.org                '''echo '#include "arch/%s/%s"' > $TARGET''' % (env['TARGET_ISA'], f))
3677673Snate@binkert.org
3687673Snate@binkert.org# Let the target architecture define what sources it needs
3697673Snate@binkert.orgarch_source = SConscript('arch/%s/SConscript' % env['TARGET_ISA'],
3707673Snate@binkert.org	build_dir = 'build/%s/' % env['BUILD_DIR'],
3717673Snate@binkert.org	exports = 'env', duplicate = False)
37210467Sandreas.hansson@arm.com
3736658Snate@binkert.org# Add a flag defining what THE_ISA should be for all compilation
3747673Snate@binkert.orgenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
37510467Sandreas.hansson@arm.com
37610467Sandreas.hansson@arm.com# Set up complete list of sources based on configuration.
37710467Sandreas.hansson@arm.comsources = base_sources + arch_source
37810467Sandreas.hansson@arm.com
37910467Sandreas.hansson@arm.comif env['FULL_SYSTEM']:
38010467Sandreas.hansson@arm.com    sources += full_system_sources
38110467Sandreas.hansson@arm.com    if env['ALPHA_TLASER']:
38210467Sandreas.hansson@arm.com        sources += turbolaser_sources
38310467Sandreas.hansson@arm.comelse:
38410467Sandreas.hansson@arm.com    sources += syscall_emulation_sources
38510467Sandreas.hansson@arm.com
3867673Snate@binkert.orgif env['USE_MYSQL']:
3877673Snate@binkert.org    sources += mysql_sources
3887673Snate@binkert.org
3897673Snate@binkert.orgfor opt in env.ExportOptions:
3907673Snate@binkert.org    env.ConfigFile(opt)
3919048SAli.Saidi@ARM.com
3927673Snate@binkert.org###################################################
3937673Snate@binkert.org#
3947673Snate@binkert.org# Add an SCons scanner for ISA files
3957673Snate@binkert.org#
3966658Snate@binkert.org###################################################
3977756SAli.Saidi@ARM.comimport SCons.Scanner
3987816Ssteve.reinhardt@amd.com
3996658Snate@binkert.orgdef ISAScan():
40011308Santhony.gutierrez@amd.com   return SCons.Scanner.Classic("ISAScan",
40111308Santhony.gutierrez@amd.com                                "$ISASUFFIXES",
40211308Santhony.gutierrez@amd.com                                "SRCDIR",
40311308Santhony.gutierrez@amd.com                                '^[ \t]*##[ \t]*include[ \t]*"([^>"]+)"')
40411308Santhony.gutierrez@amd.com
40511308Santhony.gutierrez@amd.comdef ISAPath(env, dir, target=None, source=None, a=None):
40611308Santhony.gutierrez@amd.com   return (Dir(env['SRCDIR']), Dir('.'))   
40711308Santhony.gutierrez@amd.com
40811308Santhony.gutierrez@amd.comiscan = Scanner(function = ISAScan().scan, skeys = [".isa", ".ISA"],
40911308Santhony.gutierrez@amd.com                path_function = ISAPath)
41011308Santhony.gutierrez@amd.comenv.Append(SCANNERS = iscan)
41111308Santhony.gutierrez@amd.com
41211308Santhony.gutierrez@amd.com 
41311308Santhony.gutierrez@amd.com###################################################
41411308Santhony.gutierrez@amd.com#
41511308Santhony.gutierrez@amd.com# Special build rules.
41611308Santhony.gutierrez@amd.com#
41711308Santhony.gutierrez@amd.com###################################################
41811308Santhony.gutierrez@amd.com
41911308Santhony.gutierrez@amd.com# base/traceflags.{cc,hh} are generated from base/traceflags.py.
42011308Santhony.gutierrez@amd.com# $TARGET.base will expand to "<build-dir>/base/traceflags".
42111308Santhony.gutierrez@amd.comenv.Command(Split('base/traceflags.hh base/traceflags.cc'),
42211308Santhony.gutierrez@amd.com            'base/traceflags.py',
42311308Santhony.gutierrez@amd.com            'python $SOURCE $TARGET.base')
42411308Santhony.gutierrez@amd.com
42511308Santhony.gutierrez@amd.com# several files are generated from arch/$TARGET_ISA/isa_desc.
42611308Santhony.gutierrez@amd.comenv.Command(Split('''
42711308Santhony.gutierrez@amd.com	arch/%s/decoder.cc
42811308Santhony.gutierrez@amd.com	arch/%s/decoder.hh
42911308Santhony.gutierrez@amd.com        arch/%s/alpha_o3_exec.cc
43011308Santhony.gutierrez@amd.com	arch/%s/fast_cpu_exec.cc
43111308Santhony.gutierrez@amd.com        arch/%s/simple_cpu_exec.cc
43211308Santhony.gutierrez@amd.com        arch/%s/full_cpu_exec.cc''' %
43311308Santhony.gutierrez@amd.com	(env['TARGET_ISA'],
43411308Santhony.gutierrez@amd.com	env['TARGET_ISA'],
43511308Santhony.gutierrez@amd.com	env['TARGET_ISA'],
43611308Santhony.gutierrez@amd.com	env['TARGET_ISA'],
43711308Santhony.gutierrez@amd.com	env['TARGET_ISA'],
43811308Santhony.gutierrez@amd.com	env['TARGET_ISA'])),
43911308Santhony.gutierrez@amd.com	Split('''
44011308Santhony.gutierrez@amd.com	arch/%s/isa/main.isa
44111308Santhony.gutierrez@amd.com	arch/isa_parser.py''' %
44211308Santhony.gutierrez@amd.com	env['TARGET_ISA']),
44311308Santhony.gutierrez@amd.com	'$SRCDIR/arch/isa_parser.py $SOURCE $TARGET.dir arch/%s' % env['TARGET_ISA'])
44411308Santhony.gutierrez@amd.com
4454382Sbinkertn@umich.edu
4464382Sbinkertn@umich.edu# libelf build is described in its own SConscript file.
4474762Snate@binkert.org# SConscript-local is the per-config build, which just copies some
4484762Snate@binkert.org# header files into a place where they can be found.
4494762Snate@binkert.orgSConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
4506654Snate@binkert.orgSConscript('python/SConscript', exports = ['env'], duplicate=0)
4516654Snate@binkert.org
4525517Snate@binkert.org# This function adds the specified sources to the given build
4535517Snate@binkert.org# environment, and returns a list of all the corresponding SCons
4545517Snate@binkert.org# Object nodes (including an extra one for date.cc).  We explicitly
4555517Snate@binkert.org# add the Object nodes so we can set up special dependencies for
4565517Snate@binkert.org# date.cc.
4575517Snate@binkert.orgdef make_objs(sources, env):
4585517Snate@binkert.org    objs = [env.Object(s) for s in sources]
4595517Snate@binkert.org    # make date.cc depend on all other objects so it always gets
4605517Snate@binkert.org    # recompiled whenever anything else does
4615517Snate@binkert.org    date_obj = env.Object('base/date.cc')
4625517Snate@binkert.org    env.Depends(date_obj, objs)
4635517Snate@binkert.org    objs.append(date_obj)
4645517Snate@binkert.org    return objs
4655517Snate@binkert.org
4665517Snate@binkert.org###################################################
4675517Snate@binkert.org#
4685517Snate@binkert.org# Define binaries.  Each different build type (debug, opt, etc.) gets
4696654Snate@binkert.org# a slightly different build environment.
4705517Snate@binkert.org#
4715517Snate@binkert.org###################################################
4725517Snate@binkert.org
4735517Snate@binkert.org# Include file paths are rooted in this directory.  SCons will
4745517Snate@binkert.org# automatically expand '.' to refer to both the source directory and
47511802Sandreas.sandberg@arm.com# the corresponding build directory to pick up generated include
4765517Snate@binkert.org# files.
4775517Snate@binkert.orgenv.Append(CPPPATH='.')
4786143Snate@binkert.org
4796654Snate@binkert.org# Debug binary
4805517Snate@binkert.orgdebugEnv = env.Copy(OBJSUFFIX='.do')
4815517Snate@binkert.orgdebugEnv.Label = 'debug'
4825517Snate@binkert.orgdebugEnv.Append(CCFLAGS=Split('-g -gstabs+ -O0'))
4835517Snate@binkert.orgdebugEnv.Append(CPPDEFINES='DEBUG')
4845517Snate@binkert.orgtlist = debugEnv.Program(target = 'm5.debug',
4855517Snate@binkert.org                         source = make_objs(sources, debugEnv))
4865517Snate@binkert.orgdebugEnv.M5Binary = tlist[0]
4875517Snate@binkert.org
4885517Snate@binkert.org# Optimized binary
4895517Snate@binkert.orgoptEnv = env.Copy()
4905517Snate@binkert.orgoptEnv.Label = 'opt'
4915517Snate@binkert.orgoptEnv.Append(CCFLAGS=Split('-g -O5'))
4925517Snate@binkert.orgtlist = optEnv.Program(target = 'm5.opt',
4935517Snate@binkert.org                       source = make_objs(sources, optEnv))
4946654Snate@binkert.orgoptEnv.M5Binary = tlist[0]
4956654Snate@binkert.org
4965517Snate@binkert.org# "Fast" binary
4975517Snate@binkert.orgfastEnv = env.Copy(OBJSUFFIX='.fo')
4986143Snate@binkert.orgfastEnv.Label = 'fast'
4996143Snate@binkert.orgfastEnv.Append(CCFLAGS=Split('-O5'))
5006143Snate@binkert.orgfastEnv.Append(CPPDEFINES='NDEBUG')
5016727Ssteve.reinhardt@amd.comfastEnv.Program(target = 'm5.fast.unstripped',
5025517Snate@binkert.org                source = make_objs(sources, fastEnv))
5036727Ssteve.reinhardt@amd.comtlist = fastEnv.Command(target = 'm5.fast',
5045517Snate@binkert.org                        source = 'm5.fast.unstripped',
5055517Snate@binkert.org                        action = 'strip $SOURCE -o $TARGET')
5065517Snate@binkert.orgfastEnv.M5Binary = tlist[0]
5076654Snate@binkert.org
5086654Snate@binkert.org# Profiled binary
5097673Snate@binkert.orgprofEnv = env.Copy(OBJSUFFIX='.po')
5106654Snate@binkert.orgprofEnv.Label = 'prof'
5116654Snate@binkert.orgprofEnv.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg')
5126654Snate@binkert.orgtlist = profEnv.Program(target = 'm5.prof',
5136654Snate@binkert.org                        source = make_objs(sources, profEnv))
5145517Snate@binkert.orgprofEnv.M5Binary = tlist[0]
5155517Snate@binkert.org
5165517Snate@binkert.orgenvList = [debugEnv, optEnv, fastEnv, profEnv]
5176143Snate@binkert.org
5185517Snate@binkert.orgReturn('envList')
5194762Snate@binkert.org