default.py revision 12282
112243Sgabeblack@google.com# Copyright (c) 2013, 2015-2017 ARM Limited 212243Sgabeblack@google.com# All rights reserved. 312243Sgabeblack@google.com# 412243Sgabeblack@google.com# The license below extends only to copyright in the software and shall 512243Sgabeblack@google.com# not be construed as granting a license to any other intellectual 612243Sgabeblack@google.com# property including but not limited to intellectual property relating 712243Sgabeblack@google.com# to a hardware implementation of the functionality of the software 812243Sgabeblack@google.com# licensed hereunder. You may use the software subject to the license 912243Sgabeblack@google.com# terms below provided that you ensure that this notice is replicated 1012243Sgabeblack@google.com# unmodified and in its entirety in all distributions of the software, 1112243Sgabeblack@google.com# modified or unmodified, in source code or in binary form. 1212243Sgabeblack@google.com# 1312243Sgabeblack@google.com# Copyright (c) 2011 Advanced Micro Devices, Inc. 1412243Sgabeblack@google.com# Copyright (c) 2009 The Hewlett-Packard Development Company 1512243Sgabeblack@google.com# Copyright (c) 2004-2005 The Regents of The University of Michigan 1612243Sgabeblack@google.com# All rights reserved. 1712243Sgabeblack@google.com# 1812243Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without 1912243Sgabeblack@google.com# modification, are permitted provided that the following conditions are 2012243Sgabeblack@google.com# met: redistributions of source code must retain the above copyright 2112243Sgabeblack@google.com# notice, this list of conditions and the following disclaimer; 2212243Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright 2312243Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the 2412243Sgabeblack@google.com# documentation and/or other materials provided with the distribution; 2512243Sgabeblack@google.com# neither the name of the copyright holders nor the names of its 2612243Sgabeblack@google.com# contributors may be used to endorse or promote products derived from 2712243Sgabeblack@google.com# this software without specific prior written permission. 2812243Sgabeblack@google.com# 2912243Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3012243Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3112243Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3212243Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3312243Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3412243Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3512243Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3612243Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3712243Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3812243Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3912243Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4012243Sgabeblack@google.com 4112243Sgabeblack@google.comimport os 4212245Sgabeblack@google.comimport sys 4312243Sgabeblack@google.com 4412243Sgabeblack@google.comimport SCons.Tool 4512243Sgabeblack@google.comimport SCons.Tool.default 4612243Sgabeblack@google.com 4712245Sgabeblack@google.comfrom gem5_python_paths import extra_python_paths 4812245Sgabeblack@google.com 4912243Sgabeblack@google.comdef common_config(env): 5012243Sgabeblack@google.com # export TERM so that clang reports errors in color 5112243Sgabeblack@google.com use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH', 5212243Sgabeblack@google.com 'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC', 5312243Sgabeblack@google.com 'PYTHONPATH', 'RANLIB', 'TERM' ]) 5412243Sgabeblack@google.com 5512243Sgabeblack@google.com use_prefixes = [ 5612243Sgabeblack@google.com "ASAN_", # address sanitizer symbolizer path and settings 5712243Sgabeblack@google.com "CCACHE_", # ccache (caching compiler wrapper) configuration 5812243Sgabeblack@google.com "CCC_", # clang static analyzer configuration 5912243Sgabeblack@google.com "DISTCC_", # distcc (distributed compiler wrapper) config 6012243Sgabeblack@google.com "INCLUDE_SERVER_", # distcc pump server settings 6112243Sgabeblack@google.com "M5", # M5 configuration (e.g., path to kernels) 6212243Sgabeblack@google.com ] 6312243Sgabeblack@google.com 6412243Sgabeblack@google.com for key,val in sorted(os.environ.iteritems()): 6512243Sgabeblack@google.com if key in use_vars or \ 6612243Sgabeblack@google.com any([key.startswith(prefix) for prefix in use_prefixes]): 6712282Sgiacomo.travaglini@arm.com env['ENV'][key] = val 6812243Sgabeblack@google.com 6912243Sgabeblack@google.com # Tell scons to avoid implicit command dependencies to avoid issues 7012243Sgabeblack@google.com # with the param wrappes being compiled twice (see 7112243Sgabeblack@google.com # http://scons.tigris.org/issues/show_bug.cgi?id=2811) 7212243Sgabeblack@google.com env['IMPLICIT_COMMAND_DEPENDENCIES'] = 0 7312243Sgabeblack@google.com env.Decider('MD5-timestamp') 7412243Sgabeblack@google.com env.root = env.Dir('#') 7512243Sgabeblack@google.com env.srcdir = env.root.Dir('src') 7612243Sgabeblack@google.com 7712245Sgabeblack@google.com # add useful python code PYTHONPATH so it can be used by subprocesses 7812245Sgabeblack@google.com # as well 7912245Sgabeblack@google.com env.AppendENVPath('PYTHONPATH', extra_python_paths) 8012245Sgabeblack@google.com 8112243Sgabeblack@google.comgem5_tool_list = [ 8212244Sgabeblack@google.com 'git', 8312244Sgabeblack@google.com 'mercurial', 8412243Sgabeblack@google.com] 8512243Sgabeblack@google.com 8612243Sgabeblack@google.comdef generate(env): 8712243Sgabeblack@google.com common_config(env) 8812243Sgabeblack@google.com SCons.Tool.default.generate(env) 8912243Sgabeblack@google.com for tool in gem5_tool_list: 9012243Sgabeblack@google.com SCons.Tool.Tool(tool)(env) 9112243Sgabeblack@google.com 9212243Sgabeblack@google.comdef exists(env): 9312243Sgabeblack@google.com return 1 94