Hanhwi Jang has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/44265 )
Change subject: scons: Rerun configuration tests with "config=force"
..
scons: Rerun configuration tests with "config=force"
Scons uses cached results for configuration tests, which leads to
compilation issues by the stale result use.
This patch allows users to rerun configuration tests using the
"config=force" option without deleting cache manually.
Change-Id: I61244c1daf963272a4b5a3d0e72101afefa82491
---
M SConstruct
M ext/systemc/SConscript
M src/base/SConsopts
M src/base/stats/SConsopts
M src/cpu/kvm/SConsopts
M src/dev/net/SConsopts
M src/proto/SConsopts
M src/sim/SConsopts
8 files changed, 88 insertions(+), 84 deletions(-)
diff --git a/SConstruct b/SConstruct
index b99ecdb..c5aa384 100755
--- a/SConstruct
+++ b/SConstruct
@@ -291,49 +291,53 @@
# Platform-specific configuration. Note again that we assume that all
# builds under a given build root run on the same host platform.
+# From this point, we use 'penv' instead of 'main' to isolate
+# the platform-specific environment updates.
+# main env. is updated at the end of this section with conf.Finish()
conf = gem5_scons.Configure(main)
+penv = conf.env
-CXX_version = readCommand([main['CXX'], '--version'], exception=False)
+CXX_version = readCommand([penv['CXX'], '--version'], exception=False)
-main['GCC'] = CXX_version and CXX_version.find('g++') >= 0
-main['CLANG'] = CXX_version and CXX_version.find('clang') >= 0
-if main['GCC'] + main['CLANG'] > 1:
+penv['GCC'] = CXX_version and CXX_version.find('g++') >= 0
+penv['CLANG'] = CXX_version and CXX_version.find('clang') >= 0
+if penv['GCC'] + penv['CLANG'] > 1:
error('Two compilers enabled at once?')
# Set up default C++ compiler flags
-if main['GCC'] or main['CLANG']:
+if penv['GCC'] or penv['CLANG']:
# As gcc and clang share many flags, do the common parts here
-main.Append(CCFLAGS=['-pipe'])
-main.Append(CCFLAGS=['-fno-strict-aliasing'])
+penv.Append(CCFLAGS=['-pipe'])
+penv.Append(CCFLAGS=['-fno-strict-aliasing'])
# Enable -Wall and -Wextra and then disable the few warnings that
# we consistently violate
-main.Append(CCFLAGS=['-Wall', '-Wundef', '-Wextra',
+penv.Append(CCFLAGS=['-Wall', '-Wundef', '-Wextra',
'-Wno-sign-compare', '-Wno-unused-parameter'])
# We always compile using C++14
-main.Append(CXXFLAGS=['-std=c++14'])
+penv.Append(CXXFLAGS=['-std=c++14'])
if sys.platform.startswith('freebsd'):
-main.Append(CCFLAGS=['-I/usr/local/include'])
-main.Append(CXXFLAGS=['-I/usr/local/include'])
+penv.Append(CCFLAGS=['-I/usr/local/include'])
+penv.Append(CXXFLAGS=['-I/usr/local/include'])
# On FreeBSD we need libthr.
-main.Append(LIBS=['thr'])
+penv.Append(LIBS=['thr'])
conf.CheckLinkFlag('-Wl,--as-needed')
if GetOption('gold_linker'):
-main.Append(LINKFLAGS='-fuse-ld=gold')
+penv.Append(LINKFLAGS='-fuse-ld=gold')
# Treat warnings as errors but white list some warnings that we
# want to allow (e.g., deprecation warnings).
-main.Append(CCFLAGS=['-Werror',
+penv.Append(CCFLAGS=['-Werror',
'-Wno-error=deprecated-declarations',
'-Wno-error=deprecated',
])
else:
error('\n'.join((
"Don't know what compiler options to use for your compiler.",
- "compiler: " + main['CXX'],
+ "compiler: " + penv['CXX'],
"version: " + CXX_version.replace('\n', '') if
CXX_version else 'COMMAND NOT FOUND!',
"If you're trying to use a compiler other than GCC",
@@ -344,10 +348,10 @@
"above you will need to ease fix SConstruct and ",
"src/SConscript to support that compiler.")))
-if main['GCC']:
-if compareVersions(main['CXXVERSION'], "5") < 0:
+if penv['GCC']:
+if compareVersions(penv['CXXVERSION'], "5") < 0:
error('gcc version 5 or newer required.\n'
- 'Installed version:', main['CXXVERSION'])
+ 'Installed version:', penv['CXXVERSION'])
# If not disabled, set the Link-Time Optimization (LTO) flags.
if not GetOption('no_lto'):
@@ -355,7 +359,7 @@
# the environment variable "MAKE", but we currently make no
attempt to
# plumb that variable through.
parallelism = ''
-if main.Detect('make'):
+if penv.Detect('make'):
parallelism = '=%d' % GetOption('num_jobs')
else:
warning('"make" not found, link time optimization will be '
@@ -363,32 +367,32 @@
for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
# Use the same amount of jobs for LTO as we are running scons
with.
-main[var] = ['-flto%s' % parallelism]
+