From: Adrian Herrera Date: Tue, 8 Dec 2020 20:12:55 +0000 (+0000) Subject: util: m5ops, optional extra build flags X-Git-Tag: develop-gem5-snapshot~357 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=275a6ecefe81c8aaf7681c59d51a393f0cac16f6;p=gem5.git util: m5ops, optional extra build flags This increases compilation control for users. Main use case is building m5ops as part of an image distribution. Specifying a different sysroot or dynamic linker may be required when the cross toolchain is built as part of the process. Change-Id: Icbd3faa92ea6e084fc4a9b2db83129bce73faf21 Signed-off-by: Adrian Herrera Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38416 Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/util/m5/SConstruct b/util/m5/SConstruct index 5725f6c87..63143a806 100644 --- a/util/m5/SConstruct +++ b/util/m5/SConstruct @@ -232,16 +232,24 @@ for root, dirs, files in os.walk(abspath(src_dir)): # # This also considers scons command line settings which may look like # environment variables, but are set after "scons" on the command line. - def get_abi_opt(name, default): + def _extract_abi_opt_val(name, default): var_name = env.subst('${ABI}.%s' % name) - env[name] = os.environ.get( - var_name, ARGUMENTS.get(var_name, default)) + return os.environ.get(var_name, ARGUMENTS.get(var_name, default)) + def get_abi_opt(name, default): + env[name] = _extract_abi_opt_val(name, default) + def append_abi_opt(name): + env.Append(**{ name: _extract_abi_opt_val(name, '') }) # Process the ABI's settings in the SConsopts file, storing them # in a copy of the primary environment. env.SConscript(Dir(root).File('SConsopts'), exports=[ 'env', 'get_abi_opt' ]) + # The user can pass extra build flags for each ABI + append_abi_opt('CCFLAGS') + append_abi_opt('CXXFLAGS') + append_abi_opt('LINKFLAGS') + # Check if this version of QEMU is available for running unit tests. env['HAVE_QEMU'] = env.Detect('${QEMU}') is not None if env['HAVE_QEMU'] and env.Detect('${CC}'):