3 # Copyright (c) 2016, Dresden University of Technology (TU Dresden)
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are
10 # 1. Redistributions of source code must retain the above copyright notice,
11 # this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # 3. Neither the name of the copyright holder nor the names of its
18 # contributors may be used to endorse or promote products derived from
19 # this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
25 # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #gem5_variant = 'debug'
41 gem5_root
= Dir('#../..').srcnode().abspath
45 #Make the gem5 root available in SConscripts
46 env
['GEM5_ROOT'] = gem5_root
48 shlibsuffix
= env
['SHLIBSUFFIX']
51 env
.Append(CPPPATH
=[gem5_root
+ '/build/' + gem5_arch
,
52 gem5_root
+ '/util/systemc/gem5_within_systemc',
53 gem5_root
+ '/ext/systemc/src',
58 env
.Append(CXXFLAGS
=['-std=c++11',
59 '-DSC_INCLUDE_DYNAMIC_PROCESSES',
63 if gem5_variant
== 'debug':
64 env
.Append(CXXFLAGS
=['-g', '-DDEBUG'])
66 deps
= [] # keep track of all dependencies required for building the binaries
68 deps
+= SConscript('src/SConscript', variant_dir
='build/tlm', exports
='env')
70 deps
+= SConscript('examples/common/SConscript',
71 variant_dir
='build/examples/common',
74 # the SystemC SConscript makes certain assumptions, we need to fulfill these
75 # assumptions before calling the SConscript.
77 sys
.path
.append(gem5_root
+ '/src/python')
78 AddOption('--no-colors', dest
='use_colors', action
='store_false',
79 help="Don't add color to abbreviated scons output")
81 SConscript(gem5_root
+ '/ext/systemc/SConscript',
82 variant_dir
='build/systemc',
85 # By adding libraries as dependencies instead of using LIBS, we avoid that
86 # the user needs to set the LD_LIBRARY_PATH
87 deps
.append(File('build/systemc/libsystemc' + shlibsuffix
))
88 deps
.append(File(os
.path
.join(gem5_root
, 'build', gem5_arch
,
89 'libgem5_' + gem5_variant
+ shlibsuffix
)))
91 ex_master
= SConscript('examples/master_port/SConscript',
92 variant_dir
='build/examples/master_port',
93 exports
=['env', 'deps'])
95 ex_slave
= SConscript('examples/slave_port/SConscript',
96 variant_dir
='build/examples/slave_port',
97 exports
=['env', 'deps'])
99 Default(ex_master
+ ex_slave
)