SConstruct revision 8113
113540Sandrea.mondelli@ucf.edu# Copyright (c) 2011 Gabe Black
24130Ssaidi@eecs.umich.edu# All rights reserved.
31897Sstever@eecs.umich.edu#
41897Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
51897Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are
61897Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright
71897Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
81897Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
91897Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
101897Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution;
111897Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its
121897Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from
131897Sstever@eecs.umich.edu# this software without specific prior written permission.
141897Sstever@eecs.umich.edu#
151897Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
161897Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
171897Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
181897Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
191897Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
201897Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
211897Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
221897Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
231897Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
241897Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
251897Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
261897Sstever@eecs.umich.edu#
271897Sstever@eecs.umich.edu# Authors: Gabe Black
281897Sstever@eecs.umich.edu
291897Sstever@eecs.umich.eduHelp('''
301897Sstever@eecs.umich.eduTo build a version of statetrace suitable to run on a particular ISA, use a
311897Sstever@eecs.umich.edutarget of the form build/<arch>/statetrace. For example, to build statetrace
321897Sstever@eecs.umich.edufor ARM binaries, run:
331897Sstever@eecs.umich.edu
344961Ssaidi@eecs.umich.eduscons build/arm/statetrace
351897Sstever@eecs.umich.edu
361897Sstever@eecs.umich.eduYou may need a cross compiler in order to build statetrace successfully. To
371897Sstever@eecs.umich.eduspecify an alternative compiler, set the CXX scons argument on the command
381897Sstever@eecs.umich.eduline. The CXX environment variable is NOT considered when selecting the 
397047Snate@binkert.orgcompiler. To override the compiler for a particular target ISA, set the
408319Ssteve.reinhardt@amd.com<arch>CXX scons argument. For example, to build both the AMD64 version and
417047Snate@binkert.orgthe ARM version at the same time using the system compiler for the AMD64
428319Ssteve.reinhardt@amd.comversion and a cross compiler for arm, your command line would look like the
4311706Sandreas.hansson@arm.comfollowing:
448811Sandreas.hansson@arm.com
459850Sandreas.hansson@arm.comscons ARMCXX=arm-cross-g++ build/amd64/statetrace build/arm/statetrace
4611706Sandreas.hansson@arm.com
4711706Sandreas.hansson@arm.comAfter a successful build, the statetrace binary(binaries) will be located in
4811706Sandreas.hansson@arm.comthe build/<arch>/ directories you specified on the command line.
4911706Sandreas.hansson@arm.com''')
508811Sandreas.hansson@arm.com
518811Sandreas.hansson@arm.com
5210007Snilay@cs.wisc.eduarches = 'amd64', 'arm', 'i386', 'sparc'
5311308Santhony.gutierrez@amd.com
5411730Sar4jc@virginia.eduimport os
5511308Santhony.gutierrez@amd.com
567047Snate@binkert.orgmain = Environment()
578811Sandreas.hansson@arm.commain.SetOption('duplicate', 'soft-copy')
588811Sandreas.hansson@arm.commain['CXXFLAGS'] = "-O3 -ggdb $_CPPINCFLAGS"
598811Sandreas.hansson@arm.com
608319Ssteve.reinhardt@amd.commain['CXX'] = ARGUMENTS.get('CXX', main['CXX'])
618319Ssteve.reinhardt@amd.com
628319Ssteve.reinhardt@amd.comfor arch in arches:
638319Ssteve.reinhardt@amd.com    env = main.Clone()
648319Ssteve.reinhardt@amd.com    env['CXX'] = ARGUMENTS.get(arch.upper() + 'CXX', env['CXX'])
658319Ssteve.reinhardt@amd.com    env.Append(CPPFLAGS = '-D__STATETRACE_%s__' % arch.upper())
668319Ssteve.reinhardt@amd.com    Export('env', 'arch')
677047Snate@binkert.org    env.SConscript('SConscript', variant_dir = os.path.join('build', arch))
688319Ssteve.reinhardt@amd.com