SConstruct revision 12047
11689SN/A#!python
29444SAndreas.Sandberg@ARM.com
37854SAli.Saidi@ARM.com# Copyright (c) 2016, Dresden University of Technology (TU Dresden)
47854SAli.Saidi@ARM.com# All rights reserved.
57854SAli.Saidi@ARM.com#
67854SAli.Saidi@ARM.com# Redistribution and use in source and binary forms, with or without
77854SAli.Saidi@ARM.com# modification, are permitted provided that the following conditions are
87854SAli.Saidi@ARM.com# met:
97854SAli.Saidi@ARM.com#
107854SAli.Saidi@ARM.com# 1. Redistributions of source code must retain the above copyright notice,
117854SAli.Saidi@ARM.com#    this list of conditions and the following disclaimer.
127854SAli.Saidi@ARM.com#
137854SAli.Saidi@ARM.com# 2. Redistributions in binary form must reproduce the above copyright
142329SN/A#    notice, this list of conditions and the following disclaimer in the
151689SN/A#    documentation and/or other materials provided with the distribution.
161689SN/A#
171689SN/A# 3. Neither the name of the copyright holder nor the names of its
181689SN/A#    contributors may be used to endorse or promote products derived from
191689SN/A#    this software without specific prior written permission.
201689SN/A#
211689SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
221689SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
231689SN/A# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
241689SN/A# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
251689SN/A# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
261689SN/A# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
271689SN/A# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
281689SN/A# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
291689SN/A# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
301689SN/A# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
311689SN/A# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
321689SN/A#
331689SN/A# Authors: Christian Menard
341689SN/A
351689SN/Aimport os
361689SN/Aimport sys
371689SN/A
381689SN/A
392665Ssaidi@eecs.umich.edugem5_arch = 'ARM'
402665Ssaidi@eecs.umich.edugem5_variant = 'opt'
412935Sksewell@umich.edu#gem5_variant = 'debug'
421689SN/A
431689SN/Agem5_root = Dir('#../..').srcnode().abspath
441060SN/A
451060SN/Aenv = Environment()
463773Sgblack@eecs.umich.edu
476329Sgblack@eecs.umich.edu#Make the gem5 root available in SConscripts
486658Snate@binkert.orgenv['GEM5_ROOT'] = gem5_root
491717SN/A
508232Snate@binkert.orgshlibsuffix = env['SHLIBSUFFIX']
518232Snate@binkert.org
525529Snate@binkert.org# add include dirs
531060SN/Aenv.Append(CPPPATH=[gem5_root + '/build/' + gem5_arch,
546221Snate@binkert.org                    gem5_root + '/util/systemc',
556221Snate@binkert.org                    gem5_root + '/ext/systemc/src',
561061SN/A                    '#src',
575529Snate@binkert.org                    '#examples/common',
584329Sktlim@umich.edu                    ])
594329Sktlim@umich.edu
602292SN/Aenv.Append(CXXFLAGS=['-std=c++11',
612292SN/A                     '-DSC_INCLUDE_DYNAMIC_PROCESSES',
622292SN/A                     '-DTRACING_ON',
632292SN/A                     ])
645529Snate@binkert.org
652361SN/Aif gem5_variant == 'debug':
661060SN/A    env.Append(CXXFLAGS=['-g', '-DDEBUG'])
672292SN/A
688907Slukefahr@umich.edudeps = [] # keep track of all dependencies required for building the binaries
692292SN/A
702292SN/Adeps += SConscript('src/SConscript', variant_dir='build/tlm', exports='env')
712292SN/A
722292SN/Adeps += SConscript('examples/common/SConscript',
732292SN/A                   variant_dir='build/examples/common',
742292SN/A                   exports=['env'])
752292SN/A
761060SN/A# the SystemC SConscript makes certain assumptions, we need to fulfill these
771060SN/A# assumptions before calling the SConscript.
781061SN/Amain = env
791060SN/Asys.path.append(gem5_root + '/src/python')
802292SN/AAddOption('--no-colors', dest='use_colors', action='store_false',
811062SN/A          help="Don't add color to abbreviated scons output")
821062SN/A
838240Snate@binkert.orgSConscript(gem5_root + '/ext/systemc/SConscript',
841062SN/A           variant_dir='build/systemc',
851062SN/A           exports='main')
861062SN/A
878240Snate@binkert.org# By adding libraries as dependencies instead of using LIBS, we avoid that
881062SN/A# the user needs to set the LD_LIBRARY_PATH
891062SN/Adeps.append(File('build/systemc/libsystemc' + shlibsuffix))
901062SN/Adeps.append(File(os.path.join(gem5_root, 'build', gem5_arch,
918240Snate@binkert.org             'libgem5_' + gem5_variant + shlibsuffix)))
921062SN/A
931062SN/Aex_master = SConscript('examples/master_port/SConscript',
942301SN/A                       variant_dir='build/examples/master_port',
958240Snate@binkert.org                       exports=['env', 'deps'])
962301SN/A
972301SN/Aex_slave = SConscript('examples/slave_port/SConscript',
982292SN/A                      variant_dir='build/examples/slave_port',
998240Snate@binkert.org                      exports=['env', 'deps'])
1002292SN/A
1012292SN/ADefault(ex_master + ex_slave)
1021062SN/A