SConstruct revision 12047
1955SN/A#!python 2955SN/A 31762SN/A# Copyright (c) 2016, Dresden University of Technology (TU Dresden) 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: 9955SN/A# 10955SN/A# 1. Redistributions of source code must retain the above copyright notice, 11955SN/A# this list of conditions and the following disclaimer. 12955SN/A# 13955SN/A# 2. Redistributions in binary form must reproduce the above copyright 14955SN/A# notice, this list of conditions and the following disclaimer in the 15955SN/A# documentation and/or other materials provided with the distribution. 16955SN/A# 17955SN/A# 3. Neither the name of the copyright holder nor the names of its 18955SN/A# contributors may be used to endorse or promote products derived from 19955SN/A# this software without specific prior written permission. 20955SN/A# 21955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 23955SN/A# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24955SN/A# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 25955SN/A# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26955SN/A# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27955SN/A# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 282665Ssaidi@eecs.umich.edu# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 292665Ssaidi@eecs.umich.edu# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30955SN/A# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31955SN/A# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32955SN/A# 33955SN/A# Authors: Christian Menard 34955SN/A 352632Sstever@eecs.umich.eduimport os 362632Sstever@eecs.umich.eduimport sys 372632Sstever@eecs.umich.edu 382632Sstever@eecs.umich.edu 39955SN/Agem5_arch = 'ARM' 402632Sstever@eecs.umich.edugem5_variant = 'opt' 412632Sstever@eecs.umich.edu#gem5_variant = 'debug' 422761Sstever@eecs.umich.edu 432632Sstever@eecs.umich.edugem5_root = Dir('#../..').srcnode().abspath 442632Sstever@eecs.umich.edu 452632Sstever@eecs.umich.eduenv = Environment() 462761Sstever@eecs.umich.edu 472761Sstever@eecs.umich.edu#Make the gem5 root available in SConscripts 482761Sstever@eecs.umich.eduenv['GEM5_ROOT'] = gem5_root 492632Sstever@eecs.umich.edu 502632Sstever@eecs.umich.edushlibsuffix = env['SHLIBSUFFIX'] 512761Sstever@eecs.umich.edu 522761Sstever@eecs.umich.edu# add include dirs 532761Sstever@eecs.umich.eduenv.Append(CPPPATH=[gem5_root + '/build/' + gem5_arch, 542761Sstever@eecs.umich.edu gem5_root + '/util/systemc', 552761Sstever@eecs.umich.edu gem5_root + '/ext/systemc/src', 562632Sstever@eecs.umich.edu '#src', 572632Sstever@eecs.umich.edu '#examples/common', 582632Sstever@eecs.umich.edu ]) 592632Sstever@eecs.umich.edu 602632Sstever@eecs.umich.eduenv.Append(CXXFLAGS=['-std=c++11', 612632Sstever@eecs.umich.edu '-DSC_INCLUDE_DYNAMIC_PROCESSES', 622632Sstever@eecs.umich.edu '-DTRACING_ON', 63955SN/A ]) 64955SN/A 65955SN/Aif gem5_variant == 'debug': 66955SN/A env.Append(CXXFLAGS=['-g', '-DDEBUG']) 67955SN/A 68955SN/Adeps = [] # keep track of all dependencies required for building the binaries 69955SN/A 702656Sstever@eecs.umich.edudeps += SConscript('src/SConscript', variant_dir='build/tlm', exports='env') 712656Sstever@eecs.umich.edu 722656Sstever@eecs.umich.edudeps += SConscript('examples/common/SConscript', 732656Sstever@eecs.umich.edu variant_dir='build/examples/common', 742656Sstever@eecs.umich.edu exports=['env']) 752656Sstever@eecs.umich.edu 762656Sstever@eecs.umich.edu# the SystemC SConscript makes certain assumptions, we need to fulfill these 772653Sstever@eecs.umich.edu# assumptions before calling the SConscript. 782653Sstever@eecs.umich.edumain = env 792653Sstever@eecs.umich.edusys.path.append(gem5_root + '/src/python') 802653Sstever@eecs.umich.eduAddOption('--no-colors', dest='use_colors', action='store_false', 812653Sstever@eecs.umich.edu help="Don't add color to abbreviated scons output") 822653Sstever@eecs.umich.edu 832653Sstever@eecs.umich.eduSConscript(gem5_root + '/ext/systemc/SConscript', 842653Sstever@eecs.umich.edu variant_dir='build/systemc', 852653Sstever@eecs.umich.edu exports='main') 862653Sstever@eecs.umich.edu 872653Sstever@eecs.umich.edu# By adding libraries as dependencies instead of using LIBS, we avoid that 881852SN/A# the user needs to set the LD_LIBRARY_PATH 89955SN/Adeps.append(File('build/systemc/libsystemc' + shlibsuffix)) 90955SN/Adeps.append(File(os.path.join(gem5_root, 'build', gem5_arch, 91955SN/A 'libgem5_' + gem5_variant + shlibsuffix))) 922632Sstever@eecs.umich.edu 932632Sstever@eecs.umich.eduex_master = SConscript('examples/master_port/SConscript', 94955SN/A variant_dir='build/examples/master_port', 951533SN/A exports=['env', 'deps']) 962632Sstever@eecs.umich.edu 971533SN/Aex_slave = SConscript('examples/slave_port/SConscript', 98955SN/A variant_dir='build/examples/slave_port', 99955SN/A exports=['env', 'deps']) 1002632Sstever@eecs.umich.edu 1012632Sstever@eecs.umich.eduDefault(ex_master + ex_slave) 102955SN/A