summaryrefslogtreecommitdiff
path: root/util/statetrace/SConstruct
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2011-03-02 22:53:11 -0800
committerGabe Black <gblack@eecs.umich.edu>2011-03-02 22:53:11 -0800
commiteab89a09d26fd39cdbb3ddd826465c8661403b89 (patch)
tree42dd7b2e69e909c08e437ba86c4c9bf3f8a3b63b /util/statetrace/SConstruct
parent9151c4039a6a113f77c9f6587a6fe0399ae19068 (diff)
downloadgem5-eab89a09d26fd39cdbb3ddd826465c8661403b89.tar.xz
Statetrace: Accomodate cross compiling statetrace with scons.
--HG-- rename : util/statetrace/arch/tracechild_amd64.cc => util/statetrace/arch/amd64/tracechild.cc rename : util/statetrace/arch/tracechild_amd64.hh => util/statetrace/arch/amd64/tracechild.hh rename : util/statetrace/arch/tracechild_arm.cc => util/statetrace/arch/arm/tracechild.cc rename : util/statetrace/arch/tracechild_arm.hh => util/statetrace/arch/arm/tracechild.hh rename : util/statetrace/arch/tracechild_i386.cc => util/statetrace/arch/i386/tracechild.cc rename : util/statetrace/arch/tracechild_i386.hh => util/statetrace/arch/i386/tracechild.hh rename : util/statetrace/arch/tracechild_sparc.cc => util/statetrace/arch/sparc/tracechild.cc rename : util/statetrace/arch/tracechild_sparc.hh => util/statetrace/arch/sparc/tracechild.hh rename : util/statetrace/tracechild_arch.cc => util/statetrace/base/arch_check.h rename : util/statetrace/regstate.hh => util/statetrace/base/regstate.hh rename : util/statetrace/statetrace.cc => util/statetrace/base/statetrace.cc rename : util/statetrace/tracechild.cc => util/statetrace/base/tracechild.cc rename : util/statetrace/tracechild.hh => util/statetrace/base/tracechild.hh
Diffstat (limited to 'util/statetrace/SConstruct')
-rw-r--r--util/statetrace/SConstruct43
1 files changed, 39 insertions, 4 deletions
diff --git a/util/statetrace/SConstruct b/util/statetrace/SConstruct
index de0eade6a..2e93162d8 100644
--- a/util/statetrace/SConstruct
+++ b/util/statetrace/SConstruct
@@ -26,7 +26,42 @@
#
# Authors: Gabe Black
-sources = ['statetrace.cc', 'tracechild.cc', 'tracechild_arch.cc']
-cxx_flags = "-O3 -ggdb -I ./ -I ./arch"
-objects = [Object(source, CXXFLAGS=cxx_flags) for source in sources]
-Program('statetrace', objects)
+Help('''
+To build a version of statetrace suitable to run on a particular ISA, use a
+target of the form build/<arch>/statetrace. For example, to build statetrace
+for ARM binaries, run:
+
+scons build/arm/statetrace
+
+You may need a cross compiler in order to build statetrace successfully. To
+specify an alternative compiler, set the CXX scons argument on the command
+line. The CXX environment variable is NOT considered when selecting the
+compiler. To override the compiler for a particular target ISA, set the
+<arch>CXX scons argument. For example, to build both the AMD64 version and
+the ARM version at the same time using the system compiler for the AMD64
+version and a cross compiler for arm, your command line would look like the
+following:
+
+scons ARMCXX=arm-cross-g++ build/amd64/statetrace build/arm/statetrace
+
+After a successful build, the statetrace binary(binaries) will be located in
+the build/<arch>/ directories you specified on the command line.
+''')
+
+
+arches = 'amd64', 'arm', 'i386', 'sparc'
+
+import os
+
+main = Environment()
+main.SetOption('duplicate', 'soft-copy')
+main['CXXFLAGS'] = "-O3 -ggdb $_CPPINCFLAGS"
+
+main['CXX'] = ARGUMENTS.get('CXX', main['CXX'])
+
+for arch in arches:
+ env = main.Clone()
+ env['CXX'] = ARGUMENTS.get(arch.upper() + 'CXX', env['CXX'])
+ env.Append(CPPFLAGS = '-D__STATETRACE_%s__' % arch.upper())
+ Export('env', 'arch')
+ env.SConscript('SConscript', variant_dir = os.path.join('build', arch))