SConstruct revision 8113
14403Srdreslin@umich.edu# Copyright (c) 2011 Gabe Black 21693Sstever@eecs.umich.edu# All rights reserved. 31693Sstever@eecs.umich.edu# 41693Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 51693Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are 61693Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright 71693Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 81693Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 91693Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 101693Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution; 111693Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its 121693Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from 131693Sstever@eecs.umich.edu# this software without specific prior written permission. 141693Sstever@eecs.umich.edu# 151693Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 161693Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 171693Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 181693Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 191693Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 201693Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 211693Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 221693Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 231693Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 241693Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 251693Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 261693Sstever@eecs.umich.edu# 271693Sstever@eecs.umich.edu# Authors: Gabe Black 281693Sstever@eecs.umich.edu 293358Srdreslin@umich.eduHelp(''' 303358Srdreslin@umich.eduTo build a version of statetrace suitable to run on a particular ISA, use a 311516SN/Atarget of the form build/<arch>/statetrace. For example, to build statetrace 326654Snate@binkert.orgfor ARM binaries, run: 336654Snate@binkert.org 346654Snate@binkert.orgscons build/arm/statetrace 356654Snate@binkert.org 363358Srdreslin@umich.eduYou may need a cross compiler in order to build statetrace successfully. To 373358Srdreslin@umich.eduspecify an alternative compiler, set the CXX scons argument on the command 386654Snate@binkert.orgline. The CXX environment variable is NOT considered when selecting the 396654Snate@binkert.orgcompiler. To override the compiler for a particular target ISA, set the 401516SN/A<arch>CXX scons argument. For example, to build both the AMD64 version and 413358Srdreslin@umich.eduthe ARM version at the same time using the system compiler for the AMD64 423358Srdreslin@umich.eduversion and a cross compiler for arm, your command line would look like the 433358Srdreslin@umich.edufollowing: 443358Srdreslin@umich.edu 453358Srdreslin@umich.eduscons ARMCXX=arm-cross-g++ build/amd64/statetrace build/arm/statetrace 463358Srdreslin@umich.edu 473358Srdreslin@umich.eduAfter a successful build, the statetrace binary(binaries) will be located in 483358Srdreslin@umich.eduthe build/<arch>/ directories you specified on the command line. 493358Srdreslin@umich.edu''') 503358Srdreslin@umich.edu 513358Srdreslin@umich.edu 523358Srdreslin@umich.eduarches = 'amd64', 'arm', 'i386', 'sparc' 533360Srdreslin@umich.edu 543358Srdreslin@umich.eduimport os 553360Srdreslin@umich.edu 563360Srdreslin@umich.edumain = Environment() 573360Srdreslin@umich.edumain.SetOption('duplicate', 'soft-copy') 585255Ssaidi@eecs.umich.edumain['CXXFLAGS'] = "-O3 -ggdb $_CPPINCFLAGS" 593360Srdreslin@umich.edu 603360Srdreslin@umich.edumain['CXX'] = ARGUMENTS.get('CXX', main['CXX']) 613360Srdreslin@umich.edu 625255Ssaidi@eecs.umich.edufor arch in arches: 633358Srdreslin@umich.edu env = main.Clone() 644403Srdreslin@umich.edu env['CXX'] = ARGUMENTS.get(arch.upper() + 'CXX', env['CXX']) 653360Srdreslin@umich.edu env.Append(CPPFLAGS = '-D__STATETRACE_%s__' % arch.upper()) 663358Srdreslin@umich.edu Export('env', 'arch') 673358Srdreslin@umich.edu env.SConscript('SConscript', variant_dir = os.path.join('build', arch)) 683358Srdreslin@umich.edu