kbuild: fix CROSS_COMPILE settings in config.mk

The syntax
  CROSS_COMIPLE ?= <cross_compiler_prefix>
does not work because config.mk is parsed after
exporting CROSS_COMPILE.

Like Linux Kernel's arch/$(ARCH)/Makefile,
we must write as follows:

  ifeq ($(CROSS_COMPILE),)
  CROSS_COMPILE := <cross_compiler_prefix>
  endif

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
diff --git a/arch/arc/config.mk b/arch/arc/config.mk
index 76f4f7c..d9f5d9d 100644
--- a/arch/arc/config.mk
+++ b/arch/arc/config.mk
@@ -9,14 +9,18 @@
 endif
 
 ifdef CONFIG_SYS_LITTLE_ENDIAN
-CROSS_COMPILE ?= arc-buildroot-linux-uclibc-
+ARC_CROSS_COMPILE := arc-buildroot-linux-uclibc-
 endif
 
 ifdef CONFIG_SYS_BIG_ENDIAN
-CROSS_COMPILE ?= arceb-buildroot-linux-uclibc-
+ARC_CROSS_COMPILE := arceb-buildroot-linux-uclibc-
 PLATFORM_LDFLAGS += -EB
 endif
 
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := $(ARC_CROSS_COMPILE)
+endif
+
 PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -DCONFIG_ARC -gdwarf-2
 
 LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 1db80be..792cb43 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= arm-linux-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := arm-linux-
+endif
 
 ifndef CONFIG_STANDALONE_LOAD_ADDR
 ifneq ($(CONFIG_OMAP_COMMON),)
diff --git a/arch/avr32/config.mk b/arch/avr32/config.mk
index b9b9631..28a371c 100644
--- a/arch/avr32/config.mk
+++ b/arch/avr32/config.mk
@@ -5,7 +5,10 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= avr32-linux-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := avr32-linux-
+endif
+
 PLATFORM_CPPFLAGS += -DCONFIG_AVR32
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000
 
diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index c752025..adc9712 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= bfin-uclinux-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := bfin-uclinux-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x1000 -m elf32bfin
 
diff --git a/arch/m68k/config.mk b/arch/m68k/config.mk
index 79ae298..33b3d51 100644
--- a/arch/m68k/config.mk
+++ b/arch/m68k/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= m68k-elf-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := m68k-elf-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x20000
 
diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk
index fc545a9..cdb321a 100644
--- a/arch/microblaze/config.mk
+++ b/arch/microblaze/config.mk
@@ -8,7 +8,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= mb-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := mb-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000
 
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 2abdebb..1899f51 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= mips_4KC-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := mips_4KC-
+endif
 
 # Handle special prefix in ELDK 4.0 toolchain
 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
index 550f8a4..0cbc4ad 100644
--- a/arch/nds32/config.mk
+++ b/arch/nds32/config.mk
@@ -8,7 +8,9 @@
 #
 # SPDX-License-Identifier:	GPL-2.0+
 
-CROSS_COMPILE ?= nds32le-linux-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := nds32le-linux-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T $(srctree)/$(src)/nds32.lds
 
diff --git a/arch/nios2/config.mk b/arch/nios2/config.mk
index 7d546ef..65a5a40 100644
--- a/arch/nios2/config.mk
+++ b/arch/nios2/config.mk
@@ -6,7 +6,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= nios2-elf-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := nios2-elf-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x02000000
 
diff --git a/arch/openrisc/config.mk b/arch/openrisc/config.mk
index 13015eb..981edff 100644
--- a/arch/openrisc/config.mk
+++ b/arch/openrisc/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= or32-elf-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := or32-elf-
+endif
 
 # r10 used for global object pointer, already set in OR32 GCC but just to be
 # clear
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index f75c3bf..e398f97 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= ppc_8xx-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := ppc_8xx-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
 LDFLAGS_FINAL += --gc-sections
diff --git a/arch/sh/config.mk b/arch/sh/config.mk
index eefcbcd..0578fa3 100644
--- a/arch/sh/config.mk
+++ b/arch/sh/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= sh4-linux-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := sh4-linux-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x8C000000
 ifeq ($(CPU),sh2)
diff --git a/arch/sparc/config.mk b/arch/sparc/config.mk
index 9bb3724..e2327ec 100644
--- a/arch/sparc/config.mk
+++ b/arch/sparc/config.mk
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-CROSS_COMPILE ?= sparc-elf-
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := sparc-elf-
+endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \
 			-T $(srctree)/$(src)/sparc.lds