Assign CONFIG_CROSS_COMPILE to CROSS_COMPILE only
if CROSS_COMPILE is defined, so that CONFIG_CROSS_COMPILE
will not be erased in case it was set in `.config`
Signed-off-by: Dafna Hirschfeld <dafna3@xxxxxxxxx>
---
Makefile | 3 +++
arch/arm/arm/Compiler.uk | 2 +-
arch/arm/arm64/Compiler.uk | 2 +-
arch/x86/x86_64/Compiler.uk | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 1e2d035..efc94a1 100644
--- a/Makefile
+++ b/Makefile
@@ -390,7 +390,10 @@ unexport MACHINE
# "make" in the configured kernel build directory always uses that.
# Default value for CONFIG_CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CONFIG_CROSS_COMPILE in their
arch/*/Makefile.uk
+
+ifneq ("$(origin CROSS_COMPILE)","undefined")
CONFIG_CROSS_COMPILE := $(CROSS_COMPILE:"%"=%)
+endif
include $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compiler.uk
diff --git a/arch/arm/arm/Compiler.uk b/arch/arm/arm/Compiler.uk
index 44a497d..3345d03 100644
--- a/arch/arm/arm/Compiler.uk
+++ b/arch/arm/arm/Compiler.uk
@@ -1,5 +1,5 @@
# set cross compile
-ifeq ($(CONFIG_CROSS_COMPILE),)
+ifeq ($(call qstrip,$(CONFIG_CROSS_COMPILE)),)
ifneq ($(CONFIG_UK_ARCH),$(HOSTARCH))
CONFIG_CROSS_COMPILE := arm-linux-gnueabihf-
endif
diff --git a/arch/arm/arm64/Compiler.uk b/arch/arm/arm64/Compiler.uk
index 4572013..235346b 100644
--- a/arch/arm/arm64/Compiler.uk
+++ b/arch/arm/arm64/Compiler.uk
@@ -1,5 +1,5 @@
# set cross compile
-ifeq ($(CONFIG_CROSS_COMPILE),)
+ifeq ($(call qstrip,$(CONFIG_CROSS_COMPILE)),)
ifneq ($(CONFIG_UK_ARCH),$(HOSTARCH))
CONFIG_CROSS_COMPILE := aarch64-linux-gnu-
endif
diff --git a/arch/x86/x86_64/Compiler.uk b/arch/x86/x86_64/Compiler.uk
index 98ea8ad..dbe0971 100644
--- a/arch/x86/x86_64/Compiler.uk
+++ b/arch/x86/x86_64/Compiler.uk
@@ -1,5 +1,5 @@
# set cross compile
-ifeq ($(CONFIG_CROSS_COMPILE),)
+ifeq ($(call qstrip,$(CONFIG_CROSS_COMPILE)),)
ifneq ($(CONFIG_UK_ARCH),$(HOSTARCH))
CONFIG_CROSS_COMPILE := x86_64-linux-gnu-
endif