]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: fix cross-compiling tools when HOSTCC is overridden
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 13 Mar 2017 08:43:16 +0000 (17:43 +0900)
committerTom Rini <trini@konsulko.com>
Wed, 15 Mar 2017 00:40:22 +0000 (20:40 -0400)
Richard reported U-Boot tools issues in OpenEmbedded/Yocto project.

OE needs to be able to change the default compiler. If we pass in
HOSTCC through the make command, it overwrites all HOSTCC instances,
including ones in tools/Makefile and tools/env/Makefile, which breaks
"make cross_tools" and "make env", respectively.

Add "override" directives to avoid overriding HOSTCC instances that
really need to point to the cross-compiler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/Makefile
tools/env/Makefile

index 1c840d7ae2e7fb78f58a1e27ad1fe211b59411f0..a894b5c9d235a8f4181b506f4e37d9aff8b353d7 100644 (file)
@@ -262,7 +262,7 @@ $(LOGO_DATA_H):     $(obj)/bmp_logo $(LOGO_BMP)
 subdir- += env
 
 ifneq ($(CROSS_BUILD_TOOLS),)
-HOSTCC = $(CC)
+override HOSTCC = $(CC)
 
 quiet_cmd_crosstools_strip = STRIP   $^
       cmd_crosstools_strip = $(STRIP) $^; touch $@
index 38ad118d032fa65ee9de050b7f1ea13a29840e64..95b28c0b3a3c53e0b962e16aaba5d873cb00dff9 100644 (file)
@@ -8,7 +8,7 @@
 # fw_printenv is supposed to run on the target system, which means it should be
 # built with cross tools. Although it may look weird, we only replace "HOSTCC"
 # with "CC" here for the maximum code reuse of scripts/Makefile.host.
-HOSTCC = $(CC)
+override HOSTCC = $(CC)
 
 # Compile for a hosted environment on the target
 HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \