SConscript revision 2929
1955SN/A# -*- mode:python -*-
2955SN/A
313576Sciro.santilli@arm.com# Copyright (c) 2004-2005 The Regents of The University of Michigan
413576Sciro.santilli@arm.com# All rights reserved.
513576Sciro.santilli@arm.com#
613576Sciro.santilli@arm.com# Redistribution and use in source and binary forms, with or without
713576Sciro.santilli@arm.com# modification, are permitted provided that the following conditions are
813576Sciro.santilli@arm.com# met: redistributions of source code must retain the above copyright
913576Sciro.santilli@arm.com# notice, this list of conditions and the following disclaimer;
1013576Sciro.santilli@arm.com# redistributions in binary form must reproduce the above copyright
1113576Sciro.santilli@arm.com# notice, this list of conditions and the following disclaimer in the
1213576Sciro.santilli@arm.com# documentation and/or other materials provided with the distribution;
1313576Sciro.santilli@arm.com# neither the name of the copyright holders nor the names of its
141762SN/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.
28955SN/A#
29955SN/A# Authors: Steve Reinhardt
30955SN/A
31955SN/Aimport os
32955SN/Aimport sys
33955SN/Afrom os.path import isdir
34955SN/A
35955SN/A# This file defines how to build a particular configuration of M5
36955SN/A# based on variable settings in the 'env' build environment.
37955SN/A
38955SN/A# Import build environment variable from SConstruct.
392665Ssaidi@eecs.umich.eduImport('env')
404762Snate@binkert.org
41955SN/A###################################################
4212563Sgabeblack@google.com#
4312563Sgabeblack@google.com# Define needed sources.
445522Snate@binkert.org#
456143Snate@binkert.org###################################################
4612371Sgabeblack@google.com
474762Snate@binkert.org# Base sources used by all configurations.
485522Snate@binkert.org
49955SN/Abase_sources = Split('''
505522Snate@binkert.org	base/circlebuf.cc
5111974Sgabeblack@google.com	base/cprintf.cc
52955SN/A	base/fast_alloc.cc
535522Snate@binkert.org	base/fifo_buffer.cc
544202Sbinkertn@umich.edu	base/hostinfo.cc
555742Snate@binkert.org	base/hybrid_pred.cc
56955SN/A	base/inifile.cc
574381Sbinkertn@umich.edu	base/intmath.cc
584381Sbinkertn@umich.edu	base/match.cc
5912246Sgabeblack@google.com	base/misc.cc
6012246Sgabeblack@google.com	base/output.cc
618334Snate@binkert.org	base/pollevent.cc
62955SN/A	base/range.cc
63955SN/A	base/random.cc
644202Sbinkertn@umich.edu	base/sat_counter.cc
65955SN/A	base/socket.cc
664382Sbinkertn@umich.edu	base/statistics.cc
674382Sbinkertn@umich.edu	base/str.cc
684382Sbinkertn@umich.edu	base/time.cc
696654Snate@binkert.org	base/trace.cc
705517Snate@binkert.org	base/traceflags.cc
718614Sgblack@eecs.umich.edu	base/userinfo.cc
727674Snate@binkert.org	base/compression/lzss_compression.cc
736143Snate@binkert.org	base/loader/aout_object.cc
746143Snate@binkert.org	base/loader/ecoff_object.cc
756143Snate@binkert.org	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
7912371Sgabeblack@google.com	base/stats/statdb.cc
8012371Sgabeblack@google.com	base/stats/visit.cc
8112371Sgabeblack@google.com	base/stats/text.cc
8212371Sgabeblack@google.com
8312371Sgabeblack@google.com        cpu/activity.cc
8412371Sgabeblack@google.com	cpu/base.cc
8512371Sgabeblack@google.com	cpu/cpuevent.cc
8612371Sgabeblack@google.com	cpu/exetrace.cc
8712371Sgabeblack@google.com        cpu/func_unit.cc
8812371Sgabeblack@google.com        cpu/op_class.cc
8912371Sgabeblack@google.com	cpu/pc_event.cc
9012371Sgabeblack@google.com        cpu/quiesce_event.cc
9112371Sgabeblack@google.com	cpu/static_inst.cc
9212371Sgabeblack@google.com        cpu/simple_thread.cc
9312371Sgabeblack@google.com        cpu/thread_state.cc
9412371Sgabeblack@google.com
9512371Sgabeblack@google.com        mem/bridge.cc
9612371Sgabeblack@google.com        mem/bus.cc
9712371Sgabeblack@google.com        mem/mem_object.cc
9812371Sgabeblack@google.com        mem/packet.cc
9912371Sgabeblack@google.com        mem/physical.cc
10012371Sgabeblack@google.com        mem/port.cc
10112371Sgabeblack@google.com
10212371Sgabeblack@google.com        mem/cache/base_cache.cc
10312371Sgabeblack@google.com        mem/cache/cache.cc
10412371Sgabeblack@google.com        mem/cache/coherence/coherence_protocol.cc
10512371Sgabeblack@google.com        mem/cache/coherence/uni_coherence.cc
10612371Sgabeblack@google.com        mem/cache/miss/blocking_buffer.cc
10712371Sgabeblack@google.com        mem/cache/miss/miss_queue.cc
10812371Sgabeblack@google.com        mem/cache/miss/mshr.cc
10912371Sgabeblack@google.com        mem/cache/miss/mshr_queue.cc
11012371Sgabeblack@google.com        mem/cache/prefetch/base_prefetcher.cc
11112371Sgabeblack@google.com        mem/cache/prefetch/ghb_prefetcher.cc
11212371Sgabeblack@google.com        mem/cache/prefetch/prefetcher.cc
11312371Sgabeblack@google.com        mem/cache/prefetch/stride_prefetcher.cc
11412371Sgabeblack@google.com        mem/cache/prefetch/tagged_prefetcher.cc
11512371Sgabeblack@google.com        mem/cache/tags/base_tags.cc
11612371Sgabeblack@google.com        mem/cache/tags/cache_tags.cc
11712371Sgabeblack@google.com        mem/cache/tags/fa_lru.cc
11812371Sgabeblack@google.com        mem/cache/tags/iic.cc
11912371Sgabeblack@google.com        mem/cache/tags/lru.cc
12012371Sgabeblack@google.com        mem/cache/tags/repl/gen.cc
12112371Sgabeblack@google.com        mem/cache/tags/repl/repl.cc
12212371Sgabeblack@google.com        mem/cache/tags/split.cc
12312371Sgabeblack@google.com        mem/cache/tags/split_lifo.cc
12412371Sgabeblack@google.com        mem/cache/tags/split_lru.cc
12512371Sgabeblack@google.com
12612302Sgabeblack@google.com        mem/cache/cache_builder.cc
12712371Sgabeblack@google.com
12812302Sgabeblack@google.com	sim/builder.cc
12912371Sgabeblack@google.com	sim/debug.cc
13012302Sgabeblack@google.com	sim/eventq.cc
13112302Sgabeblack@google.com	sim/faults.cc
13212371Sgabeblack@google.com	sim/main.cc
13312371Sgabeblack@google.com        python/swig/cc_main_wrap.cc
13412371Sgabeblack@google.com	sim/param.cc
13512371Sgabeblack@google.com	sim/root.cc
13612302Sgabeblack@google.com	sim/serialize.cc
13712371Sgabeblack@google.com	sim/sim_events.cc
13812371Sgabeblack@google.com	sim/sim_object.cc
13912371Sgabeblack@google.com	sim/startup.cc
14012371Sgabeblack@google.com	sim/stat_context.cc
14111983Sgabeblack@google.com	sim/stat_control.cc
1426143Snate@binkert.org	sim/system.cc
1438233Snate@binkert.org	sim/trace_context.cc
14412302Sgabeblack@google.com        ''')
1456143Snate@binkert.org
1466143Snate@binkert.org# Old FullCPU sources
14712302Sgabeblack@google.comfull_cpu_sources = Split('''
1484762Snate@binkert.org	encumbered/cpu/full/bpred.cc
1496143Snate@binkert.org	encumbered/cpu/full/commit.cc
1508233Snate@binkert.org	encumbered/cpu/full/cpu.cc
1518233Snate@binkert.org	encumbered/cpu/full/create_vector.cc
15212302Sgabeblack@google.com	encumbered/cpu/full/cv_spec_state.cc
15312302Sgabeblack@google.com	encumbered/cpu/full/dd_queue.cc
1546143Snate@binkert.org	encumbered/cpu/full/dep_link.cc
15512362Sgabeblack@google.com	encumbered/cpu/full/dispatch.cc
15612362Sgabeblack@google.com	encumbered/cpu/full/dyn_inst.cc
15712362Sgabeblack@google.com	encumbered/cpu/full/execute.cc
15812362Sgabeblack@google.com	encumbered/cpu/full/fetch.cc
15912302Sgabeblack@google.com	encumbered/cpu/full/floss_reasons.cc
16012302Sgabeblack@google.com	encumbered/cpu/full/fu_pool.cc
16112302Sgabeblack@google.com	encumbered/cpu/full/inst_fifo.cc
16212302Sgabeblack@google.com	encumbered/cpu/full/instpipe.cc
16312302Sgabeblack@google.com	encumbered/cpu/full/issue.cc
16412363Sgabeblack@google.com	encumbered/cpu/full/ls_queue.cc
16512363Sgabeblack@google.com	encumbered/cpu/full/machine_queue.cc
16612363Sgabeblack@google.com        encumbered/cpu/full/pipetrace.cc
16712363Sgabeblack@google.com        encumbered/cpu/full/readyq.cc
16812302Sgabeblack@google.com        encumbered/cpu/full/reg_info.cc
16912363Sgabeblack@google.com        encumbered/cpu/full/rob_station.cc
17012363Sgabeblack@google.com        encumbered/cpu/full/spec_memory.cc
17112363Sgabeblack@google.com        encumbered/cpu/full/spec_state.cc
17212363Sgabeblack@google.com        encumbered/cpu/full/storebuffer.cc
17312363Sgabeblack@google.com        encumbered/cpu/full/writeback.cc
1748233Snate@binkert.org        encumbered/cpu/full/iq/iq_station.cc
1756143Snate@binkert.org        encumbered/cpu/full/iq/iqueue.cc
1766143Snate@binkert.org        encumbered/cpu/full/iq/segmented/chain_info.cc
1776143Snate@binkert.org        encumbered/cpu/full/iq/segmented/chain_wire.cc
1786143Snate@binkert.org        encumbered/cpu/full/iq/segmented/iq_seg.cc
1796143Snate@binkert.org        encumbered/cpu/full/iq/segmented/iq_segmented.cc
1806143Snate@binkert.org        encumbered/cpu/full/iq/segmented/seg_chain.cc
1816143Snate@binkert.org        encumbered/cpu/full/iq/seznec/iq_seznec.cc
1826143Snate@binkert.org        encumbered/cpu/full/iq/standard/iq_standard.cc
1836143Snate@binkert.org        ''')
1847065Snate@binkert.org
1856143Snate@binkert.orgtrace_reader_sources = Split('''
18612362Sgabeblack@google.com        cpu/trace/reader/mem_trace_reader.cc
18712362Sgabeblack@google.com        cpu/trace/reader/ibm_reader.cc
18812362Sgabeblack@google.com        cpu/trace/reader/itx_reader.cc
18912362Sgabeblack@google.com        cpu/trace/reader/m5_reader.cc
19012362Sgabeblack@google.com        cpu/trace/opt_cpu.cc
19112362Sgabeblack@google.com        cpu/trace/trace_cpu.cc
19212362Sgabeblack@google.com        ''')
19312362Sgabeblack@google.com
19412362Sgabeblack@google.com
19512362Sgabeblack@google.com
19612362Sgabeblack@google.com# MySql sources
19712362Sgabeblack@google.commysql_sources = Split('''
1988233Snate@binkert.org	base/mysql.cc
1998233Snate@binkert.org	base/stats/mysql.cc
2008233Snate@binkert.org        ''')
2018233Snate@binkert.org
2028233Snate@binkert.org# Full-system sources
2038233Snate@binkert.orgfull_system_sources = Split('''
2048233Snate@binkert.org	base/crc.cc
2058233Snate@binkert.org	base/inet.cc
2068233Snate@binkert.org	base/remote_gdb.cc
2078233Snate@binkert.org
2088233Snate@binkert.org	cpu/intr_control.cc
2098233Snate@binkert.org        cpu/profile.cc
2108233Snate@binkert.org
2118233Snate@binkert.org	dev/alpha_console.cc
2128233Snate@binkert.org	dev/baddev.cc
2138233Snate@binkert.org	dev/disk_image.cc
2148233Snate@binkert.org	dev/etherbus.cc
2158233Snate@binkert.org	dev/etherdump.cc
2168233Snate@binkert.org	dev/etherint.cc
2178233Snate@binkert.org	dev/etherlink.cc
2188233Snate@binkert.org	dev/etherpkt.cc
2196143Snate@binkert.org	dev/ethertap.cc	
2206143Snate@binkert.org        dev/ide_ctrl.cc
2216143Snate@binkert.org	dev/ide_disk.cc
2226143Snate@binkert.org	dev/io_device.cc
2236143Snate@binkert.org	dev/isa_fake.cc
2246143Snate@binkert.org	dev/ns_gige.cc
2259982Satgutier@umich.edu	dev/pciconfigall.cc
22613576Sciro.santilli@arm.com	dev/pcidev.cc
22713576Sciro.santilli@arm.com	dev/pcifake.cc
22813576Sciro.santilli@arm.com	dev/pktfifo.cc
22913576Sciro.santilli@arm.com	dev/platform.cc
23013576Sciro.santilli@arm.com        dev/simconsole.cc
23113576Sciro.santilli@arm.com	dev/simple_disk.cc
23213576Sciro.santilli@arm.com	dev/sinic.cc
23313576Sciro.santilli@arm.com	dev/tsunami.cc
23413576Sciro.santilli@arm.com	dev/tsunami_cchip.cc
23513576Sciro.santilli@arm.com	dev/tsunami_io.cc
23613576Sciro.santilli@arm.com	dev/tsunami_fake.cc
23713576Sciro.santilli@arm.com	dev/tsunami_pchip.cc
23813576Sciro.santilli@arm.com
23913576Sciro.santilli@arm.com	dev/uart.cc
24013576Sciro.santilli@arm.com	dev/uart8250.cc
24113576Sciro.santilli@arm.com
24213576Sciro.santilli@arm.com	kern/kernel_stats.cc
24313576Sciro.santilli@arm.com	kern/system_events.cc
24413576Sciro.santilli@arm.com	kern/linux/events.cc
24513576Sciro.santilli@arm.com	kern/linux/linux_syscalls.cc
24613576Sciro.santilli@arm.com	kern/linux/printk.cc
24713576Sciro.santilli@arm.com
24813576Sciro.santilli@arm.com        mem/vport.cc
24913576Sciro.santilli@arm.com
25013576Sciro.santilli@arm.com	sim/pseudo_inst.cc
25113576Sciro.santilli@arm.com        ''')
25213576Sciro.santilli@arm.com
25313576Sciro.santilli@arm.com
25413576Sciro.santilli@arm.comif env['TARGET_ISA'] == 'alpha':
25513576Sciro.santilli@arm.com    full_system_sources += Split('''
25613576Sciro.santilli@arm.com	kern/tru64/dump_mbuf.cc
25713576Sciro.santilli@arm.com	kern/tru64/printf.cc
25813630Sciro.santilli@arm.com	kern/tru64/tru64_events.cc
25913630Sciro.santilli@arm.com	kern/tru64/tru64_syscalls.cc
26013576Sciro.santilli@arm.com        ''')
26113576Sciro.santilli@arm.com
26213576Sciro.santilli@arm.com# turbolaser encumbered sources
26313576Sciro.santilli@arm.comturbolaser_sources = Split('''
26413576Sciro.santilli@arm.com	encumbered/dev/dma.cc
26513576Sciro.santilli@arm.com	encumbered/dev/etherdev.cc
26613576Sciro.santilli@arm.com	encumbered/dev/scsi.cc
26713576Sciro.santilli@arm.com	encumbered/dev/scsi_ctrl.cc
26813576Sciro.santilli@arm.com	encumbered/dev/scsi_disk.cc
26913576Sciro.santilli@arm.com	encumbered/dev/scsi_none.cc
27013576Sciro.santilli@arm.com	encumbered/dev/tlaser_clock.cc
27113576Sciro.santilli@arm.com	encumbered/dev/tlaser_ipi.cc
27213576Sciro.santilli@arm.com	encumbered/dev/tlaser_mbox.cc
27313576Sciro.santilli@arm.com	encumbered/dev/tlaser_mc146818.cc
27413576Sciro.santilli@arm.com	encumbered/dev/tlaser_node.cc
27513576Sciro.santilli@arm.com	encumbered/dev/tlaser_pcia.cc
27613576Sciro.santilli@arm.com	encumbered/dev/tlaser_pcidev.cc
27713576Sciro.santilli@arm.com	encumbered/dev/tlaser_serial.cc
27813576Sciro.santilli@arm.com	encumbered/dev/turbolaser.cc
27913576Sciro.santilli@arm.com	encumbered/dev/uart8530.cc
28013576Sciro.santilli@arm.com        ''')
28113576Sciro.santilli@arm.com
28213576Sciro.santilli@arm.com# Syscall emulation (non-full-system) sources
28313576Sciro.santilli@arm.comsyscall_emulation_sources = Split('''
28413576Sciro.santilli@arm.com        mem/translating_port.cc
28513576Sciro.santilli@arm.com        mem/page_table.cc
28613576Sciro.santilli@arm.com	sim/process.cc
28713576Sciro.santilli@arm.com	sim/syscall_emul.cc
28813576Sciro.santilli@arm.com        ''')
28913576Sciro.santilli@arm.com
29013576Sciro.santilli@arm.com#if env['TARGET_ISA'] == 'alpha':
29113576Sciro.santilli@arm.com#    syscall_emulation_sources += Split('''
29213576Sciro.santilli@arm.com#        kern/tru64/tru64.cc
29313576Sciro.santilli@arm.com#        ''')
29413576Sciro.santilli@arm.com
29513576Sciro.santilli@arm.comalpha_eio_sources = Split('''
29613576Sciro.santilli@arm.com	encumbered/eio/exolex.cc
29713577Sciro.santilli@arm.com	encumbered/eio/libexo.cc
29813577Sciro.santilli@arm.com	encumbered/eio/eio.cc
29913577Sciro.santilli@arm.com        ''')
3006143Snate@binkert.org
30112302Sgabeblack@google.comif env['TARGET_ISA'] == 'alpha':
30212302Sgabeblack@google.com    syscall_emulation_sources += alpha_eio_sources
30312302Sgabeblack@google.com    
30412302Sgabeblack@google.commemtest_sources = Split('''
30512302Sgabeblack@google.com	cpu/memtest/memtest.cc
30612302Sgabeblack@google.com        ''')
30712302Sgabeblack@google.com
30812302Sgabeblack@google.com# Include file paths are rooted in this directory.  SCons will
30911983Sgabeblack@google.com# automatically expand '.' to refer to both the source directory and
31011983Sgabeblack@google.com# the corresponding build directory to pick up generated include
31111983Sgabeblack@google.com# files.
31212302Sgabeblack@google.comenv.Append(CPPPATH=Dir('.'))
31312302Sgabeblack@google.com
31412302Sgabeblack@google.com# Add a flag defining what THE_ISA should be for all compilation
31512302Sgabeblack@google.comenv.Append(CPPDEFINES=[('THE_ISA','%s_ISA' % env['TARGET_ISA'].upper())])
31612302Sgabeblack@google.com
31712302Sgabeblack@google.comarch_sources = SConscript('arch/SConscript', exports = 'env')
31811983Sgabeblack@google.com
3196143Snate@binkert.orgcpu_sources = SConscript('cpu/SConscript', exports = 'env')
32012305Sgabeblack@google.com
32112302Sgabeblack@google.com# This is outside of cpu/SConscript since the source directory isn't
32212302Sgabeblack@google.com# underneath 'cpu'.
32312302Sgabeblack@google.comif 'FullCPU' in env['CPU_MODELS']:
3246143Snate@binkert.org    cpu_sources += full_cpu_sources
3256143Snate@binkert.org
3266143Snate@binkert.org# Set up complete list of sources based on configuration.
3275522Snate@binkert.orgsources = base_sources + arch_sources + cpu_sources
3286143Snate@binkert.org
3296143Snate@binkert.orgif env['FULL_SYSTEM']:
3306143Snate@binkert.org    sources += full_system_sources
3319982Satgutier@umich.edu    if env['ALPHA_TLASER']:
33212302Sgabeblack@google.com        sources += turbolaser_sources
33312302Sgabeblack@google.comelse:
33412302Sgabeblack@google.com    sources += syscall_emulation_sources
3356143Snate@binkert.org
3366143Snate@binkert.orgif env['USE_MYSQL']:
3376143Snate@binkert.org    sources += mysql_sources
3386143Snate@binkert.org
3395522Snate@binkert.orgfor opt in env.ExportOptions:
3405522Snate@binkert.org    env.ConfigFile(opt)
3415522Snate@binkert.org
3425522Snate@binkert.org###################################################
3435604Snate@binkert.org#
3445604Snate@binkert.org# Special build rules.
3456143Snate@binkert.org#
3466143Snate@binkert.org###################################################
3474762Snate@binkert.org
3484762Snate@binkert.org# base/traceflags.{cc,hh} are generated from base/traceflags.py.
3496143Snate@binkert.org# $TARGET.base will expand to "<build-dir>/base/traceflags".
3506727Ssteve.reinhardt@amd.comenv.Command(Split('base/traceflags.hh base/traceflags.cc'),
3516727Ssteve.reinhardt@amd.com            'base/traceflags.py',
3526727Ssteve.reinhardt@amd.com            'python $SOURCE $TARGET.base')
3534762Snate@binkert.org
3546143Snate@binkert.orgSConscript('python/SConscript', exports = ['env'])
3556143Snate@binkert.org
3566143Snate@binkert.org# This function adds the specified sources to the given build
3576143Snate@binkert.org# environment, and returns a list of all the corresponding SCons
3586727Ssteve.reinhardt@amd.com# Object nodes (including an extra one for date.cc).  We explicitly
3596143Snate@binkert.org# add the Object nodes so we can set up special dependencies for
3607674Snate@binkert.org# date.cc.
3617674Snate@binkert.orgdef make_objs(sources, env):
3625604Snate@binkert.org    objs = [env.Object(s) for s in sources]
3636143Snate@binkert.org    # make date.cc depend on all other objects so it always gets
3646143Snate@binkert.org    # recompiled whenever anything else does
3656143Snate@binkert.org    date_obj = env.Object('base/date.cc')
3664762Snate@binkert.org    env.Depends(date_obj, objs)
3676143Snate@binkert.org    objs.append(date_obj)
3684762Snate@binkert.org    return objs
3694762Snate@binkert.org
3704762Snate@binkert.org###################################################
3716143Snate@binkert.org#
3726143Snate@binkert.org# Define binaries.  Each different build type (debug, opt, etc.) gets
3734762Snate@binkert.org# a slightly different build environment.
37412302Sgabeblack@google.com#
37512302Sgabeblack@google.com###################################################
3768233Snate@binkert.org
37712302Sgabeblack@google.com# List of constructed environments to pass back to SConstruct
3786143Snate@binkert.orgenvList = []
3796143Snate@binkert.org
3804762Snate@binkert.org# Function to create a new build environment as clone of current
3816143Snate@binkert.org# environment 'env' with modified object suffix and optional stripped
3824762Snate@binkert.org# binary.  Additional keyword arguments are appended to corresponding
3839396Sandreas.hansson@arm.com# build environment vars.
3849396Sandreas.hansson@arm.comdef makeEnv(label, objsfx, strip = False, **kwargs):
3859396Sandreas.hansson@arm.com    newEnv = env.Copy(OBJSUFFIX=objsfx)
38612302Sgabeblack@google.com    newEnv.Label = label
38712302Sgabeblack@google.com    newEnv.Append(**kwargs)
38812302Sgabeblack@google.com    exe = 'm5.' + label  # final executable
3899396Sandreas.hansson@arm.com    bin = exe + '.bin'   # executable w/o appended Python zip archive
3909396Sandreas.hansson@arm.com    newEnv.Program(bin, make_objs(sources, newEnv))
3919396Sandreas.hansson@arm.com    if strip:
3929396Sandreas.hansson@arm.com        stripped_bin = bin + '.stripped'
3939396Sandreas.hansson@arm.com        newEnv.Command(stripped_bin, bin, 'strip $SOURCE -o $TARGET')
3949396Sandreas.hansson@arm.com        bin = stripped_bin
3959396Sandreas.hansson@arm.com    targets = newEnv.Concat(exe, [bin, 'python/m5py.zip'])
3969930Sandreas.hansson@arm.com    newEnv.M5Binary = targets[0]
3979930Sandreas.hansson@arm.com    envList.append(newEnv)
3989396Sandreas.hansson@arm.com
3996143Snate@binkert.org# Debug binary
40012797Sgabeblack@google.commakeEnv('debug', '.do',
40112797Sgabeblack@google.com        CCFLAGS = Split('-g3 -gdwarf-2 -O0'),
40212797Sgabeblack@google.com        CPPDEFINES = 'DEBUG')
4038235Snate@binkert.org
40412797Sgabeblack@google.com# Optimized binary
40512797Sgabeblack@google.commakeEnv('opt', '.o',
40612797Sgabeblack@google.com        CCFLAGS = Split('-g -O3'))
40712797Sgabeblack@google.com
40812797Sgabeblack@google.com# "Fast" binary
40912797Sgabeblack@google.commakeEnv('fast', '.fo', strip = True,
41012797Sgabeblack@google.com        CCFLAGS = Split('-O3'),
41112797Sgabeblack@google.com        CPPDEFINES = 'NDEBUG')
41212797Sgabeblack@google.com
41312797Sgabeblack@google.com# Profiled binary
41412797Sgabeblack@google.commakeEnv('prof', '.po',
41512797Sgabeblack@google.com        CCFLAGS = Split('-O3 -g -pg'),
41612797Sgabeblack@google.com        LINKFLAGS = '-pg')
41712797Sgabeblack@google.com
41812797Sgabeblack@google.comReturn('envList')
41912757Sgabeblack@google.com