summaryrefslogtreecommitdiff
path: root/util/statetrace/SConstruct
diff options
context:
space:
mode:
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))