From patchwork Wed Jul 4 13:18:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 1156041 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F2622DFFF7 for ; Wed, 4 Jul 2012 13:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752271Ab2GDNU1 (ORCPT ); Wed, 4 Jul 2012 09:20:27 -0400 Received: from ozlabs.org ([203.10.76.45]:56367 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751962Ab2GDNUW (ORCPT ); Wed, 4 Jul 2012 09:20:22 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id C96062C01BC; Wed, 4 Jul 2012 23:20:20 +1000 (EST) From: Michael Ellerman To: kvm@vger.kernel.org Cc: penberg@kernel.org, levinsasha928@gmail.com, asias.hejun@gmail.com, Subject: [PATCH 3/4] kvm tools: Support cross compilation Date: Wed, 4 Jul 2012 23:18:57 +1000 Message-Id: <1341407938-23478-3-git-send-email-michael@ellerman.id.au> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1341407938-23478-1-git-send-email-michael@ellerman.id.au> References: <1341407938-23478-1-git-send-email-michael@ellerman.id.au> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- Tested on x86_64 and powerpc, and cross compiling powerpc. I don't have an i386 box around sorry. --- tools/kvm/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile index 7a9d3b6..501387b 100644 --- a/tools/kvm/Makefile +++ b/tools/kvm/Makefile @@ -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