SConscript revision 1310
1955SN/A# -*- mode:python -*-
2955SN/A
31762SN/A# Copyright (c) 2004 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.org
326143Snate@binkert.org# This file defines how to build a particular configuration of M5
334762Snate@binkert.org# based on variable settings in the 'env' build environment.
345522Snate@binkert.org
35955SN/A# Import build environment variable from SConstruct.
365522Snate@binkert.orgImport('env')
37955SN/A
385522Snate@binkert.org###################################################
394202Sbinkertn@umich.edu#
405742Snate@binkert.org# Define needed sources.
41955SN/A#
424381Sbinkertn@umich.edu###################################################
434381Sbinkertn@umich.edu
448334Snate@binkert.org# Base sources used by all configurations.
45955SN/Abase_sources = Split('''
46955SN/A	arch/alpha/decoder.cc
474202Sbinkertn@umich.edu	arch/alpha/fast_cpu_exec.cc
48955SN/A	arch/alpha/simple_cpu_exec.cc
494382Sbinkertn@umich.edu	arch/alpha/inorder_cpu_exec.cc
504382Sbinkertn@umich.edu	arch/alpha/full_cpu_exec.cc
514382Sbinkertn@umich.edu	arch/alpha/faults.cc
526654Snate@binkert.org	arch/alpha/isa_traits.cc
535517Snate@binkert.org
548614Sgblack@eecs.umich.edu	base/circlebuf.cc
557674Snate@binkert.org	base/copyright.cc
566143Snate@binkert.org	base/cprintf.cc
576143Snate@binkert.org        base/embedfile.cc
586143Snate@binkert.org	base/fast_alloc.cc
598233Snate@binkert.org	base/fifo_buffer.cc
608233Snate@binkert.org	base/hostinfo.cc
618233Snate@binkert.org	base/hybrid_pred.cc
628233Snate@binkert.org	base/inifile.cc
638233Snate@binkert.org	base/intmath.cc
648334Snate@binkert.org	base/match.cc
658334Snate@binkert.org	base/misc.cc
668233Snate@binkert.org	base/pollevent.cc
678233Snate@binkert.org	base/python.cc
688233Snate@binkert.org	base/range.cc
698233Snate@binkert.org	base/random.cc
708233Snate@binkert.org	base/sat_counter.cc
718233Snate@binkert.org	base/socket.cc
726143Snate@binkert.org	base/statistics.cc
738233Snate@binkert.org	base/str.cc
748233Snate@binkert.org	base/time.cc
758233Snate@binkert.org	base/trace.cc
766143Snate@binkert.org	base/traceflags.cc
776143Snate@binkert.org	base/userinfo.cc
786143Snate@binkert.org	base/compression/lzss_compression.cc
796143Snate@binkert.org	base/loader/aout_object.cc
808233Snate@binkert.org	base/loader/ecoff_object.cc
818233Snate@binkert.org	base/loader/elf_object.cc
828233Snate@binkert.org	base/loader/object_file.cc
836143Snate@binkert.org	base/loader/symtab.cc
848233Snate@binkert.org	base/stats/events.cc
858233Snate@binkert.org	base/stats/python.cc
868233Snate@binkert.org	base/stats/statdb.cc
878233Snate@binkert.org	base/stats/visit.cc
886143Snate@binkert.org	base/stats/text.cc
896143Snate@binkert.org
906143Snate@binkert.org	cpu/base_cpu.cc
914762Snate@binkert.org	cpu/exec_context.cc
926143Snate@binkert.org	cpu/exetrace.cc
938233Snate@binkert.org	cpu/pc_event.cc
948233Snate@binkert.org	cpu/static_inst.cc
958233Snate@binkert.org	cpu/fast_cpu/fast_cpu.cc
968233Snate@binkert.org	cpu/full_cpu/bpred.cc
978233Snate@binkert.org	cpu/full_cpu/commit.cc
986143Snate@binkert.org	cpu/full_cpu/create_vector.cc
998233Snate@binkert.org	cpu/full_cpu/cv_spec_state.cc
1008233Snate@binkert.org	cpu/full_cpu/dd_queue.cc
1018233Snate@binkert.org	cpu/full_cpu/dep_link.cc
1028233Snate@binkert.org	cpu/full_cpu/dispatch.cc
1036143Snate@binkert.org	cpu/full_cpu/dyn_inst.cc
1046143Snate@binkert.org	cpu/full_cpu/execute.cc
1056143Snate@binkert.org	cpu/full_cpu/fetch.cc
1066143Snate@binkert.org	cpu/full_cpu/floss_reasons.cc
1076143Snate@binkert.org	cpu/full_cpu/fu_pool.cc
1086143Snate@binkert.org	cpu/full_cpu/full_cpu.cc
1096143Snate@binkert.org	cpu/full_cpu/inst_fifo.cc
1106143Snate@binkert.org	cpu/full_cpu/instpipe.cc
1116143Snate@binkert.org	cpu/full_cpu/issue.cc
1127065Snate@binkert.org	cpu/full_cpu/ls_queue.cc
1136143Snate@binkert.org	cpu/full_cpu/machine_queue.cc
1148233Snate@binkert.org        cpu/full_cpu/pc_sample_profile.cc
1158233Snate@binkert.org	cpu/full_cpu/pipetrace.cc
1168233Snate@binkert.org	cpu/full_cpu/readyq.cc
1178233Snate@binkert.org	cpu/full_cpu/reg_info.cc
1188233Snate@binkert.org	cpu/full_cpu/rob_station.cc
1198233Snate@binkert.org	cpu/full_cpu/spec_memory.cc
1208233Snate@binkert.org	cpu/full_cpu/spec_state.cc
1218233Snate@binkert.org	cpu/full_cpu/storebuffer.cc
1228233Snate@binkert.org	cpu/full_cpu/writeback.cc
1238233Snate@binkert.org	cpu/full_cpu/iq/iq_station.cc
1248233Snate@binkert.org	cpu/full_cpu/iq/iqueue.cc
1258233Snate@binkert.org	cpu/full_cpu/iq/segmented/chain_info.cc
1268233Snate@binkert.org	cpu/full_cpu/iq/segmented/chain_wire.cc
1278233Snate@binkert.org	cpu/full_cpu/iq/segmented/iq_seg.cc
1288233Snate@binkert.org	cpu/full_cpu/iq/segmented/iq_segmented.cc
1298233Snate@binkert.org	cpu/full_cpu/iq/segmented/seg_chain.cc
1308233Snate@binkert.org	cpu/full_cpu/iq/seznec/iq_seznec.cc
1318233Snate@binkert.org	cpu/full_cpu/iq/standard/iq_standard.cc
1328233Snate@binkert.org	cpu/sampling_cpu/sampling_cpu.cc
1338233Snate@binkert.org	cpu/simple_cpu/simple_cpu.cc
1348233Snate@binkert.org	cpu/inorder_cpu/inorder_cpu.cc
1358233Snate@binkert.org	cpu/trace/reader/mem_trace_reader.cc
1368233Snate@binkert.org	cpu/trace/reader/ibm_reader.cc
1378233Snate@binkert.org	cpu/trace/reader/itx_reader.cc
1388233Snate@binkert.org	cpu/trace/reader/m5_reader.cc
1398233Snate@binkert.org
1408233Snate@binkert.org	mem/base_hier.cc
1418233Snate@binkert.org	mem/base_mem.cc
1428233Snate@binkert.org	mem/hier_params.cc
1438233Snate@binkert.org	mem/mem_cmd.cc
1448233Snate@binkert.org	mem/mem_debug.cc
1456143Snate@binkert.org	mem/mem_req.cc
1466143Snate@binkert.org	mem/memory_interface.cc
1476143Snate@binkert.org	mem/bus/base_interface.cc
1486143Snate@binkert.org	mem/bus/bus.cc
1496143Snate@binkert.org	mem/bus/bus_bridge.cc
1506143Snate@binkert.org	mem/bus/bus_bridge_master.cc
1516143Snate@binkert.org	mem/bus/bus_bridge_slave.cc
1526143Snate@binkert.org	mem/bus/bus_interface.cc
1536143Snate@binkert.org	mem/bus/dma_bus_interface.cc
1548945Ssteve.reinhardt@amd.com	mem/bus/dma_interface.cc
1558233Snate@binkert.org	mem/bus/master_interface.cc
1568233Snate@binkert.org	mem/bus/slave_interface.cc
1576143Snate@binkert.org	mem/cache/base_cache.cc
1588945Ssteve.reinhardt@amd.com	mem/cache/cache.cc
1596143Snate@binkert.org	mem/cache/cache_builder.cc
1606143Snate@binkert.org	mem/cache/coherence/coherence_protocol.cc
1616143Snate@binkert.org	mem/cache/coherence/uni_coherence.cc
1626143Snate@binkert.org	mem/cache/miss/blocking_buffer.cc
1635522Snate@binkert.org	mem/cache/miss/miss_queue.cc
1646143Snate@binkert.org	mem/cache/miss/mshr.cc
1656143Snate@binkert.org	mem/cache/miss/mshr_queue.cc
1666143Snate@binkert.org	mem/cache/tags/base_tags.cc
1676143Snate@binkert.org	mem/cache/tags/cache_tags.cc
1688233Snate@binkert.org	mem/cache/tags/fa_lru.cc
1698233Snate@binkert.org	mem/cache/tags/iic.cc
1708233Snate@binkert.org	mem/cache/tags/lru.cc
1716143Snate@binkert.org	mem/cache/tags/split.cc
1726143Snate@binkert.org	mem/cache/tags/split_lifo.cc
1736143Snate@binkert.org	mem/cache/tags/split_lru.cc
1746143Snate@binkert.org	mem/cache/tags/repl/gen.cc
1755522Snate@binkert.org	mem/cache/tags/repl/repl.cc
1765522Snate@binkert.org	mem/functional_mem/functional_memory.cc
1775522Snate@binkert.org	mem/functional_mem/main_memory.cc
1785522Snate@binkert.org	mem/timing_mem/base_memory.cc
1795604Snate@binkert.org	mem/timing_mem/memory_builder.cc
1805604Snate@binkert.org	mem/timing_mem/simple_mem_bank.cc
1816143Snate@binkert.org        mem/trace/itx_writer.cc
1826143Snate@binkert.org	mem/trace/mem_trace_writer.cc
1834762Snate@binkert.org	mem/trace/m5_writer.cc
1844762Snate@binkert.org
1856143Snate@binkert.org	sim/builder.cc
1866727Ssteve.reinhardt@amd.com	sim/configfile.cc
1876727Ssteve.reinhardt@amd.com	sim/debug.cc
1886727Ssteve.reinhardt@amd.com	sim/eventq.cc
1894762Snate@binkert.org	sim/main.cc
1906143Snate@binkert.org	sim/param.cc
1916143Snate@binkert.org	sim/profile.cc
1926143Snate@binkert.org	sim/serialize.cc
1936143Snate@binkert.org	sim/sim_events.cc
1946727Ssteve.reinhardt@amd.com	sim/sim_exit.cc
1956143Snate@binkert.org	sim/sim_object.cc
1967674Snate@binkert.org	sim/startup.cc
1977674Snate@binkert.org	sim/stat_context.cc
1985604Snate@binkert.org	sim/stat_control.cc
1996143Snate@binkert.org	sim/trace_context.cc
2006143Snate@binkert.org	sim/universe.cc
2016143Snate@binkert.org        sim/pyconfig/pyconfig.cc
2024762Snate@binkert.org        sim/pyconfig/embedded_py.cc
2036143Snate@binkert.org        ''')
2044762Snate@binkert.org
2054762Snate@binkert.org# MySql sources
2064762Snate@binkert.orgmysql_sources = Split('''
2076143Snate@binkert.org	base/mysql.cc
2086143Snate@binkert.org	base/stats/mysql.cc
2094762Snate@binkert.org        ''')
2108233Snate@binkert.org
2118233Snate@binkert.org# Full-system sources
2128233Snate@binkert.orgfull_system_sources = Split('''
2138233Snate@binkert.org	arch/alpha/alpha_memory.cc
2146143Snate@binkert.org	arch/alpha/arguments.cc
2156143Snate@binkert.org	arch/alpha/ev5.cc
2164762Snate@binkert.org	arch/alpha/osfpal.cc
2176143Snate@binkert.org	arch/alpha/pseudo_inst.cc
2184762Snate@binkert.org	arch/alpha/vtophys.cc
2196143Snate@binkert.org
2204762Snate@binkert.org	base/crc.cc
2216143Snate@binkert.org	base/inet.cc
2228233Snate@binkert.org	base/remote_gdb.cc
2238233Snate@binkert.org
2248233Snate@binkert.org	cpu/intr_control.cc
2256143Snate@binkert.org
2266143Snate@binkert.org	dev/alpha_console.cc
2276143Snate@binkert.org	dev/baddev.cc
2286143Snate@binkert.org        dev/simconsole.cc
2296143Snate@binkert.org	dev/disk_image.cc
2306143Snate@binkert.org	dev/dma.cc
2316143Snate@binkert.org	dev/etherbus.cc
2326143Snate@binkert.org	dev/etherdump.cc
2338233Snate@binkert.org	dev/etherint.cc
2348233Snate@binkert.org	dev/etherlink.cc
235955SN/A	dev/etherpkt.cc
2368235Snate@binkert.org	dev/ethertap.cc
2378235Snate@binkert.org	dev/ide_ctrl.cc
2386143Snate@binkert.org	dev/ide_disk.cc
2398235Snate@binkert.org	dev/io_device.cc
2409003SAli.Saidi@ARM.com	dev/ns_gige.cc
2418235Snate@binkert.org	dev/etherdev.cc
2428235Snate@binkert.org	dev/pciconfigall.cc
2438235Snate@binkert.org	dev/pcidev.cc
2448235Snate@binkert.org	dev/pktfifo.cc
2458235Snate@binkert.org	dev/scsi.cc
2468235Snate@binkert.org	dev/scsi_ctrl.cc
2478235Snate@binkert.org	dev/scsi_disk.cc
2488235Snate@binkert.org	dev/scsi_none.cc
2498235Snate@binkert.org	dev/sinic.cc
2508235Snate@binkert.org	dev/simple_disk.cc
2518235Snate@binkert.org	dev/tlaser_clock.cc
2528235Snate@binkert.org	dev/tlaser_ipi.cc
2538235Snate@binkert.org	dev/tlaser_mbox.cc
2548235Snate@binkert.org	dev/tlaser_mc146818.cc
2559003SAli.Saidi@ARM.com	dev/tlaser_node.cc
2568235Snate@binkert.org	dev/tlaser_pcia.cc
2575584Snate@binkert.org	dev/tlaser_pcidev.cc
2584382Sbinkertn@umich.edu	dev/tlaser_serial.cc
2594202Sbinkertn@umich.edu	dev/turbolaser.cc
2604382Sbinkertn@umich.edu	dev/tsunami.cc
2614382Sbinkertn@umich.edu	dev/tsunami_cchip.cc
2624382Sbinkertn@umich.edu	dev/tsunami_fake.cc
2635584Snate@binkert.org	dev/tsunami_io.cc
2644382Sbinkertn@umich.edu	dev/tsunami_pchip.cc
2654382Sbinkertn@umich.edu	dev/uart.cc
2664382Sbinkertn@umich.edu
2678232Snate@binkert.org	kern/kernel_binning.cc
2685192Ssaidi@eecs.umich.edu	kern/kernel_stats.cc
2698232Snate@binkert.org	kern/system_events.cc
2708232Snate@binkert.org	kern/linux/linux_events.cc
2718232Snate@binkert.org	kern/linux/linux_syscalls.cc
2725192Ssaidi@eecs.umich.edu	kern/linux/linux_system.cc
2738232Snate@binkert.org	kern/linux/printk.cc
2745192Ssaidi@eecs.umich.edu	kern/tru64/dump_mbuf.cc
2755799Snate@binkert.org	kern/tru64/printf.cc
2768232Snate@binkert.org	kern/tru64/tru64_events.cc
2775192Ssaidi@eecs.umich.edu	kern/tru64/tru64_syscalls.cc
2785192Ssaidi@eecs.umich.edu	kern/tru64/tru64_system.cc
2795192Ssaidi@eecs.umich.edu
2808232Snate@binkert.org	mem/functional_mem/memory_control.cc
2815192Ssaidi@eecs.umich.edu	mem/functional_mem/physical_memory.cc
2828232Snate@binkert.org        dev/platform.cc
2835192Ssaidi@eecs.umich.edu
2845192Ssaidi@eecs.umich.edu	sim/system.cc
2855192Ssaidi@eecs.umich.edu        ''')
2865192Ssaidi@eecs.umich.edu
2874382Sbinkertn@umich.edu# Syscall emulation (non-full-system) sources
2884382Sbinkertn@umich.edusyscall_emulation_sources = Split('''
2894382Sbinkertn@umich.edu	arch/alpha/alpha_common_syscall_emul.cc
2902667Sstever@eecs.umich.edu	arch/alpha/alpha_linux_process.cc
2912667Sstever@eecs.umich.edu	arch/alpha/alpha_tru64_process.cc
2922667Sstever@eecs.umich.edu	cpu/memtest/memtest.cc
2932667Sstever@eecs.umich.edu        cpu/trace/opt_cpu.cc
2942667Sstever@eecs.umich.edu	cpu/trace/trace_cpu.cc
2952667Sstever@eecs.umich.edu	eio/eio.cc
2965742Snate@binkert.org	eio/exolex.cc
2975742Snate@binkert.org	eio/libexo.cc
2985742Snate@binkert.org	sim/process.cc
2995793Snate@binkert.org	sim/syscall_emul.cc
3008334Snate@binkert.org        ''')
3015793Snate@binkert.org
3025793Snate@binkert.orgtargetarch_files = Split('''
3035793Snate@binkert.org        alpha_common_syscall_emul.hh
3044382Sbinkertn@umich.edu        alpha_linux_process.hh
3054762Snate@binkert.org        alpha_memory.hh
3065344Sstever@gmail.com        alpha_tru64_process.hh
3074382Sbinkertn@umich.edu        aout_machdep.h
3085341Sstever@gmail.com        arguments.hh
3095742Snate@binkert.org        byte_swap.hh
3105742Snate@binkert.org        ecoff_machdep.h
3115742Snate@binkert.org        elf_machdep.h
3125742Snate@binkert.org        ev5.hh
3135742Snate@binkert.org        faults.hh
3144762Snate@binkert.org        isa_fullsys_traits.hh
3155742Snate@binkert.org        isa_traits.hh
3165742Snate@binkert.org        machine_exo.h
3177722Sgblack@eecs.umich.edu        osfpal.hh
3185742Snate@binkert.org        pseudo_inst.hh
3195742Snate@binkert.org        vptr.hh
3205742Snate@binkert.org        vtophys.hh
3215742Snate@binkert.org        ''')
3228242Sbradley.danofsky@amd.com
3238242Sbradley.danofsky@amd.comfor f in targetarch_files:
3248242Sbradley.danofsky@amd.com    env.Command('targetarch/' + f, 'arch/alpha/' + f,
3258242Sbradley.danofsky@amd.com                '''echo '#include "arch/alpha/%s"' > $TARGET''' % f)
3265341Sstever@gmail.com
3275742Snate@binkert.org
3287722Sgblack@eecs.umich.edu# Set up complete list of sources based on configuration.
3294773Snate@binkert.orgsources = base_sources
3306108Snate@binkert.org
3311858SN/Aif env['FULL_SYSTEM']:
3321085SN/A    sources += full_system_sources
3336658Snate@binkert.orgelse:
3346658Snate@binkert.org    sources += syscall_emulation_sources
3357673Snate@binkert.org
3366658Snate@binkert.orgextra_libraries = []
3376658Snate@binkert.orgenv.Append(LIBS=['z'])
3386658Snate@binkert.orgif env['USE_MYSQL']:
3396658Snate@binkert.org    sources += mysql_sources
3406658Snate@binkert.org    env.Append(CPPDEFINES = 'USE_MYSQL')
3416658Snate@binkert.org    env.Append(CPPDEFINES = 'STATS_BINNING')
3426658Snate@binkert.org    env.Append(CPPPATH=['/usr/local/include/mysql', '/usr/include/mysql'])
3437673Snate@binkert.org    if os.path.isdir('/usr/lib64'):
3447673Snate@binkert.org        env.Append(LIBPATH=['/usr/lib64/mysql'])
3457673Snate@binkert.org    else:
3467673Snate@binkert.org        env.Append(LIBPATH=['/usr/lib/mysql/'])
3477673Snate@binkert.org    env.Append(LIBS=['mysqlclient'])
3487673Snate@binkert.org
3497673Snate@binkert.org
3506658Snate@binkert.org###################################################
3517673Snate@binkert.org#
3527673Snate@binkert.org# Special build rules.
3537673Snate@binkert.org#
3547673Snate@binkert.org###################################################
3557673Snate@binkert.org
3567673Snate@binkert.org# base/traceflags.{cc,hh} are generated from base/traceflags.py.
3579048SAli.Saidi@ARM.com# $TARGET.base will expand to "<build-dir>/base/traceflags".
3587673Snate@binkert.orgenv.Command(Split('base/traceflags.hh base/traceflags.cc'),
3597673Snate@binkert.org            'base/traceflags.py',
3607673Snate@binkert.org            'python $SOURCE $TARGET.base')
3617673Snate@binkert.org
3626658Snate@binkert.org# several files are generated from arch/$TARGET_ISA/isa_desc.
3637756SAli.Saidi@ARM.comenv.Command(Split('''arch/alpha/decoder.cc
3647816Ssteve.reinhardt@amd.com		     arch/alpha/decoder.hh
3656658Snate@binkert.org		     arch/alpha/fast_cpu_exec.cc
3664382Sbinkertn@umich.edu                     arch/alpha/simple_cpu_exec.cc
3674382Sbinkertn@umich.edu                     arch/alpha/inorder_cpu_exec.cc
3684762Snate@binkert.org                     arch/alpha/full_cpu_exec.cc'''),
3694762Snate@binkert.org            Split('''arch/alpha/isa_desc
3704762Snate@binkert.org		     arch/isa_parser.py'''),
3716654Snate@binkert.org            '$SRCDIR/arch/isa_parser.py $SOURCE $TARGET.dir arch/alpha')
3726654Snate@binkert.org
3735517Snate@binkert.org
3745517Snate@binkert.org# libelf build is described in its own SConscript file.
3755517Snate@binkert.org# SConscript-local is the per-config build, which just copies some
3765517Snate@binkert.org# header files into a place where they can be found.
3775517Snate@binkert.orgSConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
3785517Snate@binkert.orgSConscript('sim/pyconfig/SConscript', exports = ['env'], duplicate=0)
3795517Snate@binkert.org
3805517Snate@binkert.org
3815517Snate@binkert.org# This function adds the specified sources to the given build
3825517Snate@binkert.org# environment, and returns a list of all the corresponding SCons
3835517Snate@binkert.org# Object nodes (including an extra one for date.cc).  We explicitly
3845517Snate@binkert.org# add the Object nodes so we can set up special dependencies for
3855517Snate@binkert.org# date.cc.
3865517Snate@binkert.orgdef make_objs(sources, env):
3875517Snate@binkert.org    objs = [env.Object(s) for s in sources]
3885517Snate@binkert.org    # make date.cc depend on all other objects so it always gets
3895517Snate@binkert.org    # recompiled whenever anything else does
3906654Snate@binkert.org    date_obj = env.Object('base/date.cc')
3915517Snate@binkert.org    env.Depends(date_obj, objs)
3925517Snate@binkert.org    objs.append(date_obj)
3935517Snate@binkert.org    objs.extend(extra_libraries)
3945517Snate@binkert.org    return objs
3955517Snate@binkert.org
3965517Snate@binkert.org###################################################
3975517Snate@binkert.org#
3985517Snate@binkert.org# Define binaries.  Each different build type (debug, opt, etc.) gets
3996143Snate@binkert.org# a slightly different build environment.
4006654Snate@binkert.org#
4015517Snate@binkert.org###################################################
4025517Snate@binkert.org
4035517Snate@binkert.org# Include file paths are rooted in this directory.  SCons will
4045517Snate@binkert.org# automatically expand '.' to refer to both the source directory and
4055517Snate@binkert.org# the corresponding build directory to pick up generated include
4065517Snate@binkert.org# files.
4075517Snate@binkert.orgenv.Append(CPPPATH='.')
4085517Snate@binkert.org
4095517Snate@binkert.org# Debug binary
4105517Snate@binkert.orgdebug = env.Copy(OBJSUFFIX='.do')
4115517Snate@binkert.orgdebug.Append(CCFLAGS=Split('-g -gstabs+ -O0'))
4125517Snate@binkert.orgdebug.Append(CPPDEFINES='DEBUG')
4135517Snate@binkert.orgdebug.Program(target = 'm5.debug', source = make_objs(sources, debug))
4145517Snate@binkert.org
4156654Snate@binkert.org# Optimized binary
4166654Snate@binkert.orgopt = env.Copy()
4175517Snate@binkert.orgopt.Append(CCFLAGS=Split('-g -O5'))
4185517Snate@binkert.orgopt.Program(target = 'm5.opt', source = make_objs(sources, opt))
4196143Snate@binkert.org
4206143Snate@binkert.org# "Fast" binary
4216143Snate@binkert.orgfast = env.Copy(OBJSUFFIX='.fo')
4226727Ssteve.reinhardt@amd.comfast.Append(CCFLAGS=Split('-O5'))
4235517Snate@binkert.orgfast.Append(CPPDEFINES='NDEBUG')
4246727Ssteve.reinhardt@amd.comfast.Program(target = 'm5.fast.unstripped', source = make_objs(sources, fast))
4255517Snate@binkert.orgfast.Command(target = 'm5.fast', source = 'm5.fast.unstripped',
4265517Snate@binkert.org             action = 'strip $SOURCE -o $TARGET')
4275517Snate@binkert.org
4286654Snate@binkert.org# Profiled binary
4296654Snate@binkert.orgprof = env.Copy(OBJSUFFIX='.po')
4307673Snate@binkert.orgprof.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg')
4316654Snate@binkert.orgprof.Program(target = 'm5.prof', source = make_objs(sources, prof))
4326654Snate@binkert.org