default.py revision 12244:33af7397d081
111986Sandreas.sandberg@arm.com# Copyright (c) 2013, 2015-2017 ARM Limited
211986Sandreas.sandberg@arm.com# All rights reserved.
311986Sandreas.sandberg@arm.com#
412391Sjason@lowepower.com# The license below extends only to copyright in the software and shall
512391Sjason@lowepower.com# not be construed as granting a license to any other intellectual
612391Sjason@lowepower.com# property including but not limited to intellectual property relating
712391Sjason@lowepower.com# to a hardware implementation of the functionality of the software
812391Sjason@lowepower.com# licensed hereunder.  You may use the software subject to the license
912391Sjason@lowepower.com# terms below provided that you ensure that this notice is replicated
1012391Sjason@lowepower.com# unmodified and in its entirety in all distributions of the software,
1114299Sbbruce@ucdavis.edu# modified or unmodified, in source code or in binary form.
1214299Sbbruce@ucdavis.edu#
1312391Sjason@lowepower.com# Copyright (c) 2011 Advanced Micro Devices, Inc.
1412391Sjason@lowepower.com# Copyright (c) 2009 The Hewlett-Packard Development Company
1512391Sjason@lowepower.com# Copyright (c) 2004-2005 The Regents of The University of Michigan
1612391Sjason@lowepower.com# All rights reserved.
1714299Sbbruce@ucdavis.edu#
1812391Sjason@lowepower.com# Redistribution and use in source and binary forms, with or without
1912391Sjason@lowepower.com# modification, are permitted provided that the following conditions are
2014299Sbbruce@ucdavis.edu# met: redistributions of source code must retain the above copyright
2114299Sbbruce@ucdavis.edu# notice, this list of conditions and the following disclaimer;
2212391Sjason@lowepower.com# redistributions in binary form must reproduce the above copyright
2312391Sjason@lowepower.com# notice, this list of conditions and the following disclaimer in the
2412391Sjason@lowepower.com# documentation and/or other materials provided with the distribution;
2512391Sjason@lowepower.com# neither the name of the copyright holders nor the names of its
2612391Sjason@lowepower.com# contributors may be used to endorse or promote products derived from
2712391Sjason@lowepower.com# this software without specific prior written permission.
2812391Sjason@lowepower.com#
2912391Sjason@lowepower.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3012391Sjason@lowepower.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3112391Sjason@lowepower.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3212391Sjason@lowepower.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3312391Sjason@lowepower.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3414299Sbbruce@ucdavis.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3512391Sjason@lowepower.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3612391Sjason@lowepower.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3712391Sjason@lowepower.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3812391Sjason@lowepower.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3911986Sandreas.sandberg@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4014299Sbbruce@ucdavis.edu
4114299Sbbruce@ucdavis.eduimport os
4211986Sandreas.sandberg@arm.com
4311986Sandreas.sandberg@arm.comimport SCons.Tool
4411986Sandreas.sandberg@arm.comimport SCons.Tool.default
4514299Sbbruce@ucdavis.edu
4614299Sbbruce@ucdavis.edudef common_config(env):
4714299Sbbruce@ucdavis.edu    # export TERM so that clang reports errors in color
4811986Sandreas.sandberg@arm.com    use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
4914299Sbbruce@ucdavis.edu                     'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
5014299Sbbruce@ucdavis.edu                     'PYTHONPATH', 'RANLIB', 'TERM' ])
5112391Sjason@lowepower.com
5211986Sandreas.sandberg@arm.com    use_prefixes = [
5311986Sandreas.sandberg@arm.com        "ASAN_",           # address sanitizer symbolizer path and settings
5414299Sbbruce@ucdavis.edu        "CCACHE_",         # ccache (caching compiler wrapper) configuration
5514299Sbbruce@ucdavis.edu        "CCC_",            # clang static analyzer configuration
5614299Sbbruce@ucdavis.edu        "DISTCC_",         # distcc (distributed compiler wrapper) config
5714299Sbbruce@ucdavis.edu        "INCLUDE_SERVER_", # distcc pump server settings
5814299Sbbruce@ucdavis.edu        "M5",              # M5 configuration (e.g., path to kernels)
5914299Sbbruce@ucdavis.edu        ]
6014299Sbbruce@ucdavis.edu
6114299Sbbruce@ucdavis.edu    for key,val in sorted(os.environ.iteritems()):
6214299Sbbruce@ucdavis.edu        if key in use_vars or \
6312391Sjason@lowepower.com                any([key.startswith(prefix) for prefix in use_prefixes]):
6414299Sbbruce@ucdavis.edu            env[key] = val
6512391Sjason@lowepower.com
6612391Sjason@lowepower.com    # Tell scons to avoid implicit command dependencies to avoid issues
6714299Sbbruce@ucdavis.edu    # with the param wrappes being compiled twice (see
6814299Sbbruce@ucdavis.edu    # http://scons.tigris.org/issues/show_bug.cgi?id=2811)
6914299Sbbruce@ucdavis.edu    env['IMPLICIT_COMMAND_DEPENDENCIES'] = 0
7014299Sbbruce@ucdavis.edu    env.Decider('MD5-timestamp')
7114299Sbbruce@ucdavis.edu    env.root = env.Dir('#')
7214299Sbbruce@ucdavis.edu    env.srcdir = env.root.Dir('src')
7314299Sbbruce@ucdavis.edu
7414299Sbbruce@ucdavis.edugem5_tool_list = [
7514299Sbbruce@ucdavis.edu    'git',
7614299Sbbruce@ucdavis.edu    'mercurial',
7714299Sbbruce@ucdavis.edu]
7814299Sbbruce@ucdavis.edu
7914299Sbbruce@ucdavis.edudef generate(env):
8014299Sbbruce@ucdavis.edu    common_config(env)
8114299Sbbruce@ucdavis.edu    SCons.Tool.default.generate(env)
8214299Sbbruce@ucdavis.edu    for tool in gem5_tool_list:
8314299Sbbruce@ucdavis.edu        SCons.Tool.Tool(tool)(env)
8414299Sbbruce@ucdavis.edu
8514299Sbbruce@ucdavis.edudef exists(env):
8614299Sbbruce@ucdavis.edu    return 1
8714299Sbbruce@ucdavis.edu