diff mbox series

tools/Makefile: fix {C,LD}FLAGS with CROSS_BUILD_TOOLS

Message ID 20211016165741.320646-1-fontaine.fabrice@gmail.com
State Deferred
Delegated to: Tom Rini
Headers show
Series tools/Makefile: fix {C,LD}FLAGS with CROSS_BUILD_TOOLS | expand

Commit Message

Fabrice Fontaine Oct. 16, 2021, 4:57 p.m. UTC
When CROSS_BUILD_TOOLS is set, set KBUILD_HOST{CF,LD}FLAGS to
{C,LD}FLAGS otherwise CC will be used with HOST{C,LD}FLAGS which seems
wrong.

It should be noted that, for an unknown reason, overriding
HOST{C,LD}FLAGS don't work.

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 tools/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/Makefile b/tools/Makefile
index 4a86321f64..98bb92990d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -316,7 +316,8 @@  subdir- += env
 
 ifneq ($(CROSS_BUILD_TOOLS),)
 override HOSTCC = $(CC)
-override HOSTCFLAGS = $(CFLAGS)
+override KBUILD_HOSTCFLAGS = $(CFLAGS)
+override KBUILD_HOSTLDFLAGS = $(LDFLAGS)
 
 quiet_cmd_crosstools_strip = STRIP   $^
       cmd_crosstools_strip = $(STRIP) $^; touch $@