u-boot-mkimage: Fix use of 'cc' instead of BUILD_CC

OE needs to be able to change the default compiler. If we pass in HOSTCC
through the make command, it overwrites not only this setting but also the
setting in tools/Makefile wrapped in ifneq ($(CROSS_BUILD_TOOLS),) which
breaks the build.

We therefore add a way of changing the default in the top level Makefile
without interfering with the other setting.

I've emailed this workaround to Masahiro Yamada for discussion.

(From OE-Core rev: e777d6873ce9a8a80288ecbcfc86239e0ed0e2f9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2017-03-11 10:37:38 +00:00
parent 760e81678c
commit 21db71990b
2 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,25 @@
OE needs to be able to change the default compiler. If we pass in HOSTCC
through the make command, it overwrites not only this setting but also the
setting in tools/Makefile wrapped in ifneq ($(CROSS_BUILD_TOOLS),) which
breaks the build.
We therefore add a way of changing the default in the top level Makefile
without interfering with the other setting.
Upstream-Status: Submitted [emailed to Masahiro Yamada for discussion]
RP 2017/3/11
Index: git/Makefile
===================================================================
--- git.orig/Makefile
+++ git/Makefile
@@ -254,7 +254,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH"
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
-HOSTCC = cc
+DEFAULTHOSTCC = cc
+HOSTCC = $(DEFAULTHOSTCC)
HOSTCXX = c++
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
$(if $(CONFIG_TOOLS_DEBUG),-g)

View File

@ -1,9 +1,11 @@
require u-boot-common_${PV}.inc
SRC_URI += "file://default-gcc.patch"
SUMMARY = "U-Boot bootloader image creation tool"
DEPENDS = "openssl"
EXTRA_OEMAKE_class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" STRIP=true V=1'
EXTRA_OEMAKE_class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" DEFAULTHOSTCC="${BUILD_CC}" STRIP=true V=1'
EXTRA_OEMAKE_class-native = 'CC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
EXTRA_OEMAKE_class-nativesdk = 'CC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'