diff options
author | Simon Glass <sjg@chromium.org> | 2014-12-01 17:33:58 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-01-14 21:16:53 -0800 |
commit | b53241230ddc4f007179b6b0659e0eb240f25400 (patch) | |
tree | c9b8db365b4022ad143d0e1fe64f0af26df1f43d /tools/buildman/toolchain.py | |
parent | 5abab20dfb20406137e8b7d659aee3cf43dff351 (diff) | |
download | u-boot-imx-b53241230ddc4f007179b6b0659e0eb240f25400.zip u-boot-imx-b53241230ddc4f007179b6b0659e0eb240f25400.tar.gz u-boot-imx-b53241230ddc4f007179b6b0659e0eb240f25400.tar.bz2 |
buildman: Try to avoid hard-coded string parsing
The assumption that the compiler name will always end in gcc is incorrect
for clang and apparently on BSD.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/toolchain.py')
-rw-r--r-- | tools/buildman/toolchain.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 27dc318..e2a851e 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -30,7 +30,14 @@ class Toolchain: """ self.gcc = fname self.path = os.path.dirname(fname) - self.cross = os.path.basename(fname)[:-3] + + # Find the CROSS_COMPILE prefix to use for U-Boot. For example, + # 'arm-linux-gnueabihf-gcc' turns into 'arm-linux-gnueabihf-'. + basename = os.path.basename(fname) + pos = basename.rfind('-') + self.cross = basename[:pos + 1] if pos != -1 else '' + + # The architecture is the first part of the name pos = self.cross.find('-') self.arch = self.cross[:pos] if pos != -1 else 'sandbox' |