[PATCH] kbuild: honor the ARCH setting of the existing configuration

From: Aunt Tillie
Date: Sun Jul 31 2011 - 15:45:11 EST


This change make Kbuild honor the ARCH setting of the existing configuration, if
any .config is present so that it does not get reset if there is a conflict
with the default ARCH for the platform and the current setting.

Signed-off-by: Arnaud Lacombe aka. Aunt Tillie <lacombar@xxxxxxxxx>
---
Makefile | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index f676d15..bb2f1fc 100644
--- a/Makefile
+++ b/Makefile
@@ -192,7 +192,12 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
-ARCH ?= $(SUBARCH)
+ifeq ($(shell test -e .config && echo y),y)
+ARCH ?= $(shell sed '/^\# Linux\/\(.*\) .* Kernel Configuration/!d; s//\1/' .config)
+endif
+ifeq ($(ARCH),)
+ARCH := $(SUBARCH)
+endif
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)

# Architecture as present in compile.h
--
1.7.6.153.g78432

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/