SConscript revision 2253
114184Sgabeblack@google.com# -*- mode:python -*-
214184Sgabeblack@google.com
314184Sgabeblack@google.com# Copyright (c) 2004-2005 The Regents of The University of Michigan
414184Sgabeblack@google.com# All rights reserved.
514184Sgabeblack@google.com#
614184Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without
714184Sgabeblack@google.com# modification, are permitted provided that the following conditions are
814184Sgabeblack@google.com# met: redistributions of source code must retain the above copyright
914184Sgabeblack@google.com# notice, this list of conditions and the following disclaimer;
1014184Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright
1114184Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the
1214184Sgabeblack@google.com# documentation and/or other materials provided with the distribution;
1314184Sgabeblack@google.com# neither the name of the copyright holders nor the names of its
1414184Sgabeblack@google.com# contributors may be used to endorse or promote products derived from
1514184Sgabeblack@google.com# this software without specific prior written permission.
1614184Sgabeblack@google.com#
1714184Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1814184Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1914184Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2014184Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2114184Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2214184Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2314184Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2414184Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2514184Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2614184Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2714184Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2814184Sgabeblack@google.com
2914184Sgabeblack@google.comimport os
3014184Sgabeblack@google.comimport sys
3114184Sgabeblack@google.comfrom os.path import isdir
3214184Sgabeblack@google.com
3314184Sgabeblack@google.com# This file defines how to build a particular configuration of M5
3414184Sgabeblack@google.com# based on variable settings in the 'env' build environment.
3514184Sgabeblack@google.com
3614184Sgabeblack@google.com# Import build environment variable from SConstruct.
3714184Sgabeblack@google.comImport('env')
3814184Sgabeblack@google.com
3914184Sgabeblack@google.com###################################################
4014184Sgabeblack@google.com#
4114184Sgabeblack@google.com# Define needed sources.
4214184Sgabeblack@google.com#
4314184Sgabeblack@google.com###################################################
4414184Sgabeblack@google.com
4514184Sgabeblack@google.com# Base sources used by all configurations.
4614184Sgabeblack@google.com
4714184Sgabeblack@google.combase_sources = Split('''
4814184Sgabeblack@google.com	base/circlebuf.cc
4914184Sgabeblack@google.com	base/copyright.cc
5014184Sgabeblack@google.com	base/cprintf.cc
5114184Sgabeblack@google.com        base/embedfile.cc
5214184Sgabeblack@google.com	base/fast_alloc.cc
5314184Sgabeblack@google.com	base/fifo_buffer.cc
5414184Sgabeblack@google.com	base/hostinfo.cc
5514184Sgabeblack@google.com	base/hybrid_pred.cc
5614184Sgabeblack@google.com	base/inifile.cc
5714184Sgabeblack@google.com	base/intmath.cc
5814184Sgabeblack@google.com	base/match.cc
5914184Sgabeblack@google.com	base/misc.cc
6014184Sgabeblack@google.com	base/output.cc
6114184Sgabeblack@google.com	base/pollevent.cc
6214184Sgabeblack@google.com	base/range.cc
6314184Sgabeblack@google.com	base/random.cc
6414184Sgabeblack@google.com	base/sat_counter.cc
6514184Sgabeblack@google.com	base/socket.cc
6614184Sgabeblack@google.com	base/statistics.cc
6714184Sgabeblack@google.com	base/str.cc
6814184Sgabeblack@google.com	base/time.cc
6914184Sgabeblack@google.com	base/trace.cc
7014184Sgabeblack@google.com	base/traceflags.cc
7114184Sgabeblack@google.com	base/userinfo.cc
7214184Sgabeblack@google.com	base/compression/lzss_compression.cc
7314184Sgabeblack@google.com	base/loader/aout_object.cc
7414184Sgabeblack@google.com	base/loader/ecoff_object.cc
7514184Sgabeblack@google.com	base/loader/elf_object.cc
7614184Sgabeblack@google.com	base/loader/object_file.cc
7714184Sgabeblack@google.com	base/loader/symtab.cc
7814184Sgabeblack@google.com	base/stats/events.cc
7914184Sgabeblack@google.com	base/stats/statdb.cc
8014184Sgabeblack@google.com	base/stats/visit.cc
8114184Sgabeblack@google.com	base/stats/text.cc
8214184Sgabeblack@google.com
8314184Sgabeblack@google.com	cpu/base.cc
8414184Sgabeblack@google.com        cpu/base_dyn_inst.cc
8514184Sgabeblack@google.com	cpu/cpu_exec_context.cc
8614184Sgabeblack@google.com	cpu/exetrace.cc
8714184Sgabeblack@google.com	cpu/pc_event.cc
8814184Sgabeblack@google.com	cpu/static_inst.cc
8914184Sgabeblack@google.com        cpu/sampler/sampler.cc
9014184Sgabeblack@google.com        cpu/trace/reader/mem_trace_reader.cc
9114184Sgabeblack@google.com        cpu/trace/reader/ibm_reader.cc
9214184Sgabeblack@google.com        cpu/trace/reader/itx_reader.cc
9314184Sgabeblack@google.com        cpu/trace/reader/m5_reader.cc
9414184Sgabeblack@google.com        cpu/trace/opt_cpu.cc
9514184Sgabeblack@google.com        cpu/trace/trace_cpu.cc
9614184Sgabeblack@google.com
9714184Sgabeblack@google.com	encumbered/mem/functional/main.cc
9814184Sgabeblack@google.com
9914184Sgabeblack@google.com	mem/base_hier.cc
10014184Sgabeblack@google.com	mem/base_mem.cc
10114184Sgabeblack@google.com	mem/hier_params.cc
10214184Sgabeblack@google.com	mem/mem_cmd.cc
10314184Sgabeblack@google.com	mem/mem_debug.cc
10414184Sgabeblack@google.com	mem/mem_req.cc
10514184Sgabeblack@google.com	mem/memory_interface.cc
10614184Sgabeblack@google.com	mem/bus/base_interface.cc
10714184Sgabeblack@google.com	mem/bus/bus.cc
10814184Sgabeblack@google.com	mem/bus/bus_bridge.cc
10914184Sgabeblack@google.com	mem/bus/bus_bridge_master.cc
11014184Sgabeblack@google.com	mem/bus/bus_bridge_slave.cc
11114184Sgabeblack@google.com	mem/bus/bus_interface.cc
11214184Sgabeblack@google.com	mem/bus/dma_bus_interface.cc
11314184Sgabeblack@google.com	mem/bus/dma_interface.cc
11414184Sgabeblack@google.com	mem/bus/master_interface.cc
11514184Sgabeblack@google.com	mem/bus/slave_interface.cc
11614184Sgabeblack@google.com	mem/cache/base_cache.cc
11714184Sgabeblack@google.com	mem/cache/cache.cc
11814184Sgabeblack@google.com	mem/cache/cache_builder.cc
11914184Sgabeblack@google.com	mem/cache/coherence/coherence_protocol.cc
12014184Sgabeblack@google.com	mem/cache/coherence/uni_coherence.cc
12114184Sgabeblack@google.com	mem/cache/miss/blocking_buffer.cc
12214184Sgabeblack@google.com	mem/cache/miss/miss_queue.cc
12314184Sgabeblack@google.com	mem/cache/miss/mshr.cc
12414184Sgabeblack@google.com	mem/cache/miss/mshr_queue.cc
12514184Sgabeblack@google.com        mem/cache/prefetch/base_prefetcher.cc
12614184Sgabeblack@google.com        mem/cache/prefetch/prefetcher.cc
12714184Sgabeblack@google.com        mem/cache/prefetch/tagged_prefetcher.cc
12814184Sgabeblack@google.com	mem/cache/tags/base_tags.cc
12914184Sgabeblack@google.com	mem/cache/tags/cache_tags.cc	
13014184Sgabeblack@google.com	mem/cache/tags/fa_lru.cc
13114184Sgabeblack@google.com	mem/cache/tags/iic.cc
13214184Sgabeblack@google.com	mem/cache/tags/lru.cc
13314184Sgabeblack@google.com	mem/cache/tags/repl/gen.cc
13414184Sgabeblack@google.com	mem/cache/tags/repl/repl.cc
13514184Sgabeblack@google.com	mem/cache/tags/split.cc
13614184Sgabeblack@google.com	mem/cache/tags/split_lru.cc
13714184Sgabeblack@google.com	mem/cache/tags/split_lifo.cc
13814184Sgabeblack@google.com	mem/functional/functional.cc
13914184Sgabeblack@google.com	mem/timing/base_memory.cc
14014184Sgabeblack@google.com	mem/timing/memory_builder.cc
14114184Sgabeblack@google.com	mem/timing/simple_mem_bank.cc
14214184Sgabeblack@google.com        mem/trace/itx_writer.cc
14314184Sgabeblack@google.com	mem/trace/mem_trace_writer.cc
14414184Sgabeblack@google.com	mem/trace/m5_writer.cc
14514184Sgabeblack@google.com
14614184Sgabeblack@google.com        python/pyconfig.cc
14714184Sgabeblack@google.com        python/embedded_py.cc
14814184Sgabeblack@google.com
14914184Sgabeblack@google.com	sim/builder.cc
15014184Sgabeblack@google.com	sim/configfile.cc
15114184Sgabeblack@google.com	sim/debug.cc
15214184Sgabeblack@google.com	sim/eventq.cc
15314184Sgabeblack@google.com	sim/faults.cc
15414184Sgabeblack@google.com	sim/main.cc
15514184Sgabeblack@google.com	sim/param.cc
15614184Sgabeblack@google.com	sim/profile.cc
15714184Sgabeblack@google.com	sim/root.cc
15814184Sgabeblack@google.com	sim/serialize.cc
15914184Sgabeblack@google.com	sim/sim_events.cc
16014184Sgabeblack@google.com	sim/sim_exit.cc
16114184Sgabeblack@google.com	sim/sim_object.cc
16214184Sgabeblack@google.com	sim/startup.cc
16314184Sgabeblack@google.com	sim/stat_context.cc
16414184Sgabeblack@google.com	sim/stat_control.cc
16514184Sgabeblack@google.com	sim/trace_context.cc
16614184Sgabeblack@google.com        ''')
16714184Sgabeblack@google.com
16814184Sgabeblack@google.com# Old FullCPU sources
16914184Sgabeblack@google.comfull_cpu_sources = Split('''
17014184Sgabeblack@google.com	encumbered/cpu/full/bpred.cc
17114184Sgabeblack@google.com	encumbered/cpu/full/commit.cc
17214184Sgabeblack@google.com	encumbered/cpu/full/cpu.cc
17314184Sgabeblack@google.com	encumbered/cpu/full/create_vector.cc
17414184Sgabeblack@google.com	encumbered/cpu/full/cv_spec_state.cc
17514184Sgabeblack@google.com	encumbered/cpu/full/dd_queue.cc
17614184Sgabeblack@google.com	encumbered/cpu/full/dep_link.cc
17714184Sgabeblack@google.com	encumbered/cpu/full/dispatch.cc
17814184Sgabeblack@google.com	encumbered/cpu/full/dyn_inst.cc
17914184Sgabeblack@google.com	encumbered/cpu/full/execute.cc
18014184Sgabeblack@google.com	encumbered/cpu/full/fetch.cc
18114184Sgabeblack@google.com	encumbered/cpu/full/floss_reasons.cc
18214184Sgabeblack@google.com	encumbered/cpu/full/fu_pool.cc
18314184Sgabeblack@google.com	encumbered/cpu/full/inst_fifo.cc
18414184Sgabeblack@google.com	encumbered/cpu/full/instpipe.cc
18514184Sgabeblack@google.com	encumbered/cpu/full/issue.cc
18614184Sgabeblack@google.com	encumbered/cpu/full/ls_queue.cc
18714184Sgabeblack@google.com	encumbered/cpu/full/machine_queue.cc
18814184Sgabeblack@google.com        encumbered/cpu/full/pipetrace.cc
18914184Sgabeblack@google.com        encumbered/cpu/full/readyq.cc
19014184Sgabeblack@google.com        encumbered/cpu/full/reg_info.cc
19114184Sgabeblack@google.com        encumbered/cpu/full/rob_station.cc
19214184Sgabeblack@google.com        encumbered/cpu/full/spec_memory.cc
19314184Sgabeblack@google.com        encumbered/cpu/full/spec_state.cc
19414184Sgabeblack@google.com        encumbered/cpu/full/storebuffer.cc
19514184Sgabeblack@google.com        encumbered/cpu/full/writeback.cc
19614184Sgabeblack@google.com        encumbered/cpu/full/iq/iq_station.cc
19714184Sgabeblack@google.com        encumbered/cpu/full/iq/iqueue.cc
19814184Sgabeblack@google.com        encumbered/cpu/full/iq/segmented/chain_info.cc
19914184Sgabeblack@google.com        encumbered/cpu/full/iq/segmented/chain_wire.cc
20014184Sgabeblack@google.com        encumbered/cpu/full/iq/segmented/iq_seg.cc
20114184Sgabeblack@google.com        encumbered/cpu/full/iq/segmented/iq_segmented.cc
20214184Sgabeblack@google.com        encumbered/cpu/full/iq/segmented/seg_chain.cc
20314184Sgabeblack@google.com        encumbered/cpu/full/iq/seznec/iq_seznec.cc
20414184Sgabeblack@google.com        encumbered/cpu/full/iq/standard/iq_standard.cc
20514184Sgabeblack@google.com        ''')
20614184Sgabeblack@google.com
20714184Sgabeblack@google.com# MySql sources
20814184Sgabeblack@google.commysql_sources = Split('''
20914184Sgabeblack@google.com	base/mysql.cc
21014184Sgabeblack@google.com	base/stats/mysql.cc
21114184Sgabeblack@google.com        ''')
21214184Sgabeblack@google.com
21314184Sgabeblack@google.com# Full-system sources
21414184Sgabeblack@google.comfull_system_sources = Split('''
21514184Sgabeblack@google.com	base/crc.cc
21614184Sgabeblack@google.com	base/inet.cc
21714184Sgabeblack@google.com	base/remote_gdb.cc
21814184Sgabeblack@google.com
21914184Sgabeblack@google.com	cpu/intr_control.cc
22014184Sgabeblack@google.com        cpu/profile.cc
22114184Sgabeblack@google.com
22214184Sgabeblack@google.com	dev/alpha_console.cc
22314184Sgabeblack@google.com	dev/baddev.cc
22414184Sgabeblack@google.com        dev/simconsole.cc
22514184Sgabeblack@google.com	dev/disk_image.cc
22614184Sgabeblack@google.com	dev/etherbus.cc
22714184Sgabeblack@google.com	dev/etherdump.cc
22814184Sgabeblack@google.com	dev/etherint.cc
22914184Sgabeblack@google.com	dev/etherlink.cc
23014184Sgabeblack@google.com	dev/etherpkt.cc
23114184Sgabeblack@google.com	dev/ethertap.cc
23214184Sgabeblack@google.com	dev/ide_ctrl.cc
23314184Sgabeblack@google.com	dev/ide_disk.cc
23414184Sgabeblack@google.com	dev/io_device.cc
23514184Sgabeblack@google.com	dev/ns_gige.cc
23614184Sgabeblack@google.com	dev/pciconfigall.cc
23714184Sgabeblack@google.com	dev/pcidev.cc
23814184Sgabeblack@google.com	dev/pcifake.cc
23914184Sgabeblack@google.com	dev/pktfifo.cc
24014184Sgabeblack@google.com	dev/platform.cc
24114184Sgabeblack@google.com	dev/sinic.cc
24214184Sgabeblack@google.com	dev/simple_disk.cc
24314184Sgabeblack@google.com	dev/tsunami.cc
24414184Sgabeblack@google.com	dev/tsunami_cchip.cc
24514184Sgabeblack@google.com	dev/isa_fake.cc
24614184Sgabeblack@google.com	dev/tsunami_io.cc
24714184Sgabeblack@google.com	dev/tsunami_pchip.cc
24814184Sgabeblack@google.com	dev/uart.cc
24914184Sgabeblack@google.com	dev/uart8250.cc
25014184Sgabeblack@google.com
25114184Sgabeblack@google.com	kern/kernel_binning.cc
25214184Sgabeblack@google.com	kern/kernel_stats.cc
25314184Sgabeblack@google.com	kern/system_events.cc
25414184Sgabeblack@google.com	kern/linux/events.cc
25514184Sgabeblack@google.com	kern/linux/linux_syscalls.cc
25614184Sgabeblack@google.com	kern/linux/printk.cc
25714184Sgabeblack@google.com	kern/tru64/dump_mbuf.cc
25814184Sgabeblack@google.com	kern/tru64/printf.cc
25914184Sgabeblack@google.com	kern/tru64/tru64_events.cc
26014184Sgabeblack@google.com	kern/tru64/tru64_syscalls.cc
26114184Sgabeblack@google.com
26214184Sgabeblack@google.com	mem/functional/memory_control.cc
26314184Sgabeblack@google.com	mem/functional/physical.cc
26414184Sgabeblack@google.com
26514184Sgabeblack@google.com	sim/system.cc
26614184Sgabeblack@google.com	sim/pseudo_inst.cc
26714184Sgabeblack@google.com        ''')
26814184Sgabeblack@google.com
26914184Sgabeblack@google.com# turbolaser encumbered sources
27014184Sgabeblack@google.comturbolaser_sources = Split('''
27114184Sgabeblack@google.com	encumbered/dev/dma.cc
27214184Sgabeblack@google.com	encumbered/dev/etherdev.cc
27314184Sgabeblack@google.com	encumbered/dev/scsi.cc
27414184Sgabeblack@google.com	encumbered/dev/scsi_ctrl.cc
27514184Sgabeblack@google.com	encumbered/dev/scsi_disk.cc
27614184Sgabeblack@google.com	encumbered/dev/scsi_none.cc
27714184Sgabeblack@google.com	encumbered/dev/tlaser_clock.cc
27814184Sgabeblack@google.com	encumbered/dev/tlaser_ipi.cc
27914184Sgabeblack@google.com	encumbered/dev/tlaser_mbox.cc
28014184Sgabeblack@google.com	encumbered/dev/tlaser_mc146818.cc
28114184Sgabeblack@google.com	encumbered/dev/tlaser_node.cc
28214184Sgabeblack@google.com	encumbered/dev/tlaser_pcia.cc
28314184Sgabeblack@google.com	encumbered/dev/tlaser_pcidev.cc
28414184Sgabeblack@google.com	encumbered/dev/tlaser_serial.cc
28514184Sgabeblack@google.com	encumbered/dev/turbolaser.cc
28614184Sgabeblack@google.com	encumbered/dev/uart8530.cc
28714184Sgabeblack@google.com        ''')
28814184Sgabeblack@google.com
28914184Sgabeblack@google.com# Syscall emulation (non-full-system) sources
29014184Sgabeblack@google.comsyscall_emulation_sources = Split('''
29114184Sgabeblack@google.com	cpu/memtest/memtest.cc
29214184Sgabeblack@google.com	encumbered/eio/eio.cc
29314184Sgabeblack@google.com	encumbered/eio/exolex.cc
29414184Sgabeblack@google.com	encumbered/eio/libexo.cc
29514184Sgabeblack@google.com        kern/linux/linux.cc
29614184Sgabeblack@google.com        kern/tru64/tru64.cc
29714184Sgabeblack@google.com	sim/process.cc
29814184Sgabeblack@google.com	sim/syscall_emul.cc
29914184Sgabeblack@google.com        ''')
30014184Sgabeblack@google.com
30114184Sgabeblack@google.com# Add a flag defining what THE_ISA should be for all compilation
30214184Sgabeblack@google.comenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
30314184Sgabeblack@google.com
30414184Sgabeblack@google.comarch_sources = SConscript('arch/SConscript',
30514184Sgabeblack@google.com                          exports = 'env', duplicate = False)
30614184Sgabeblack@google.com
30714184Sgabeblack@google.comcpu_sources = SConscript('cpu/SConscript',
30814184Sgabeblack@google.com                         exports = 'env', duplicate = False)
30914184Sgabeblack@google.com
31014184Sgabeblack@google.com# This is outside of cpu/SConscript since the source directory isn't
31114184Sgabeblack@google.com# underneath 'cpu'.
31214184Sgabeblack@google.comif 'FullCPU' in env['CPU_MODELS']:
31314184Sgabeblack@google.com    cpu_sources += full_cpu_sources
31414184Sgabeblack@google.com
31514184Sgabeblack@google.com# Set up complete list of sources based on configuration.
31614184Sgabeblack@google.comsources = base_sources + arch_sources + cpu_sources
31714184Sgabeblack@google.com
31814184Sgabeblack@google.comif env['FULL_SYSTEM']:
31914184Sgabeblack@google.com    sources += full_system_sources
32014184Sgabeblack@google.com    if env['ALPHA_TLASER']:
32114184Sgabeblack@google.com        sources += turbolaser_sources
32214184Sgabeblack@google.comelse:
32314184Sgabeblack@google.com    sources += syscall_emulation_sources
32414184Sgabeblack@google.com
32514184Sgabeblack@google.comif env['USE_MYSQL']:
32614184Sgabeblack@google.com    sources += mysql_sources
32714184Sgabeblack@google.com
32814184Sgabeblack@google.comfor opt in env.ExportOptions:
32914184Sgabeblack@google.com    env.ConfigFile(opt)
33014184Sgabeblack@google.com
33114184Sgabeblack@google.com###################################################
33214184Sgabeblack@google.com#
33314184Sgabeblack@google.com# Special build rules.
33414184Sgabeblack@google.com#
33514184Sgabeblack@google.com###################################################
33614184Sgabeblack@google.com
33714184Sgabeblack@google.com# base/traceflags.{cc,hh} are generated from base/traceflags.py.
33814184Sgabeblack@google.com# $TARGET.base will expand to "<build-dir>/base/traceflags".
33914184Sgabeblack@google.comenv.Command(Split('base/traceflags.hh base/traceflags.cc'),
34014184Sgabeblack@google.com            'base/traceflags.py',
34114184Sgabeblack@google.com            'python $SOURCE $TARGET.base')
34214184Sgabeblack@google.com
34314184Sgabeblack@google.com# libelf build is described in its own SConscript file.
34414184Sgabeblack@google.com# SConscript-local is the per-config build, which just copies some
34514184Sgabeblack@google.com# header files into a place where they can be found.
34614184Sgabeblack@google.comSConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
34714184Sgabeblack@google.comSConscript('python/SConscript', exports = ['env'], duplicate=0)
34814184Sgabeblack@google.com
34914184Sgabeblack@google.com# This function adds the specified sources to the given build
35014184Sgabeblack@google.com# environment, and returns a list of all the corresponding SCons
35114184Sgabeblack@google.com# Object nodes (including an extra one for date.cc).  We explicitly
35214184Sgabeblack@google.com# add the Object nodes so we can set up special dependencies for
35314184Sgabeblack@google.com# date.cc.
35414184Sgabeblack@google.comdef make_objs(sources, env):
35514184Sgabeblack@google.com    objs = [env.Object(s) for s in sources]
35614184Sgabeblack@google.com    # make date.cc depend on all other objects so it always gets
35714184Sgabeblack@google.com    # recompiled whenever anything else does
35814184Sgabeblack@google.com    date_obj = env.Object('base/date.cc')
35914184Sgabeblack@google.com    env.Depends(date_obj, objs)
36014184Sgabeblack@google.com    objs.append(date_obj)
36114184Sgabeblack@google.com    return objs
36214184Sgabeblack@google.com
36314184Sgabeblack@google.com###################################################
36414184Sgabeblack@google.com#
36514184Sgabeblack@google.com# Define binaries.  Each different build type (debug, opt, etc.) gets
36614184Sgabeblack@google.com# a slightly different build environment.
36714184Sgabeblack@google.com#
36814184Sgabeblack@google.com###################################################
36914184Sgabeblack@google.com
37014184Sgabeblack@google.com# Include file paths are rooted in this directory.  SCons will
37114184Sgabeblack@google.com# automatically expand '.' to refer to both the source directory and
37214184Sgabeblack@google.com# the corresponding build directory to pick up generated include
37314184Sgabeblack@google.com# files.
37414184Sgabeblack@google.comenv.Append(CPPPATH='.')
37514184Sgabeblack@google.comenv.Append(CPPPATH='./libelf')
37614184Sgabeblack@google.com
37714184Sgabeblack@google.com# Debug binary
37814184Sgabeblack@google.comdebugEnv = env.Copy(OBJSUFFIX='.do')
37914184Sgabeblack@google.comdebugEnv.Label = 'debug'
38014184Sgabeblack@google.comdebugEnv.Append(CCFLAGS=Split('-g -gstabs+ -O0'))
38114184Sgabeblack@google.comdebugEnv.Append(CPPDEFINES='DEBUG')
38214184Sgabeblack@google.comtlist = debugEnv.Program(target = 'm5.debug',
38314184Sgabeblack@google.com                         source = make_objs(sources, debugEnv))
38414184Sgabeblack@google.comdebugEnv.M5Binary = tlist[0]
38514184Sgabeblack@google.com
38614184Sgabeblack@google.com# Optimized binary
38714184Sgabeblack@google.comoptEnv = env.Copy()
38814184Sgabeblack@google.comoptEnv.Label = 'opt'
38914184Sgabeblack@google.comoptEnv.Append(CCFLAGS=Split('-g -O5'))
39014184Sgabeblack@google.comtlist = optEnv.Program(target = 'm5.opt',
39114184Sgabeblack@google.com                       source = make_objs(sources, optEnv))
39214184Sgabeblack@google.comoptEnv.M5Binary = tlist[0]
39314184Sgabeblack@google.com
39414184Sgabeblack@google.com# "Fast" binary
39514184Sgabeblack@google.comfastEnv = env.Copy(OBJSUFFIX='.fo')
39614184Sgabeblack@google.comfastEnv.Label = 'fast'
39714184Sgabeblack@google.comfastEnv.Append(CCFLAGS=Split('-O5'))
39814184Sgabeblack@google.comfastEnv.Append(CPPDEFINES='NDEBUG')
39914184Sgabeblack@google.comfastEnv.Program(target = 'm5.fast.unstripped',
40014184Sgabeblack@google.com                source = make_objs(sources, fastEnv))
40114184Sgabeblack@google.comtlist = fastEnv.Command(target = 'm5.fast',
40214184Sgabeblack@google.com                        source = 'm5.fast.unstripped',
40314184Sgabeblack@google.com                        action = 'strip $SOURCE -o $TARGET')
40414184Sgabeblack@google.comfastEnv.M5Binary = tlist[0]
40514184Sgabeblack@google.com
40614184Sgabeblack@google.com# Profiled binary
40714184Sgabeblack@google.comprofEnv = env.Copy(OBJSUFFIX='.po')
40814184Sgabeblack@google.comprofEnv.Label = 'prof'
40914184Sgabeblack@google.comprofEnv.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg')
41014184Sgabeblack@google.comtlist = profEnv.Program(target = 'm5.prof',
41114184Sgabeblack@google.com                        source = make_objs(sources, profEnv))
41214184Sgabeblack@google.comprofEnv.M5Binary = tlist[0]
41314184Sgabeblack@google.com
41414184Sgabeblack@google.comenvList = [debugEnv, optEnv, fastEnv, profEnv]
41514184Sgabeblack@google.com
41614184Sgabeblack@google.comReturn('envList')
41714184Sgabeblack@google.com