default.py revision 12244
14479Sbinkertn@umich.edu# Copyright (c) 2013, 2015-2017 ARM Limited
24479Sbinkertn@umich.edu# All rights reserved.
34479Sbinkertn@umich.edu#
44479Sbinkertn@umich.edu# The license below extends only to copyright in the software and shall
54479Sbinkertn@umich.edu# not be construed as granting a license to any other intellectual
64479Sbinkertn@umich.edu# property including but not limited to intellectual property relating
74479Sbinkertn@umich.edu# to a hardware implementation of the functionality of the software
84479Sbinkertn@umich.edu# licensed hereunder.  You may use the software subject to the license
94479Sbinkertn@umich.edu# terms below provided that you ensure that this notice is replicated
104479Sbinkertn@umich.edu# unmodified and in its entirety in all distributions of the software,
114479Sbinkertn@umich.edu# modified or unmodified, in source code or in binary form.
124479Sbinkertn@umich.edu#
134479Sbinkertn@umich.edu# Copyright (c) 2011 Advanced Micro Devices, Inc.
144479Sbinkertn@umich.edu# Copyright (c) 2009 The Hewlett-Packard Development Company
154479Sbinkertn@umich.edu# Copyright (c) 2004-2005 The Regents of The University of Michigan
164479Sbinkertn@umich.edu# All rights reserved.
174479Sbinkertn@umich.edu#
184479Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without
194479Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are
204479Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright
214479Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer;
224479Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright
234479Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the
244479Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution;
254479Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its
264479Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from
274479Sbinkertn@umich.edu# this software without specific prior written permission.
284479Sbinkertn@umich.edu#
294479Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
304479Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
314479Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
324479Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
334479Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
344479Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
354479Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
364479Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
374479Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
384479Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
394479Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
404479Sbinkertn@umich.edu
414479Sbinkertn@umich.eduimport os
426498Snate@binkert.org
434479Sbinkertn@umich.eduimport SCons.Tool
444479Sbinkertn@umich.eduimport SCons.Tool.default
454479Sbinkertn@umich.edu
464479Sbinkertn@umich.edudef common_config(env):
476498Snate@binkert.org    # export TERM so that clang reports errors in color
484479Sbinkertn@umich.edu    use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
494479Sbinkertn@umich.edu                     'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
504479Sbinkertn@umich.edu                     'PYTHONPATH', 'RANLIB', 'TERM' ])
514479Sbinkertn@umich.edu
524479Sbinkertn@umich.edu    use_prefixes = [
534479Sbinkertn@umich.edu        "ASAN_",           # address sanitizer symbolizer path and settings
544479Sbinkertn@umich.edu        "CCACHE_",         # ccache (caching compiler wrapper) configuration
554479Sbinkertn@umich.edu        "CCC_",            # clang static analyzer configuration
564479Sbinkertn@umich.edu        "DISTCC_",         # distcc (distributed compiler wrapper) config
574479Sbinkertn@umich.edu        "INCLUDE_SERVER_", # distcc pump server settings
584479Sbinkertn@umich.edu        "M5",              # M5 configuration (e.g., path to kernels)
594479Sbinkertn@umich.edu        ]
604479Sbinkertn@umich.edu
614479Sbinkertn@umich.edu    for key,val in sorted(os.environ.iteritems()):
624479Sbinkertn@umich.edu        if key in use_vars or \
634479Sbinkertn@umich.edu                any([key.startswith(prefix) for prefix in use_prefixes]):
644479Sbinkertn@umich.edu            env[key] = val
654479Sbinkertn@umich.edu
664479Sbinkertn@umich.edu    # Tell scons to avoid implicit command dependencies to avoid issues
674479Sbinkertn@umich.edu    # with the param wrappes being compiled twice (see
684479Sbinkertn@umich.edu    # http://scons.tigris.org/issues/show_bug.cgi?id=2811)
694479Sbinkertn@umich.edu    env['IMPLICIT_COMMAND_DEPENDENCIES'] = 0
704479Sbinkertn@umich.edu    env.Decider('MD5-timestamp')
716498Snate@binkert.org    env.root = env.Dir('#')
724479Sbinkertn@umich.edu    env.srcdir = env.root.Dir('src')
734479Sbinkertn@umich.edu
744479Sbinkertn@umich.edugem5_tool_list = [
754479Sbinkertn@umich.edu    'git',
764479Sbinkertn@umich.edu    'mercurial',
774479Sbinkertn@umich.edu]
784479Sbinkertn@umich.edu
794479Sbinkertn@umich.edudef generate(env):
804479Sbinkertn@umich.edu    common_config(env)
814479Sbinkertn@umich.edu    SCons.Tool.default.generate(env)
824479Sbinkertn@umich.edu    for tool in gem5_tool_list:
834479Sbinkertn@umich.edu        SCons.Tool.Tool(tool)(env)
844479Sbinkertn@umich.edu
854479Sbinkertn@umich.edudef exists(env):
864479Sbinkertn@umich.edu    return 1
874479Sbinkertn@umich.edu