diff options
author | Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> | 2011-12-06 19:23:32 +0059 |
---|---|---|
committer | Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> | 2012-03-29 10:16:16 +0200 |
commit | dffb49cc74db074686aeac498afad513a6108538 (patch) | |
tree | 63e2a538fd0b2c860390cbfa5d0b38c14e34eff3 | |
parent | e5e3170913383b67e740fbe55f7f218abc262132 (diff) | |
download | build-dffb49cc74db074686aeac498afad513a6108538.tar.gz |
linaro_compilerchecks.mk: Don't rely on TARGET_CC
In some cases, it is important to use linaro_compilerchecks.mk
before TARGET_CC has been defined - we need to handle it
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
-rw-r--r-- | core/linaro_compilerchecks.mk | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/linaro_compilerchecks.mk b/core/linaro_compilerchecks.mk index 8aec5e37c6..468aba76f6 100644 --- a/core/linaro_compilerchecks.mk +++ b/core/linaro_compilerchecks.mk @@ -16,6 +16,17 @@ # # if supported, otherwise nothing # echo $(call cc-option, -mcpu=cortex-a9, $(call cc-option, -mcpu=cortex-a8)) # + +# We have to do our own version of setting TARGET_CC because we can be +# included before TARGET_CC is set, but we may want to use cc-option and +# friends in the same file that sets TARGET_CC... + +ifeq ($(strip $(TARGET_TOOLS_PREFIX)),) +LINARO_COMPILERCHECK_CC := prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc$(HOST_EXECUTABLE_SUFFIX) +else +LINARO_COMPILERCHECK_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX) +endif + try-run = $(shell set -e; \ if ($(1)) >/dev/null 2>&1; then \ echo "$(2)"; \ @@ -24,9 +35,9 @@ try-run = $(shell set -e; \ fi) cc-version = $(shell echo '__GNUC__ __GNUC_MINOR__' \ - |$(TARGET_CC) -E -xc - |tail -n1 |sed -e 's, ,,g') + |$(LINARO_COMPILERCHECK_CC) -E -xc - |tail -n1 |sed -e 's, ,,g') cc-ifversion = $(shell [ $(call cc-version) $(1) $(2) ] && echo $(3)) cc-option = $(call try-run, echo -e "$(1)" \ - |$(TARGET_CC) $(1) -c -xc /dev/null -o /dev/null,$(1),$(2)) + |$(LINARO_COMPILERCHECK_CC) $(1) -c -xc /dev/null -o /dev/null,$(1),$(2)) |