SConscript revision 1127
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
292665Ssaidi@eecs.umich.eduimport os
30955SN/Aimport sys
31955SN/A
32955SN/A# This file defines how to build a particular configuration of M5
333583Sbinkertn@umich.edu# based on variable settings in the 'env' build environment.
34955SN/A
35955SN/A# Import build environment variable from SConstruct.
36955SN/AImport('env')
37955SN/A
38955SN/A###################################################
39955SN/A#
40955SN/A# Define needed sources.
41955SN/A#
42955SN/A###################################################
43955SN/A
44955SN/A# Base sources used by all configurations.
45955SN/Abase_sources = Split('''
46955SN/A	arch/alpha/decoder.cc
47955SN/A	arch/alpha/fast_cpu_exec.cc
482023SN/A	arch/alpha/simple_cpu_exec.cc
49955SN/A	arch/alpha/full_cpu_exec.cc
503089Ssaidi@eecs.umich.edu	arch/alpha/faults.cc
51955SN/A	arch/alpha/isa_traits.cc
52955SN/A
53955SN/A	base/circlebuf.cc
54955SN/A	base/copyright.cc
55955SN/A	base/cprintf.cc
56955SN/A	base/fast_alloc.cc
57955SN/A	base/fifo_buffer.cc
58955SN/A	base/hostinfo.cc
591031SN/A	base/hybrid_pred.cc
60955SN/A	base/inifile.cc
611388SN/A	base/intmath.cc
62955SN/A	base/match.cc
63955SN/A	base/misc.cc
641296SN/A	base/pollevent.cc
653960Sgblack@eecs.umich.edu	base/python.cc
66955SN/A	base/range.cc
67955SN/A	base/sat_counter.cc
68955SN/A	base/socket.cc
69955SN/A	base/statistics.cc
70955SN/A	base/str.cc
71955SN/A	base/time.cc
72955SN/A	base/trace.cc
73955SN/A	base/traceflags.cc
74955SN/A	base/userinfo.cc
75955SN/A	base/compression/lzss_compression.cc
76955SN/A	base/loader/aout_object.cc
77955SN/A	base/loader/ecoff_object.cc
783584Ssaidi@eecs.umich.edu	base/loader/elf_object.cc
79955SN/A	base/loader/object_file.cc
80955SN/A	base/loader/symtab.cc
81955SN/A	base/stats/events.cc
82955SN/A	base/stats/python.cc
83955SN/A	base/stats/statdb.cc
84955SN/A	base/stats/visit.cc
85955SN/A	base/stats/text.cc
862325SN/A
871717SN/A	cpu/base_cpu.cc
882652Ssaidi@eecs.umich.edu	cpu/exec_context.cc
89955SN/A	cpu/exetrace.cc
902736Sktlim@umich.edu	cpu/pc_event.cc
912410SN/A	cpu/static_inst.cc
92955SN/A	cpu/fast_cpu/fast_cpu.cc
932290SN/A	cpu/full_cpu/bpred.cc
94955SN/A	cpu/full_cpu/commit.cc
952683Sktlim@umich.edu	cpu/full_cpu/create_vector.cc
962683Sktlim@umich.edu	cpu/full_cpu/cv_spec_state.cc
972669Sktlim@umich.edu	cpu/full_cpu/dd_queue.cc
982568SN/A	cpu/full_cpu/dep_link.cc
992568SN/A	cpu/full_cpu/dispatch.cc
1003012Ssaidi@eecs.umich.edu	cpu/full_cpu/dyn_inst.cc
1012462SN/A	cpu/full_cpu/execute.cc
1022568SN/A	cpu/full_cpu/fetch.cc
1032395SN/A	cpu/full_cpu/floss_reasons.cc
1042405SN/A	cpu/full_cpu/fu_pool.cc
1052914Ssaidi@eecs.umich.edu	cpu/full_cpu/full_cpu.cc
106955SN/A	cpu/full_cpu/inst_fifo.cc
1072811Srdreslin@umich.edu	cpu/full_cpu/instpipe.cc
1082811Srdreslin@umich.edu	cpu/full_cpu/issue.cc
1092811Srdreslin@umich.edu	cpu/full_cpu/ls_queue.cc
1102811Srdreslin@umich.edu	cpu/full_cpu/machine_queue.cc
1112811Srdreslin@umich.edu	cpu/full_cpu/pipetrace.cc
1123719Sstever@eecs.umich.edu	cpu/full_cpu/readyq.cc
1132811Srdreslin@umich.edu	cpu/full_cpu/reg_info.cc
1142811Srdreslin@umich.edu	cpu/full_cpu/rob_station.cc
1152811Srdreslin@umich.edu	cpu/full_cpu/spec_memory.cc
1162811Srdreslin@umich.edu	cpu/full_cpu/spec_state.cc
1172811Srdreslin@umich.edu	cpu/full_cpu/storebuffer.cc
1182811Srdreslin@umich.edu	cpu/full_cpu/writeback.cc
1192811Srdreslin@umich.edu	cpu/full_cpu/iq/iq_station.cc
1202811Srdreslin@umich.edu	cpu/full_cpu/iq/iqueue.cc
1212811Srdreslin@umich.edu	cpu/full_cpu/iq/segmented/chain_info.cc
1222811Srdreslin@umich.edu	cpu/full_cpu/iq/segmented/chain_wire.cc
1232811Srdreslin@umich.edu	cpu/full_cpu/iq/segmented/iq_seg.cc
1242814Srdreslin@umich.edu	cpu/full_cpu/iq/segmented/iq_segmented.cc
1252811Srdreslin@umich.edu	cpu/full_cpu/iq/segmented/seg_chain.cc
1262811Srdreslin@umich.edu	cpu/full_cpu/iq/seznec/iq_seznec.cc
1272811Srdreslin@umich.edu	cpu/full_cpu/iq/standard/iq_standard.cc
1282811Srdreslin@umich.edu	cpu/sampling_cpu/sampling_cpu.cc
1292811Srdreslin@umich.edu	cpu/simple_cpu/simple_cpu.cc
1302811Srdreslin@umich.edu	cpu/trace/reader/mem_trace_reader.cc
1312811Srdreslin@umich.edu	cpu/trace/reader/ibm_reader.cc
1322813Srdreslin@umich.edu	cpu/trace/reader/itx_reader.cc
1332813Srdreslin@umich.edu	cpu/trace/reader/m5_reader.cc
1343645Sbinkertn@umich.edu
1353624Sbinkertn@umich.edu	mem/base_hier.cc
1363624Sbinkertn@umich.edu	mem/base_mem.cc
137955SN/A	mem/hier_params.cc
138955SN/A	mem/mem_cmd.cc
139955SN/A	mem/mem_debug.cc
1402090SN/A	mem/mem_req.cc
141955SN/A	mem/memory_interface.cc
142955SN/A	mem/bus/base_interface.cc
1431696SN/A	mem/bus/bus.cc
144955SN/A	mem/bus/bus_bridge.cc
145955SN/A	mem/bus/bus_bridge_master.cc
146955SN/A	mem/bus/bus_bridge_slave.cc
1471127SN/A	mem/bus/bus_interface.cc
148955SN/A	mem/bus/dma_bus_interface.cc
149955SN/A	mem/bus/dma_interface.cc
1502379SN/A	mem/bus/master_interface.cc
151955SN/A	mem/bus/slave_interface.cc
152955SN/A	mem/cache/base_cache.cc
153955SN/A	mem/cache/cache.cc
1542422SN/A	mem/cache/cache_builder.cc
1552422SN/A	mem/cache/coherence/coherence_protocol.cc
1562422SN/A	mem/cache/coherence/uni_coherence.cc
1572422SN/A	mem/cache/miss/blocking_buffer.cc
1582422SN/A	mem/cache/miss/miss_queue.cc
1592422SN/A	mem/cache/miss/mshr.cc
1602422SN/A	mem/cache/miss/mshr_queue.cc
1612397SN/A	mem/cache/tags/base_tags.cc
1622397SN/A	mem/cache/tags/cache_tags.cc
1632422SN/A	mem/cache/tags/fa_lru.cc
1642422SN/A	mem/cache/tags/iic.cc
165955SN/A	mem/cache/tags/lru.cc
166955SN/A	mem/cache/tags/split.cc
167955SN/A	mem/cache/tags/split_lifo.cc
168955SN/A	mem/cache/tags/split_lru.cc
169955SN/A	mem/cache/tags/repl/gen.cc
170955SN/A	mem/cache/tags/repl/repl.cc
171955SN/A	mem/functional_mem/functional_memory.cc
172955SN/A	mem/functional_mem/main_memory.cc
1731078SN/A	mem/timing_mem/base_memory.cc
174955SN/A	mem/timing_mem/memory_builder.cc
175955SN/A	mem/timing_mem/simple_mem_bank.cc
176955SN/A        mem/trace/itx_writer.cc
1771917SN/A	mem/trace/mem_trace_writer.cc
178955SN/A	mem/trace/m5_writer.cc
179955SN/A
1801730SN/A	sim/builder.cc
181955SN/A	sim/configfile.cc
1822521SN/A	sim/debug.cc
1832521SN/A	sim/eventq.cc
1842507SN/A	sim/main.cc
1852507SN/A	sim/param.cc
1862989Ssaidi@eecs.umich.edu	sim/profile.cc
1873408Ssaidi@eecs.umich.edu	sim/serialize.cc
1882507SN/A	sim/sim_events.cc
1892507SN/A	sim/sim_exit.cc
1902507SN/A	sim/sim_object.cc
191955SN/A	sim/startup.cc
192955SN/A	sim/stat_context.cc
193955SN/A	sim/stat_control.cc
194955SN/A	sim/trace_context.cc
195955SN/A	sim/universe.cc
196955SN/A        sim/pyconfig/pyconfig.cc
197955SN/A        sim/pyconfig/code.cc
198955SN/A        ''')
1992520SN/A
2002517SN/Abase_obj_desc_files = Split('''
2012253SN/A        cpu/full_cpu/iq/segmented/SegmentedIQ.od
2022253SN/A        cpu/full_cpu/iq/seznec/SeznecIQ.od
2032253SN/A        cpu/full_cpu/iq/standard/StandardIQ.od
2042253SN/A        cpu/full_cpu/iq/BaseIQ.od
2052553SN/A        cpu/full_cpu/BranchPred.od
2062553SN/A        cpu/full_cpu/FUDesc.od
2072553SN/A        cpu/full_cpu/FullCPU.od
2082553SN/A        cpu/full_cpu/FuncUnitPool.od
2092507SN/A        cpu/full_cpu/OpDesc.od
2102400SN/A        cpu/full_cpu/PipeTrace.od
2112400SN/A        cpu/sampling_cpu/SamplingCPU.od
212955SN/A        cpu/simple_cpu/SimpleCPU.od
213955SN/A        cpu/BaseCPU.od
2142667Sstever@eecs.umich.edu        cpu/IntrControl.od
2152667Sstever@eecs.umich.edu        mem/bus/Bus.od
2162667Sstever@eecs.umich.edu        mem/bus/BusBridge.od
2172667Sstever@eecs.umich.edu        mem/cache/coherence/CoherenceProtocol.od
2182667Sstever@eecs.umich.edu        mem/cache/tags/repl/GenRepl.od
2192667Sstever@eecs.umich.edu        mem/cache/tags/repl/Repl.od
2202037SN/A        mem/cache/BaseCache.od
2212037SN/A        mem/functional_mem/FunctionalMemory.od
2222037SN/A        mem/functional_mem/MainMemory.od
2233534Sgblack@eecs.umich.edu        mem/functional_mem/MemoryController.od
2242139SN/A        mem/functional_mem/PhysicalMemory.od
2253534Sgblack@eecs.umich.edu        mem/timing_mem/BaseMemory.od
2263534Sgblack@eecs.umich.edu        mem/BaseHier.od
2273542Sgblack@eecs.umich.edu        mem/BaseMem.od
2283583Sbinkertn@umich.edu        mem/HierParams.od
2293583Sbinkertn@umich.edu        ''')
2303542Sgblack@eecs.umich.edu
2313499Ssaidi@eecs.umich.edu
2323583Sbinkertn@umich.edu# MySql sources
2333583Sbinkertn@umich.edumysql_sources = Split('''
2343547Sgblack@eecs.umich.edu	base/mysql.cc
2352155SN/A	base/stats/mysql.cc
236955SN/A        ''')
2372155SN/A
238955SN/A# Full-system sources
2393583Sbinkertn@umich.edufull_system_sources = Split('''
2403583Sbinkertn@umich.edu	arch/alpha/alpha_memory.cc
2413583Sbinkertn@umich.edu	arch/alpha/arguments.cc
2423583Sbinkertn@umich.edu	arch/alpha/ev5.cc
2433583Sbinkertn@umich.edu	arch/alpha/osfpal.cc
244955SN/A	arch/alpha/pseudo_inst.cc
245955SN/A	arch/alpha/vtophys.cc
246955SN/A
247955SN/A	base/crc.cc
248955SN/A	base/inet.cc
2491858SN/A	base/remote_gdb.cc
250955SN/A
2511858SN/A	cpu/intr_control.cc
2521858SN/A
2531858SN/A	dev/alpha_console.cc
2541085SN/A	dev/baddev.cc
255955SN/A        dev/simconsole.cc
256955SN/A	dev/disk_image.cc
257955SN/A	dev/dma.cc
258955SN/A	dev/etherbus.cc
259955SN/A	dev/etherdump.cc
260955SN/A	dev/etherint.cc
261955SN/A	dev/etherlink.cc
262955SN/A	dev/etherpkt.cc
263955SN/A	dev/ethertap.cc
264955SN/A	dev/ide_ctrl.cc
265955SN/A	dev/ide_disk.cc
266955SN/A	dev/io_device.cc
2672667Sstever@eecs.umich.edu	dev/ns_gige.cc
2681045SN/A	dev/etherdev.cc
269955SN/A	dev/pciconfigall.cc
270955SN/A	dev/pcidev.cc
271955SN/A	dev/scsi.cc
272955SN/A	dev/scsi_ctrl.cc
2731108SN/A	dev/scsi_disk.cc
274955SN/A	dev/scsi_none.cc
275955SN/A	dev/simple_disk.cc
276955SN/A	dev/tlaser_clock.cc
277955SN/A	dev/tlaser_ipi.cc
278955SN/A	dev/tlaser_mbox.cc
279955SN/A	dev/tlaser_mc146818.cc
280955SN/A	dev/tlaser_node.cc
281955SN/A	dev/tlaser_pcia.cc
282955SN/A	dev/tlaser_pcidev.cc
283955SN/A	dev/tlaser_serial.cc
284955SN/A	dev/turbolaser.cc
285955SN/A	dev/tsunami.cc
286955SN/A	dev/tsunami_cchip.cc
287955SN/A	dev/tsunami_fake.cc
288955SN/A	dev/tsunami_io.cc
289955SN/A	dev/tsunami_pchip.cc
2902655Sstever@eecs.umich.edu	dev/uart.cc
2912655Sstever@eecs.umich.edu
2922655Sstever@eecs.umich.edu	kern/kernel_binning.cc
2932655Sstever@eecs.umich.edu	kern/kernel_stats.cc
2942655Sstever@eecs.umich.edu	kern/system_events.cc
2952655Sstever@eecs.umich.edu	kern/linux/linux_events.cc
2962655Sstever@eecs.umich.edu	kern/linux/linux_syscalls.cc
2972655Sstever@eecs.umich.edu	kern/linux/linux_system.cc
2982655Sstever@eecs.umich.edu	kern/linux/printk.cc
2992655Sstever@eecs.umich.edu	kern/tru64/dump_mbuf.cc
3002655Sstever@eecs.umich.edu	kern/tru64/printf.cc
3012655Sstever@eecs.umich.edu	kern/tru64/tru64_events.cc
3022655Sstever@eecs.umich.edu	kern/tru64/tru64_syscalls.cc
3032655Sstever@eecs.umich.edu	kern/tru64/tru64_system.cc
3042655Sstever@eecs.umich.edu
3052655Sstever@eecs.umich.edu	mem/functional_mem/memory_control.cc
3062655Sstever@eecs.umich.edu	mem/functional_mem/physical_memory.cc
3072655Sstever@eecs.umich.edu        dev/platform.cc
3082655Sstever@eecs.umich.edu
3092655Sstever@eecs.umich.edu	sim/system.cc
3102655Sstever@eecs.umich.edu        ''')
3112655Sstever@eecs.umich.edu
312955SN/Afull_system_obj_desc_files = Split('''
3133515Ssaidi@eecs.umich.edu        arch/alpha/AlphaDTB.od
3143515Ssaidi@eecs.umich.edu        arch/alpha/AlphaITB.od
3153515Ssaidi@eecs.umich.edu        arch/alpha/AlphaTLB.od
3163515Ssaidi@eecs.umich.edu        dev/AlphaConsole.od
3173515Ssaidi@eecs.umich.edu        dev/ConsoleListener.od
3183515Ssaidi@eecs.umich.edu        dev/CowDiskImage.od
3193515Ssaidi@eecs.umich.edu        dev/DiskImage.od
3202655Sstever@eecs.umich.edu        dev/DmaDevice.od
3213515Ssaidi@eecs.umich.edu        dev/DmaEngine.od
3223619Sbinkertn@umich.edu        dev/EtherBus.od
323955SN/A        dev/EtherDev.od
324955SN/A        dev/EtherDevInt.od
3252655Sstever@eecs.umich.edu        dev/EtherDump.od
3263619Sbinkertn@umich.edu        dev/EtherInt.od
3273619Sbinkertn@umich.edu        dev/EtherLink.od
328955SN/A        dev/EtherTap.od
329955SN/A        dev/PioDevice.od
3302655Sstever@eecs.umich.edu        dev/RawDiskImage.od
3312655Sstever@eecs.umich.edu        dev/ScsiController.od
3323619Sbinkertn@umich.edu        dev/ScsiDevice.od
333955SN/A        dev/ScsiDisk.od
334955SN/A        dev/SimConsole.od
3352655Sstever@eecs.umich.edu        dev/SimpleDisk.od
3362655Sstever@eecs.umich.edu        dev/TlaserClock.od
3373683Sstever@eecs.umich.edu        dev/TlaserIpi.od
3382655Sstever@eecs.umich.edu        dev/TlaserMBox.od
3391869SN/A        dev/TlaserMC146818.od
3401869SN/A        dev/TlaserNode.od
341        dev/TlaserPciDev.od
342        dev/TlaserPcia.od
343        dev/TlaserSerial.od
344        dev/TlaserUart.od
345        dev/Turbolaser.od
346        kern/tru64/Tru64System.od
347        sim/System.od
348	''')
349
350# Syscall emulation (non-full-system) sources
351syscall_emulation_sources = Split('''
352	arch/alpha/alpha_common_syscall_emul.cc
353	arch/alpha/alpha_linux_process.cc
354	arch/alpha/alpha_tru64_process.cc
355	cpu/memtest/memtest.cc
356        cpu/trace/opt_cpu.cc
357	cpu/trace/trace_cpu.cc
358	eio/eio.cc
359	eio/exolex.cc
360	eio/libexo.cc
361	sim/process.cc
362	sim/syscall_emul.cc
363        ''')
364
365syscall_emulation_obj_desc_files = Split('''
366        cpu/memtest/MemTest.od
367        eio/EioProcess.od
368        sim/LiveProcess.od
369        sim/Process.od
370	''')
371
372targetarch_files = Split('''
373        alpha_common_syscall_emul.hh
374        alpha_linux_process.hh
375        alpha_memory.hh
376        alpha_tru64_process.hh
377        aout_machdep.h
378        arguments.hh
379        byte_swap.hh
380        ecoff_machdep.h
381        elf_machdep.h
382        ev5.hh
383        faults.hh
384        isa_fullsys_traits.hh
385        isa_traits.hh
386        machine_exo.h
387        osfpal.hh
388        pseudo_inst.hh
389        vptr.hh
390        vtophys.hh
391        ''')
392
393for f in targetarch_files:
394    env.Command('targetarch/' + f, 'arch/alpha/' + f,
395                '''echo '#include "arch/alpha/%s"' > $TARGET''' % f)
396
397
398# Set up complete list of sources based on configuration.
399sources = base_sources
400obj_desc_files = base_obj_desc_files
401
402if env['FULL_SYSTEM']:
403    sources += full_system_sources
404    obj_desc_files += full_system_obj_desc_files
405else:
406    sources += syscall_emulation_sources
407    obj_desc_files += syscall_emulation_obj_desc_files
408
409extra_libraries = []
410if env['USE_MYSQL']:
411    sources += mysql_sources
412    env.Append(CPPDEFINES = 'USE_MYSQL')
413    env.Append(CPPDEFINES = 'STATS_BINNING')
414    env.Append(CPPPATH=['/usr/local/include/mysql', '/usr/include/mysql'])
415    env.Append(LIBS=['z'])
416    if os.path.isdir('/usr/lib64'):
417        env.Append(LIBPATH=['/usr/lib64/mysql'])
418    else:
419        env.Append(LIBPATH=['/usr/lib/mysql/'])
420    env.Append(LIBS=['mysqlclient'])
421
422
423###################################################
424#
425# Special build rules.
426#
427###################################################
428
429# base/traceflags.{cc,hh} are generated from base/traceflags.py.
430# $TARGET.base will expand to "<build-dir>/base/traceflags".
431env.Command(Split('base/traceflags.hh base/traceflags.cc'),
432            'base/traceflags.py',
433            'python $SOURCE $TARGET.base')
434
435# several files are generated from arch/$TARGET_ISA/isa_desc.
436env.Command(Split('''arch/alpha/decoder.cc
437		     arch/alpha/decoder.hh
438		     arch/alpha/fast_cpu_exec.cc
439                     arch/alpha/simple_cpu_exec.cc
440                     arch/alpha/full_cpu_exec.cc'''),
441            Split('''arch/alpha/isa_desc
442		     arch/isa_parser.py'''),
443            '$SRCDIR/arch/isa_parser.py $SOURCE $TARGET.dir arch/alpha')
444
445
446# libelf build is described in its own SConscript file.
447# SConscript-local is the per-config build, which just copies some
448# header files into a place where they can be found.
449SConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
450
451SConscript('sim/pyconfig/SConscript', exports = ['env', 'obj_desc_files'],
452           duplicate=0)
453
454
455# This function adds the specified sources to the given build
456# environment, and returns a list of all the corresponding SCons
457# Object nodes (including an extra one for date.cc).  We explicitly
458# add the Object nodes so we can set up special dependencies for
459# date.cc.
460def make_objs(sources, env):
461    objs = [env.Object(s) for s in sources]
462    # make date.cc depend on all other objects so it always gets
463    # recompiled whenever anything else does
464    date_obj = env.Object('base/date.cc')
465    env.Depends(date_obj, objs)
466    objs.append(date_obj)
467    objs.extend(extra_libraries)
468    return objs
469
470###################################################
471#
472# Define binaries.  Each different build type (debug, opt, etc.) gets
473# a slightly different build environment.
474#
475###################################################
476
477# Include file paths are rooted in this directory.  SCons will
478# automatically expand '.' to refer to both the source directory and
479# the corresponding build directory to pick up generated include
480# files.
481env.Append(CPPPATH='.')
482
483# Debug binary
484debug = env.Copy(OBJSUFFIX='.do')
485debug.Append(CCFLAGS=Split('-g -gstabs+ -O0'))
486debug.Append(CPPDEFINES='DEBUG')
487debug.Program(target = 'm5.debug', source = make_objs(sources, debug))
488
489# Optimized binary
490opt = env.Copy()
491opt.Append(CCFLAGS=Split('-g -O5'))
492opt.Program(target = 'm5.opt', source = make_objs(sources, opt))
493
494# "Fast" binary
495fast = env.Copy(OBJSUFFIX='.fo')
496fast.Append(CCFLAGS=Split('-O5'))
497fast.Append(CPPDEFINES='NDEBUG')
498fast.Program(target = 'm5.fast.unstripped', source = make_objs(sources, fast))
499fast.Command(target = 'm5.fast', source = 'm5.fast.unstripped',
500             action = 'strip $SOURCE -o $TARGET')
501
502# Profiled binary
503prof = env.Copy(OBJSUFFIX='.po')
504prof.Append(CCFLAGS=Split('-O5 -g -pg'), LINKFLAGS='-pg')
505prof.Program(target = 'm5.prof', source = make_objs(sources, prof))
506