SConstruct revision 12047
112047Schristian.menard@tu-dresden.de#!python
212047Schristian.menard@tu-dresden.de
312047Schristian.menard@tu-dresden.de# Copyright (c) 2016, Dresden University of Technology (TU Dresden)
412047Schristian.menard@tu-dresden.de# All rights reserved.
512047Schristian.menard@tu-dresden.de#
612047Schristian.menard@tu-dresden.de# Redistribution and use in source and binary forms, with or without
712047Schristian.menard@tu-dresden.de# modification, are permitted provided that the following conditions are
812047Schristian.menard@tu-dresden.de# met:
912047Schristian.menard@tu-dresden.de#
1012047Schristian.menard@tu-dresden.de# 1. Redistributions of source code must retain the above copyright notice,
1112047Schristian.menard@tu-dresden.de#    this list of conditions and the following disclaimer.
1212047Schristian.menard@tu-dresden.de#
1312047Schristian.menard@tu-dresden.de# 2. Redistributions in binary form must reproduce the above copyright
1412047Schristian.menard@tu-dresden.de#    notice, this list of conditions and the following disclaimer in the
1512047Schristian.menard@tu-dresden.de#    documentation and/or other materials provided with the distribution.
1612047Schristian.menard@tu-dresden.de#
1712047Schristian.menard@tu-dresden.de# 3. Neither the name of the copyright holder nor the names of its
1812047Schristian.menard@tu-dresden.de#    contributors may be used to endorse or promote products derived from
1912047Schristian.menard@tu-dresden.de#    this software without specific prior written permission.
2012047Schristian.menard@tu-dresden.de#
2112047Schristian.menard@tu-dresden.de# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2212047Schristian.menard@tu-dresden.de# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2312047Schristian.menard@tu-dresden.de# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2412047Schristian.menard@tu-dresden.de# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
2512047Schristian.menard@tu-dresden.de# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2612047Schristian.menard@tu-dresden.de# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2712047Schristian.menard@tu-dresden.de# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2812047Schristian.menard@tu-dresden.de# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
2912047Schristian.menard@tu-dresden.de# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
3012047Schristian.menard@tu-dresden.de# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3112047Schristian.menard@tu-dresden.de# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3212047Schristian.menard@tu-dresden.de#
3312047Schristian.menard@tu-dresden.de# Authors: Christian Menard
3412047Schristian.menard@tu-dresden.de
3512047Schristian.menard@tu-dresden.deimport os
3612047Schristian.menard@tu-dresden.deimport sys
3712047Schristian.menard@tu-dresden.de
3812047Schristian.menard@tu-dresden.de
3912047Schristian.menard@tu-dresden.degem5_arch = 'ARM'
4012047Schristian.menard@tu-dresden.degem5_variant = 'opt'
4112047Schristian.menard@tu-dresden.de#gem5_variant = 'debug'
4212047Schristian.menard@tu-dresden.de
4312047Schristian.menard@tu-dresden.degem5_root = Dir('#../..').srcnode().abspath
4412047Schristian.menard@tu-dresden.de
4512047Schristian.menard@tu-dresden.deenv = Environment()
4612047Schristian.menard@tu-dresden.de
4712047Schristian.menard@tu-dresden.de#Make the gem5 root available in SConscripts
4812047Schristian.menard@tu-dresden.deenv['GEM5_ROOT'] = gem5_root
4912047Schristian.menard@tu-dresden.de
5012047Schristian.menard@tu-dresden.deshlibsuffix = env['SHLIBSUFFIX']
5112047Schristian.menard@tu-dresden.de
5212047Schristian.menard@tu-dresden.de# add include dirs
5312047Schristian.menard@tu-dresden.deenv.Append(CPPPATH=[gem5_root + '/build/' + gem5_arch,
5412047Schristian.menard@tu-dresden.de                    gem5_root + '/util/systemc',
5512047Schristian.menard@tu-dresden.de                    gem5_root + '/ext/systemc/src',
5612047Schristian.menard@tu-dresden.de                    '#src',
5712047Schristian.menard@tu-dresden.de                    '#examples/common',
5812047Schristian.menard@tu-dresden.de                    ])
5912047Schristian.menard@tu-dresden.de
6012047Schristian.menard@tu-dresden.deenv.Append(CXXFLAGS=['-std=c++11',
6112047Schristian.menard@tu-dresden.de                     '-DSC_INCLUDE_DYNAMIC_PROCESSES',
6212047Schristian.menard@tu-dresden.de                     '-DTRACING_ON',
6312047Schristian.menard@tu-dresden.de                     ])
6412047Schristian.menard@tu-dresden.de
6512047Schristian.menard@tu-dresden.deif gem5_variant == 'debug':
6612047Schristian.menard@tu-dresden.de    env.Append(CXXFLAGS=['-g', '-DDEBUG'])
6712047Schristian.menard@tu-dresden.de
6812047Schristian.menard@tu-dresden.dedeps = [] # keep track of all dependencies required for building the binaries
6912047Schristian.menard@tu-dresden.de
7012047Schristian.menard@tu-dresden.dedeps += SConscript('src/SConscript', variant_dir='build/tlm', exports='env')
7112047Schristian.menard@tu-dresden.de
7212047Schristian.menard@tu-dresden.dedeps += SConscript('examples/common/SConscript',
7312047Schristian.menard@tu-dresden.de                   variant_dir='build/examples/common',
7412047Schristian.menard@tu-dresden.de                   exports=['env'])
7512047Schristian.menard@tu-dresden.de
7612047Schristian.menard@tu-dresden.de# the SystemC SConscript makes certain assumptions, we need to fulfill these
7712047Schristian.menard@tu-dresden.de# assumptions before calling the SConscript.
7812047Schristian.menard@tu-dresden.demain = env
7912047Schristian.menard@tu-dresden.desys.path.append(gem5_root + '/src/python')
8012047Schristian.menard@tu-dresden.deAddOption('--no-colors', dest='use_colors', action='store_false',
8112047Schristian.menard@tu-dresden.de          help="Don't add color to abbreviated scons output")
8212047Schristian.menard@tu-dresden.de
8312047Schristian.menard@tu-dresden.deSConscript(gem5_root + '/ext/systemc/SConscript',
8412047Schristian.menard@tu-dresden.de           variant_dir='build/systemc',
8512047Schristian.menard@tu-dresden.de           exports='main')
8612047Schristian.menard@tu-dresden.de
8712047Schristian.menard@tu-dresden.de# By adding libraries as dependencies instead of using LIBS, we avoid that
8812047Schristian.menard@tu-dresden.de# the user needs to set the LD_LIBRARY_PATH
8912047Schristian.menard@tu-dresden.dedeps.append(File('build/systemc/libsystemc' + shlibsuffix))
9012047Schristian.menard@tu-dresden.dedeps.append(File(os.path.join(gem5_root, 'build', gem5_arch,
9112047Schristian.menard@tu-dresden.de             'libgem5_' + gem5_variant + shlibsuffix)))
9212047Schristian.menard@tu-dresden.de
9312047Schristian.menard@tu-dresden.deex_master = SConscript('examples/master_port/SConscript',
9412047Schristian.menard@tu-dresden.de                       variant_dir='build/examples/master_port',
9512047Schristian.menard@tu-dresden.de                       exports=['env', 'deps'])
9612047Schristian.menard@tu-dresden.de
9712047Schristian.menard@tu-dresden.deex_slave = SConscript('examples/slave_port/SConscript',
9812047Schristian.menard@tu-dresden.de                      variant_dir='build/examples/slave_port',
9912047Schristian.menard@tu-dresden.de                      exports=['env', 'deps'])
10012047Schristian.menard@tu-dresden.de
10112047Schristian.menard@tu-dresden.deDefault(ex_master + ex_slave)
102