From ef504d96c1fbc3db302bd320a6f73b631e9c0faa Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Thu, 26 Jan 2023 19:11:57 +0000 Subject: [PATCH] Make c_build_helper module respect HOSTCC If HOSTCC is set, use that to generate files, otherwise use CC. This should make cross-compilation with generated files slightly easier. Signed-off-by: David Horstmann --- scripts/mbedtls_dev/c_build_helper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/mbedtls_dev/c_build_helper.py b/scripts/mbedtls_dev/c_build_helper.py index 7e0cac7302..6d2805759b 100644 --- a/scripts/mbedtls_dev/c_build_helper.py +++ b/scripts/mbedtls_dev/c_build_helper.py @@ -90,7 +90,10 @@ int main(void) ''') def compile_c_file(c_filename, exe_filename, include_dirs): - cc = os.getenv('CC', 'cc') + # Respect $HOSTCC if it is set + cc = os.getenv('HOSTCC', None) + if cc is None: + cc = os.getenv('CC', 'cc') cmd = [cc] proc = subprocess.Popen(cmd,