summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorhollylee <[email protected]>2019-09-11 09:03:59 +0800
committerGitHub <[email protected]>2019-09-11 09:03:59 +0800
commit723ca994e7ae6b530b695fd7f05cfd0e2ac2cc50 (patch)
tree98d12ea0e7d342c3932c3cf3d975d11e676c8a73 /tools
parent2ed84b61b057482d8554a9b181ddb398b5d4ff96 (diff)
GetGCCRoot() for usual toolchain dir structures
So don't depend on any special assumptions. See comments in the codes.
Diffstat (limited to 'tools')
-rw-r--r--tools/gcc.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/gcc.py b/tools/gcc.py
index 525e11c44b..e45c07a57e 100644
--- a/tools/gcc.py
+++ b/tools/gcc.py
@@ -37,6 +37,24 @@ def GetGCCRoot(rtconfig):
else:
root_path = os.path.join(exec_path, '..', prefix)
+ # Usually the cross compiling gcc toolchain has directory as:
+ #
+ # bin
+ # lib
+ # share
+ # arm-none-eabi
+ # bin
+ # include
+ # lib
+ # share
+ prefix = rtconfig.PREFIX
+ if prefix.endswith('-'):
+ prefix = prefix[:-1]
+
+ fn = os.path.join(root, prefix, 'include', filename)
+ if os.path.isfile(fn):
+ return True
+
return root_path
def CheckHeader(rtconfig, filename):