From patchwork Thu Jun 18 15:50:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 486359 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4E28514028F for ; Fri, 19 Jun 2015 01:50:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754943AbbFRPuk (ORCPT ); Thu, 18 Jun 2015 11:50:40 -0400 Received: from foss.arm.com ([217.140.101.70]:42908 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754705AbbFRPui (ORCPT ); Thu, 18 Jun 2015 11:50:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 158552A; Thu, 18 Jun 2015 08:50:56 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.203.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1EFF03F212; Thu, 18 Jun 2015 08:50:36 -0700 (PDT) From: Andre Przywara To: will.deacon@arm.com Cc: Michael Ellerman , Matt Evans , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH] kvmtool: Makefile: allow overriding CC and LD Date: Thu, 18 Jun 2015 16:50:47 +0100 Message-Id: <1434642647-3127-1-git-send-email-andre.przywara@arm.com> X-Mailer: git-send-email 2.3.5 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Currently we set CC unconditionally to ${CROSS_COMPILE}gcc, the same for LD. Allow people to override the compiler name by specifying it explicitly on the command line or via the environment. Beside calling a certain compiler binary this allows to pass in options to the compiler, which lets us get rid of the PowerPC overrides in the Makefile. Possible uses: $ make CC="gcc -m64" LD="ld -melf64ppc" (build kvmtool on a PowerPC toolchain defaulting to 32-bit) $ make CC="gcc -m32" LD="ld -melf_i386" (build a 32-bit binary on a multilib-enabled x86-64 compiler) Signed-off-by: Andre Przywara --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 6110b8e..888bee5 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,13 @@ export E Q include config/utilities.mak include config/feature-tests.mak -CC := $(CROSS_COMPILE)gcc +ifeq ($(origin CC), default) + CC := $(CROSS_COMPILE)gcc +endif CFLAGS := -LD := $(CROSS_COMPILE)ld +ifeq ($(origin LD), default) + LD := $(CROSS_COMPILE)ld +endif LDFLAGS := FIND := find @@ -148,8 +152,6 @@ ifeq ($(ARCH), powerpc) OBJS += powerpc/spapr_pci.o OBJS += powerpc/xics.o ARCH_INCLUDE := powerpc/include - CFLAGS += -m64 - LDFLAGS += -m elf64ppc ARCH_WANT_LIBFDT := y endif