Commit d5f5d5d1 authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

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: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent 5e8ea173
......@@ -56,8 +56,8 @@ MKSUNXIBOOT ?= mksunxiboot
PATH_DIRS := $(shell echo $$PATH | sed -e 's/:/ /g')
# Try to guess a suitable default ARM cross toolchain
CROSS_DEFAULT := arm-none-eabi-
CROSS_COMPILE ?= $(or $(shell find $(PATH_DIRS) -executable -name 'arm*-gcc' -printf '%f\t' 2>/dev/null | cut -f 1 | sed -e 's/-gcc/-/'),$(CROSS_DEFAULT))
CROSS_CC ?= $(CROSS_COMPILE)gcc
CROSS_COMPILE ?= $(or $(shell ./find-arm-gcc.sh),$(CROSS_DEFAULT))
CROSS_CC := $(CROSS_COMPILE)gcc
DESTDIR ?=
PREFIX ?= /usr/local
......
#
# 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/-/'
......@@ -17,8 +17,7 @@ all: $(SPL_THUNK) $(THUNKS)
FORCE:
# If not specified explicitly: try to guess a suitable ARM toolchain prefix
PATH_DIRS := $(shell echo $$PATH | sed -e 's/:/ /g')
CROSS_COMPILE ?= $(shell find $(PATH_DIRS) -executable -name 'arm*-gcc' -printf '%f\t' | cut -f 1 | sed -e 's/-gcc/-/')
CROSS_COMPILE ?= $(shell ../find-arm-gcc.sh)
AS := $(CROSS_COMPILE)as
OBJDUMP := $(CROSS_COMPILE)objdump
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment