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

Makefile: Improve auto-detection of ARM cross compiler



Try an 'educated guess' for a suitable toolchain if no explicit
CROSS_COMPILE was set (but still default to "arm-none-eabi-").
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent e125a9da
...@@ -52,9 +52,12 @@ MISC_TOOLS = phoenix_info sunxi-nand-image-builder ...@@ -52,9 +52,12 @@ MISC_TOOLS = phoenix_info sunxi-nand-image-builder
# Note: To use this target, set/adjust CROSS_COMPILE and MKSUNXIBOOT if needed # Note: To use this target, set/adjust CROSS_COMPILE and MKSUNXIBOOT if needed
BINFILES = jtag-loop.sunxi fel-sdboot.sunxi uart0-helloworld-sdboot.sunxi BINFILES = jtag-loop.sunxi fel-sdboot.sunxi uart0-helloworld-sdboot.sunxi
CROSS_COMPILE ?= arm-none-eabi-
CROSS_CC ?= $(CROSS_COMPILE)gcc
MKSUNXIBOOT ?= mksunxiboot 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' | cut -f 1 | sed -e 's/-gcc/-/'),$(CROSS_DEFAULT))
CROSS_CC ?= $(CROSS_COMPILE)gcc
DESTDIR ?= DESTDIR ?=
PREFIX ?= /usr/local PREFIX ?= /usr/local
......
...@@ -112,8 +112,9 @@ and our default target (when simply using `make`). ...@@ -112,8 +112,9 @@ and our default target (when simply using `make`).
* `make target-tools` * `make target-tools`
builds tools that are intended for the target (Allwinner SoC), using a builds tools that are intended for the target (Allwinner SoC), using a
cross-compiler. The toolchain prefix *CROSS_COMPILE* defaults to `arm-none-eabi-`, cross-compiler. The Makefile will try to auto-detect a suitable toolchain
adjust it if needed. prefix, and falls back to `arm-none-eabi-` otherwise.
If needed, you may override this by explicitly setting *CROSS_COMPILE*.
<br>_Hint:_ When compiling 'natively' on the target platform you may <br>_Hint:_ When compiling 'natively' on the target platform you may
simply use an empty toolchain prefix here (`make target-tools CROSS_COMPILE=` simply use an empty toolchain prefix here (`make target-tools CROSS_COMPILE=`
or `make all CROSS_COMPILE=`). or `make all CROSS_COMPILE=`).
......
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