default.py revision 12244
17927SN/A# Copyright (c) 2013, 2015-2017 ARM Limited
27927SN/A# All rights reserved.
37927SN/A#
410036SAli.Saidi@ARM.com# The license below extends only to copyright in the software and shall
58835SAli.Saidi@ARM.com# not be construed as granting a license to any other intellectual
610036SAli.Saidi@ARM.com# property including but not limited to intellectual property relating
77927SN/A# to a hardware implementation of the functionality of the software
87927SN/A# licensed hereunder.  You may use the software subject to the license
97927SN/A# terms below provided that you ensure that this notice is replicated
107927SN/A# unmodified and in its entirety in all distributions of the software,
117927SN/A# modified or unmodified, in source code or in binary form.
127927SN/A#
1310315Snilay@cs.wisc.edu# Copyright (c) 2011 Advanced Micro Devices, Inc.
147927SN/A# Copyright (c) 2009 The Hewlett-Packard Development Company
157927SN/A# Copyright (c) 2004-2005 The Regents of The University of Michigan
169885Sstever@gmail.com# All rights reserved.
179885Sstever@gmail.com#
187927SN/A# Redistribution and use in source and binary forms, with or without
1910036SAli.Saidi@ARM.com# modification, are permitted provided that the following conditions are
207927SN/A# met: redistributions of source code must retain the above copyright
217927SN/A# notice, this list of conditions and the following disclaimer;
227927SN/A# redistributions in binary form must reproduce the above copyright
2310513SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer in the
2410315Snilay@cs.wisc.edu# documentation and/or other materials provided with the distribution;
257927SN/A# neither the name of the copyright holders nor the names of its
2610315Snilay@cs.wisc.edu# contributors may be used to endorse or promote products derived from
277927SN/A# this software without specific prior written permission.
289474Snilay@cs.wisc.edu#
298673SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
308673SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3110513SAli.Saidi@ARM.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
327927SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
337927SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
347927SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
357927SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
367927SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
377927SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
387927SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
397927SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
407927SN/A
418983Snate@binkert.orgimport os
427927SN/A
437927SN/Aimport SCons.Tool
447927SN/Aimport SCons.Tool.default
457927SN/A
4610036SAli.Saidi@ARM.comdef common_config(env):
477927SN/A    # export TERM so that clang reports errors in color
487927SN/A    use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
497927SN/A                     'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
507927SN/A                     'PYTHONPATH', 'RANLIB', 'TERM' ])
517927SN/A
527927SN/A    use_prefixes = [
537927SN/A        "ASAN_",           # address sanitizer symbolizer path and settings
547927SN/A        "CCACHE_",         # ccache (caching compiler wrapper) configuration
557927SN/A        "CCC_",            # clang static analyzer configuration
567927SN/A        "DISTCC_",         # distcc (distributed compiler wrapper) config
5710036SAli.Saidi@ARM.com        "INCLUDE_SERVER_", # distcc pump server settings
587927SN/A        "M5",              # M5 configuration (e.g., path to kernels)
597927SN/A        ]
607927SN/A
617927SN/A    for key,val in sorted(os.environ.iteritems()):
628835SAli.Saidi@ARM.com        if key in use_vars or \
638835SAli.Saidi@ARM.com                any([key.startswith(prefix) for prefix in use_prefixes]):
649885Sstever@gmail.com            env[key] = val
658835SAli.Saidi@ARM.com
6610036SAli.Saidi@ARM.com    # Tell scons to avoid implicit command dependencies to avoid issues
678835SAli.Saidi@ARM.com    # with the param wrappes being compiled twice (see
688835SAli.Saidi@ARM.com    # http://scons.tigris.org/issues/show_bug.cgi?id=2811)
698835SAli.Saidi@ARM.com    env['IMPLICIT_COMMAND_DEPENDENCIES'] = 0
708983Snate@binkert.org    env.Decider('MD5-timestamp')
718983Snate@binkert.org    env.root = env.Dir('#')
728835SAli.Saidi@ARM.com    env.srcdir = env.root.Dir('src')
737927SN/A
747927SN/Agem5_tool_list = [
759885Sstever@gmail.com    'git',
767927SN/A    'mercurial',
7710036SAli.Saidi@ARM.com]
7810451Snilay@cs.wisc.edu
798721SN/Adef generate(env):
808721SN/A    common_config(env)
818983Snate@binkert.org    SCons.Tool.default.generate(env)
829885Sstever@gmail.com    for tool in gem5_tool_list:
839885Sstever@gmail.com        SCons.Tool.Tool(tool)(env)
849885Sstever@gmail.com
859885Sstever@gmail.comdef exists(env):
869885Sstever@gmail.com    return 1
8710315Snilay@cs.wisc.edu