Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | From 32e35a2f179d1b036d2eb699d77f869f7787f36b Mon Sep 17 00:00:00 2001 |
| 2 | From: Adrian Herrera <adrian.herrera@arm.com> |
| 3 | Date: Tue, 8 Dec 2020 20:12:55 +0000 |
| 4 | Subject: [PATCH] util: m5ops, optional extra build flags |
| 5 | |
| 6 | This increases compilation control for users. Main use case is building |
| 7 | m5ops as part of an image distribution. Specifying a different sysroot |
| 8 | or dynamic linker may be required when the cross toolchain is built as |
| 9 | part of the process. |
| 10 | |
| 11 | Change-Id: Icbd3faa92ea6e084fc4a9b2db83129bce73faf21 |
| 12 | Signed-off-by: Adrian Herrera <adrian.herrera@arm.com> |
| 13 | Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38416 |
| 14 | Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> |
| 15 | Reviewed-by: Gabe Black <gabe.black@gmail.com> |
| 16 | Maintainer: Jason Lowe-Power <power.jg@gmail.com> |
| 17 | Tested-by: kokoro <noreply+kokoro@google.com> |
| 18 | |
| 19 | Upstream-Status: Accepted [https://gem5-review.googlesource.com/c/public/gem5/+/38416] |
| 20 | Expected version: v20.2 |
| 21 | --- |
| 22 | util/m5/SConstruct | 14 +++++++++++--- |
| 23 | 1 file changed, 11 insertions(+), 3 deletions(-) |
| 24 | |
| 25 | diff --git a/util/m5/SConstruct b/util/m5/SConstruct |
| 26 | index bbae8d9bbf..a37573d763 100644 |
| 27 | --- a/util/m5/SConstruct |
| 28 | +++ b/util/m5/SConstruct |
| 29 | @@ -136,16 +136,24 @@ for root, dirs, files in os.walk(abspath(src_dir)): |
| 30 | # |
| 31 | # This also considers scons command line settings which may look like |
| 32 | # environment variables, but are set after "scons" on the command line. |
| 33 | - def get_abi_opt(name, default): |
| 34 | + def _extract_abi_opt_val(name, default): |
| 35 | var_name = env.subst('${ABI}.%s' % name) |
| 36 | - env[name] = os.environ.get( |
| 37 | - var_name, ARGUMENTS.get(var_name, default)) |
| 38 | + return os.environ.get(var_name, ARGUMENTS.get(var_name, default)) |
| 39 | + def get_abi_opt(name, default): |
| 40 | + env[name] = _extract_abi_opt_val(name, default) |
| 41 | + def append_abi_opt(name): |
| 42 | + env.Append(**{ name: _extract_abi_opt_val(name, '') }) |
| 43 | |
| 44 | # Process the ABI's settings in the SConsopts file, storing them |
| 45 | # in a copy of the primary environment. |
| 46 | env.SConscript(Dir(root).File('SConsopts'), |
| 47 | exports=[ 'env', 'get_abi_opt' ]) |
| 48 | |
| 49 | + # The user can pass extra build flags for each ABI |
| 50 | + append_abi_opt('CCFLAGS') |
| 51 | + append_abi_opt('CXXFLAGS') |
| 52 | + append_abi_opt('LINKFLAGS') |
| 53 | + |
| 54 | # Once all the options have been configured, set up build targets for |
| 55 | # this abi. |
| 56 | abi_dir = build_dir.Dir(env.subst('${ABI}')) |
| 57 | -- |
| 58 | 2.17.1 |
| 59 | |