default.py revision 12244:33af7397d081
12929Sktlim@umich.edu# Copyright (c) 2013, 2015-2017 ARM Limited 22929Sktlim@umich.edu# All rights reserved. 32932Sktlim@umich.edu# 42929Sktlim@umich.edu# The license below extends only to copyright in the software and shall 52929Sktlim@umich.edu# not be construed as granting a license to any other intellectual 62929Sktlim@umich.edu# property including but not limited to intellectual property relating 72929Sktlim@umich.edu# to a hardware implementation of the functionality of the software 82929Sktlim@umich.edu# licensed hereunder. You may use the software subject to the license 92929Sktlim@umich.edu# terms below provided that you ensure that this notice is replicated 102929Sktlim@umich.edu# unmodified and in its entirety in all distributions of the software, 112929Sktlim@umich.edu# modified or unmodified, in source code or in binary form. 122929Sktlim@umich.edu# 132929Sktlim@umich.edu# Copyright (c) 2011 Advanced Micro Devices, Inc. 142929Sktlim@umich.edu# Copyright (c) 2009 The Hewlett-Packard Development Company 152929Sktlim@umich.edu# Copyright (c) 2004-2005 The Regents of The University of Michigan 162929Sktlim@umich.edu# All rights reserved. 172929Sktlim@umich.edu# 182929Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without 192929Sktlim@umich.edu# modification, are permitted provided that the following conditions are 202929Sktlim@umich.edu# met: redistributions of source code must retain the above copyright 212929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer; 222929Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright 232929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the 242929Sktlim@umich.edu# documentation and/or other materials provided with the distribution; 252929Sktlim@umich.edu# neither the name of the copyright holders nor the names of its 262929Sktlim@umich.edu# contributors may be used to endorse or promote products derived from 272929Sktlim@umich.edu# this software without specific prior written permission. 282932Sktlim@umich.edu# 292932Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 302932Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 312929Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 326007Ssteve.reinhardt@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 337735SAli.Saidi@ARM.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 342929Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 352929Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 362929Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 372929Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 382929Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 392929Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 402929Sktlim@umich.edu 418947Sandreas.hansson@arm.comimport os 428947Sandreas.hansson@arm.com 438947Sandreas.hansson@arm.comimport SCons.Tool 442929Sktlim@umich.eduimport SCons.Tool.default 452929Sktlim@umich.edu 462929Sktlim@umich.edudef common_config(env): 472929Sktlim@umich.edu # export TERM so that clang reports errors in color 482929Sktlim@umich.edu use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH', 492929Sktlim@umich.edu 'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC', 506007Ssteve.reinhardt@amd.com 'PYTHONPATH', 'RANLIB', 'TERM' ]) 516007Ssteve.reinhardt@amd.com 526007Ssteve.reinhardt@amd.com use_prefixes = [ 536007Ssteve.reinhardt@amd.com "ASAN_", # address sanitizer symbolizer path and settings 546007Ssteve.reinhardt@amd.com "CCACHE_", # ccache (caching compiler wrapper) configuration 556007Ssteve.reinhardt@amd.com "CCC_", # clang static analyzer configuration 566007Ssteve.reinhardt@amd.com "DISTCC_", # distcc (distributed compiler wrapper) config 576007Ssteve.reinhardt@amd.com "INCLUDE_SERVER_", # distcc pump server settings 586007Ssteve.reinhardt@amd.com "M5", # M5 configuration (e.g., path to kernels) 596007Ssteve.reinhardt@amd.com ] 606007Ssteve.reinhardt@amd.com 616007Ssteve.reinhardt@amd.com for key,val in sorted(os.environ.iteritems()): 626007Ssteve.reinhardt@amd.com if key in use_vars or \ 636007Ssteve.reinhardt@amd.com any([key.startswith(prefix) for prefix in use_prefixes]): 646007Ssteve.reinhardt@amd.com env[key] = val 656007Ssteve.reinhardt@amd.com 669435SAndreas.Sandberg@ARM.com # Tell scons to avoid implicit command dependencies to avoid issues 679435SAndreas.Sandberg@ARM.com # with the param wrappes being compiled twice (see 689435SAndreas.Sandberg@ARM.com # http://scons.tigris.org/issues/show_bug.cgi?id=2811) 696007Ssteve.reinhardt@amd.com env['IMPLICIT_COMMAND_DEPENDENCIES'] = 0 706007Ssteve.reinhardt@amd.com env.Decider('MD5-timestamp') 716007Ssteve.reinhardt@amd.com env.root = env.Dir('#') 726007Ssteve.reinhardt@amd.com env.srcdir = env.root.Dir('src') 736007Ssteve.reinhardt@amd.com 746007Ssteve.reinhardt@amd.comgem5_tool_list = [ 756007Ssteve.reinhardt@amd.com 'git', 766007Ssteve.reinhardt@amd.com 'mercurial', 776007Ssteve.reinhardt@amd.com] 786007Ssteve.reinhardt@amd.com 792929Sktlim@umich.edudef generate(env): 802929Sktlim@umich.edu common_config(env) 812929Sktlim@umich.edu SCons.Tool.default.generate(env) 826007Ssteve.reinhardt@amd.com for tool in gem5_tool_list: 836007Ssteve.reinhardt@amd.com SCons.Tool.Tool(tool)(env) 846007Ssteve.reinhardt@amd.com 859781Sandreas.hansson@arm.comdef exists(env): 866007Ssteve.reinhardt@amd.com return 1 876007Ssteve.reinhardt@amd.com