From b22c05dc6d376a6e2aa8ef9624ff1daa115fd64b Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Sat, 12 Mar 2011 14:38:08 +0100 Subject: Allow top-level Makefile to use arm-none-eabi toolchain The gnuarm.com toolchain works fine but is very old. And although it is based on newlib, the tuple that we used to configure for was arm-elf-linux, which is bogus since we aren't building for Linux. This patch optimizes for the CodeSourcery G++ Lite 2010.09 ARM EABI toolchain instead, and for libosmocore installation it assumes that the new toolchain was unpacked next to the old one. Download it here: http://www.codesourcery.com/sgpp/lite/arm/portal/release1592 (The Linux Installer seems not to work reliably so I recommend the TAR.) Since CC is detected by configure when the host tuple points to a sane toolchain we shouldn't hard-code the gnuarm.com compiler. The patch autodetects arm-elf-gcc installed in PATH, and uses arm-elf as prefix if it is found. Otherwise, it defaults to arm-none-eabi. make CROSS_HOST=arm-xyzzy can be used to override on the command line. Author: Peter Stuge Acked-by: Sylvain Munaut --- src/Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index b3594c10..402f28ab 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,10 +1,13 @@ # this is not really used as we don't do 'make install'. You can still specify # it in case you _want_ to manually 'make install' the target libosmocore. -CROSS_INST_PREFIX=/usr/local/stow/osmocom-bb/arm-elf +CROSS_INST_PREFIX ?= /usr/local/stow/osmocom-bb/arm-2010.09 + +# this is the host tuple of your cross-toolchain +CROSS_HOST ?= $(shell which arm-elf-gcc >/dev/null 2>&1 && echo arm-elf || echo arm-none-eabi) # this is the prefix of your cross-toolchain programs -CROSS_TOOL_PREFIX=arm-elf- +CROSS_TOOL_PREFIX=$(CROSS_HOST)- TOPDIR=$(shell pwd) OSMOCORE_CONFIGURE_ENV= LIBOSMOCORE_LIBS=$(TOPDIR)/shared/libosmocore/build-host/src/.libs/libosmocore.a \ @@ -37,9 +40,9 @@ shared/libosmocore/build-target: shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/libosmocore/build-target cd shared/libosmocore/build-target && ../configure \ - --host=arm-elf-linux --disable-vty --enable-panic-infloop \ + --host=$(CROSS_HOST) --disable-vty --enable-panic-infloop \ --disable-shared --disable-talloc --disable-tests \ - CC="$(CROSS_TOOL_PREFIX)gcc" CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs" + CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs" shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile cd shared/libosmocore/build-target && make -- cgit v1.2.3