]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Support cross compilation
authorMichael Ellerman <michael@ellerman.id.au>
Wed, 4 Jul 2012 13:18:57 +0000 (23:18 +1000)
committerPekka Enberg <penberg@kernel.org>
Wed, 4 Jul 2012 14:12:20 +0000 (17:12 +0300)
Allow CROSS_COMPILE to be used to prefix CC as is done in the kernel
Makefile. If CROSS_COMPILE is unset it has no effect, and still allows
CC to be overridden.

We need to fix a few places to use ARCH instead of uname_M directly, so
that the overridden setting of ARCH takes effect.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/Makefile

index 7a9d3b65089504c6090c54430bd4cab7f05b1717..501387b5c0930f5a128b4fcaf352e934cac7ff43 100644 (file)
@@ -19,6 +19,8 @@ export E Q KINCL_PATH
 include config/utilities.mak
 include config/feature-tests.mak
 
+CC     := $(CROSS_COMPILE)$(CC)
+
 FIND   := find
 CSCOPE := cscope
 TAGS   := ctags
@@ -96,11 +98,11 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
                   -e s/sh[234].*/sh/ )
 
 uname_M      := $(shell uname -m | sed -e s/i.86/i386/)
-ifeq ($(uname_M),i386)
+ifeq ($(ARCH),i386)
        ARCH         := x86
        DEFINES      += -DCONFIG_X86_32
 endif
-ifeq ($(uname_M),x86_64)
+ifeq ($(ARCH),x86_64)
        ARCH         := x86
        DEFINES      += -DCONFIG_X86_64
 endif
@@ -128,7 +130,7 @@ ifeq ($(ARCH),x86)
        ARCH_INCLUDE := x86/include
 endif
 # POWER/ppc:  Actually only support ppc64 currently.
-ifeq ($(uname_M), ppc64)
+ifeq ($(ARCH), powerpc)
        DEFINES += -DCONFIG_PPC
        OBJS    += powerpc/boot.o
        OBJS    += powerpc/ioport.o