sunxi-tools/find-arm-gcc.sh
Bernhard Nortmann d5f5d5d1ad 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>
2017-02-11 14:02:33 +01:00

14 lines
398 B
Bash
Executable File

#
# 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/-/'