Files
gem5/util/m5/SConstruct
Gabe Black dc23a1fb9c util,scons: Detect java and lua51 in the m5 utility scons files.
These will enable or disable the java and lua51 m5 op wrappers depending
on whether the required tools are available on the host system.

Change-Id: I2b11a13a39b2dfd5d45a9ed57702d2e225ef7d2e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27214
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
2020-04-10 06:14:43 +00:00

68 lines
2.8 KiB
Python

# Copyright 2020 Google, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
main = Environment()
# Includes which are shared with gem5 itself.
common_include = Dir('..').Dir('..').Dir('include')
src_dir = Dir('src')
build_dir = Dir('build')
def abspath(d):
return os.path.abspath(str(d))
# Universal settings.
main.Append(CCFLAGS=[ '-O2' ])
main.Append(CPPPATH=[ common_include ])
# Propogate the environment's PATH setting.
main['ENV']['PATH'] = os.environ['PATH']
# Cross compiler prefix.
main['CROSS_COMPILE'] = os.environ.get('CROSS_COMPILE', 'aarch64-linux-gnu-')
main['CC'] = '${CROSS_COMPILE}gcc'
main['AS'] = '${CROSS_COMPILE}as'
main['LD'] = '${CROSS_COMPILE}ld'
main['AR'] = '${CROSS_COMPILE}ar'
# Detect some dependencies of some forms of the m5 utility/library.
main['HAVE_JAVA'] = all(key in main for key in ('JAVAC', 'JAR'))
main['HAVE_PKG_CONFIG'] = main.Detect('pkg-config') is not None
main['HAVE_LUA51'] = (main['HAVE_PKG_CONFIG'] and
os.system('pkg-config --exists lua51') == 0)
# Put the sconsign file in the build dir so everything can be deleted at once.
main.SConsignFile(os.path.join(abspath(build_dir), 'sconsign'))
# Use soft links instead of hard links when setting up a build directory.
main.SetOption('duplicate', 'soft-copy')
env = main.Clone()
main.SConscript(src_dir.File('SConscript'),
variant_dir=build_dir, exports='env')