SConstruct revision 8117
15529Snate@binkert.org# Copyright (c) 2011 Gabe Black 25529Snate@binkert.org# All rights reserved. 35529Snate@binkert.org# 45529Snate@binkert.org# Redistribution and use in source and binary forms, with or without 55529Snate@binkert.org# modification, are permitted provided that the following conditions are 65529Snate@binkert.org# met: redistributions of source code must retain the above copyright 75529Snate@binkert.org# notice, this list of conditions and the following disclaimer; 85529Snate@binkert.org# redistributions in binary form must reproduce the above copyright 95529Snate@binkert.org# notice, this list of conditions and the following disclaimer in the 105529Snate@binkert.org# documentation and/or other materials provided with the distribution; 115529Snate@binkert.org# neither the name of the copyright holders nor the names of its 125529Snate@binkert.org# contributors may be used to endorse or promote products derived from 135529Snate@binkert.org# this software without specific prior written permission. 145529Snate@binkert.org# 155529Snate@binkert.org# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 165529Snate@binkert.org# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 175529Snate@binkert.org# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 185529Snate@binkert.org# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 195529Snate@binkert.org# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 205529Snate@binkert.org# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 215529Snate@binkert.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 225529Snate@binkert.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 235529Snate@binkert.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 245529Snate@binkert.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 255529Snate@binkert.org# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 265529Snate@binkert.org# 275529Snate@binkert.org# Authors: Gabe Black 285529Snate@binkert.org 295529Snate@binkert.orgHelp(''' 305529Snate@binkert.orgTo build a version of statetrace suitable to run on a particular ISA, use a 315529Snate@binkert.orgtarget of the form build/<arch>/statetrace. For example, to build statetrace 325529Snate@binkert.orgfor ARM binaries, run: 335529Snate@binkert.org 345529Snate@binkert.orgscons build/arm/statetrace 35 36You may need a cross compiler in order to build statetrace successfully. To 37specify an alternative compiler, set the CXX scons argument on the command 38line. The CXX environment variable is NOT considered when selecting the 39compiler. To override the compiler for a particular target ISA, set the 40<arch>CXX scons argument. For example, to build both the AMD64 version and 41the ARM version at the same time using the system compiler for the AMD64 42version and a cross compiler for arm, your command line would look like the 43following: 44 45scons ARMCXX=arm-cross-g++ build/amd64/statetrace build/arm/statetrace 46 47After a successful build, the statetrace binary(binaries) will be located in 48the build/<arch>/ directories you specified on the command line. 49''') 50 51 52arches = 'amd64', 'arm', 'i686', 'sparc' 53 54import os 55 56main = Environment() 57main.SetOption('duplicate', 'soft-copy') 58main['CXXFLAGS'] = "-O3 -ggdb $_CPPINCFLAGS" 59 60main['CXX'] = ARGUMENTS.get('CXX', main['CXX']) 61 62for arch in arches: 63 env = main.Clone() 64 env['CXX'] = ARGUMENTS.get(arch.upper() + 'CXX', env['CXX']) 65 env.Append(CPPFLAGS = '-D__STATETRACE_%s__' % arch.upper()) 66 Export('env', 'arch') 67 env.SConscript('SConscript', variant_dir = os.path.join('build', arch)) 68