From 72610c4102990d4f17bd654acad9a415733f795b Mon Sep 17 00:00:00 2001 From: dp-arm Date: Tue, 2 May 2017 11:09:11 +0100 Subject: [PATCH] build: Introduce HOSTCC flag Tools are built using the compiler specified in `HOSTCC` instead of reusing the `CC` variable. By default, gcc is used. Change-Id: I83636a375c61f4804b4e80784db9d061fe20af87 Signed-off-by: dp-arm --- Makefile | 3 +++ tools/cert_create/Makefile | 6 +++--- tools/fiptool/Makefile | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5396c0ed..15d41829 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,9 @@ endif # Toolchain ################################################################################ +HOSTCC := gcc +export HOSTCC + CC := ${CROSS_COMPILE}gcc CPP := ${CROSS_COMPILE}cpp AS := ${CROSS_COMPILE}gcc diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile index 8a216495..efd1f25d 100644 --- a/tools/cert_create/Makefile +++ b/tools/cert_create/Makefile @@ -64,7 +64,7 @@ INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include LIB_DIR := -L ${OPENSSL_DIR}/lib LIB := -lssl -lcrypto -CC := gcc +HOSTCC ?= gcc .PHONY: all clean realclean @@ -75,11 +75,11 @@ ${BINARY}: ${OBJECTS} Makefile @echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \ const char platform_msg[] = "${PLAT_MSG}";' | \ ${CC} -c ${CFLAGS} -xc - -o src/build_msg.o - ${Q}${CC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ + ${Q}${HOSTCC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ %.o: %.c @echo " CC $<" - ${Q}${CC} -c ${CFLAGS} ${INC_DIR} $< -o $@ + ${Q}${HOSTCC} -c ${CFLAGS} ${INC_DIR} $< -o $@ clean: $(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS}) diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile index 29eac2a7..ee674b7f 100644 --- a/tools/fiptool/Makefile +++ b/tools/fiptool/Makefile @@ -29,7 +29,7 @@ endif INCLUDE_PATHS := -I. -I../../include/tools_share -CC := gcc +HOSTCC ?= gcc .PHONY: all clean distclean @@ -37,7 +37,7 @@ all: ${PROJECT} fip_create ${PROJECT}: ${OBJECTS} Makefile @echo " LD $@" - ${Q}${CC} ${OBJECTS} -o $@ ${LDLIBS} + ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} @@ -48,7 +48,7 @@ fip_create: fip_create.sh %.o: %.c %.h Makefile @echo " CC $<" - ${Q}${CC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ + ${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ clean: $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} fip_create) -- 2.30.2