scons: Make CC, CXX and PROTOC no longer sticky.
These variables will always be imported from the environment, and never from previous builds. For SCons to actually use these values, they need to not only be in the environment variables external commands SCons runs sees, they also have to be promoted to actual SCons construction variables. Change-Id: I54035442d70972396f1788bd0773877222d7a7c5 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56386 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -253,8 +253,6 @@ global_vars_file = os.path.join(build_root, 'variables.global')
|
||||
global_vars = Variables(global_vars_file, args=ARGUMENTS)
|
||||
|
||||
global_vars.AddVariables(
|
||||
('CC', 'C compiler', environ.get('CC', main['CC'])),
|
||||
('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
|
||||
('CCFLAGS_EXTRA', 'Extra C and C++ compiler flags', ''),
|
||||
('GEM5PY_CCFLAGS_EXTRA', 'Extra C and C++ gem5py compiler flags', ''),
|
||||
('GEM5PY_LINKFLAGS_EXTRA', 'Extra marshal gem5py flags', ''),
|
||||
@@ -262,7 +260,6 @@ global_vars.AddVariables(
|
||||
('PYTHON_CONFIG', 'Python config binary to use',
|
||||
[ 'python3-config', 'python-config']
|
||||
),
|
||||
('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
|
||||
('BATCH', 'Use batch pool for build and tests', False),
|
||||
('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
|
||||
('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
|
||||
|
||||
@@ -63,6 +63,16 @@ def EnvDefaults(env):
|
||||
any([key.startswith(prefix) for prefix in use_prefixes]):
|
||||
env['ENV'][key] = val
|
||||
|
||||
# These variables from the environment override/become SCons variables,
|
||||
# with a default if they weren't in the host environment.
|
||||
var_overrides = {
|
||||
'CC': env['CC'],
|
||||
'CXX': env['CXX'],
|
||||
'PROTOC': 'protoc'
|
||||
}
|
||||
for key,default in var_overrides.items():
|
||||
env[key] = env['ENV'].get(key, default)
|
||||
|
||||
# Tell scons to avoid implicit command dependencies to avoid issues
|
||||
# with the param wrappes being compiled twice (see
|
||||
# https://github.com/SCons/scons/issues/2811
|
||||
|
||||
Reference in New Issue
Block a user