Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/linux-sunxi/sunxi-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Nortmann <bernhard.nortmann@web.de>2017-02-11 15:50:14 +0300
committerBernhard Nortmann <bernhard.nortmann@web.de>2017-02-11 16:02:33 +0300
commitd5f5d5d1ad70aae6cbd23ed1a39d58b5b4315f49 (patch)
treee6f8c43885cf4690c7f25fb11c352fbf3ab38264 /find-arm-gcc.sh
parent5e8ea17382b2037f0cc85995be9851e8129048fc (diff)
Makefile: Improve auto-detection of ARM cross compiler
This patch moves the scan for an ARM gcc into a separate shell script. To prevent against recursion issues, the new script adds "-maxdepth 1" to the find invocation; and it now also correctly handles directories in $PATH that contain spaces in their name. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
Diffstat (limited to 'find-arm-gcc.sh')
-rwxr-xr-xfind-arm-gcc.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/find-arm-gcc.sh b/find-arm-gcc.sh
new file mode 100755
index 0000000..ae7bf4b
--- /dev/null
+++ b/find-arm-gcc.sh
@@ -0,0 +1,13 @@
+#
+# Try to locate suitable ARM cross compilers available via $PATH
+# If any are found, this function will output them as a TAB-delimited list
+#
+scan_path () {
+IFS=":"
+for path in $PATH; do
+ find "$path" -maxdepth 1 -executable -name 'arm*-gcc' -printf '%f\t' 2>/dev/null
+done
+}
+
+# Use only the first field from result, and convert it to a toolchain prefix
+scan_path | cut -f 1 | sed -e 's/-gcc/-/'