Updated Authors from bk prs info
[gem5.git] / src / SConscript
index a2d5de2795b59dcc6786793aa05f5f707700c2a4..39e4b435a057eb9167d2a658b1f08c9e85d7009a 100644 (file)
@@ -25,6 +25,8 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Steve Reinhardt
 
 import os
 import sys
@@ -46,9 +48,7 @@ Import('env')
 
 base_sources = Split('''
        base/circlebuf.cc
-       base/copyright.cc
        base/cprintf.cc
-        base/embedfile.cc
        base/fast_alloc.cc
        base/fifo_buffer.cc
        base/hostinfo.cc
@@ -83,6 +83,7 @@ base_sources = Split('''
 
        cpu/base.cc
        cpu/cpu_exec_context.cc
+       cpu/cpuevent.cc
        cpu/exetrace.cc
         cpu/op_class.cc
        cpu/pc_event.cc
@@ -96,10 +97,6 @@ base_sources = Split('''
         mem/packet.cc
         mem/physical.cc
         mem/port.cc
-        mem/request.cc
-
-        python/pyconfig.cc
-        python/embedded_py.cc
 
        sim/builder.cc
        sim/configfile.cc
@@ -326,10 +323,6 @@ env.Command(Split('base/traceflags.hh base/traceflags.cc'),
             'base/traceflags.py',
             'python $SOURCE $TARGET.base')
 
-# libelf build is described in its own SConscript file.
-# SConscript-local is the per-config build, which just copies some
-# header files into a place where they can be found.
-SConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
 SConscript('python/SConscript', exports = ['env'], duplicate=0)
 
 # This function adds the specified sources to the given build
@@ -358,45 +351,46 @@ def make_objs(sources, env):
 # the corresponding build directory to pick up generated include
 # files.
 env.Append(CPPPATH='.')
-env.Append(CPPPATH='./libelf')
+
+# List of constructed environments to pass back to SConstruct
+envList = []
+
+# Function to create a new build environment as clone of current
+# environment 'env' with modified object suffix and optional stripped
+# binary.  Additional keyword arguments are appended to corresponding
+# build environment vars.
+def makeEnv(label, objsfx, strip = False, **kwargs):
+    newEnv = env.Copy(OBJSUFFIX=objsfx)
+    newEnv.Label = label
+    newEnv.Append(**kwargs)
+    exe = 'm5.' + label  # final executable
+    bin = exe + '.bin'   # executable w/o appended Python zip archive
+    newEnv.Program(bin, make_objs(sources, newEnv))
+    if strip:
+        stripped_bin = bin + '.stripped'
+        newEnv.Command(stripped_bin, bin, 'strip $SOURCE -o $TARGET')
+        bin = stripped_bin
+    targets = newEnv.Concat(exe, [bin, 'python/m5py.zip'])
+    newEnv.M5Binary = targets[0]
+    envList.append(newEnv)
 
 # Debug binary
-debugEnv = env.Copy(OBJSUFFIX='.do')
-debugEnv.Label = 'debug'
-debugEnv.Append(CCFLAGS=Split('-g3 -gdwarf-2 -O0'))
-debugEnv.Append(CPPDEFINES='DEBUG')
-tlist = debugEnv.Program(target = 'm5.debug',
-                         source = make_objs(sources, debugEnv))
-debugEnv.M5Binary = tlist[0]
+makeEnv('debug', '.do',
+        CCFLAGS = Split('-g3 -gdwarf-2 -O0'),
+        CPPDEFINES = 'DEBUG')
 
 # Optimized binary
-optEnv = env.Copy()
-optEnv.Label = 'opt'
-optEnv.Append(CCFLAGS=Split('-g -O3'))
-tlist = optEnv.Program(target = 'm5.opt',
-                       source = make_objs(sources, optEnv))
-optEnv.M5Binary = tlist[0]
+makeEnv('opt', '.o',
+        CCFLAGS = Split('-g -O3'))
 
 # "Fast" binary
-fastEnv = env.Copy(OBJSUFFIX='.fo')
-fastEnv.Label = 'fast'
-fastEnv.Append(CCFLAGS=Split('-O3'))
-fastEnv.Append(CPPDEFINES='NDEBUG')
-fastEnv.Program(target = 'm5.fast.unstripped',
-                source = make_objs(sources, fastEnv))
-tlist = fastEnv.Command(target = 'm5.fast',
-                        source = 'm5.fast.unstripped',
-                        action = 'strip $SOURCE -o $TARGET')
-fastEnv.M5Binary = tlist[0]
+makeEnv('fast', '.fo', strip = True,
+        CCFLAGS = Split('-O3'),
+        CPPDEFINES = 'NDEBUG')
 
 # Profiled binary
-profEnv = env.Copy(OBJSUFFIX='.po')
-profEnv.Label = 'prof'
-profEnv.Append(CCFLAGS=Split('-O3 -g -pg'), LINKFLAGS='-pg')
-tlist = profEnv.Program(target = 'm5.prof',
-                        source = make_objs(sources, profEnv))
-profEnv.M5Binary = tlist[0]
-
-envList = [debugEnv, optEnv, fastEnv, profEnv]
+makeEnv('prof', '.po',
+        CCFLAGS = Split('-O3 -g -pg'),
+        LINKFLAGS = '-pg')
 
 Return('envList')