From patchwork Wed May 1 15:50:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 2507911 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 BDFD8DF230 for ; Wed, 1 May 2013 15:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761503Ab3EAPuk (ORCPT ); Wed, 1 May 2013 11:50:40 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:42919 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756020Ab3EAPuc (ORCPT ); Wed, 1 May 2013 11:50:32 -0400 Received: from mudshark.cambridge.arm.com (mudshark.cambridge.arm.com [10.1.203.36]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id r41FoJki024139; Wed, 1 May 2013 16:50:19 +0100 (BST) Received: by mudshark.cambridge.arm.com (Postfix, from userid 1000) id 73728C2B19; Wed, 1 May 2013 16:50:17 +0100 (BST) From: Will Deacon To: kvm@vger.kernel.org Cc: penberg@kernel.org, marc.zyngier@arm.com, anup@brainfault.org, rusty@rustcorp.com.au, pranavkumar@linaro.org, michael@ellerman.id.au, Will Deacon Subject: [RFC PATCH 01/11] kvm tools: makefile: factor out libfdt inclusion Date: Wed, 1 May 2013 16:50:06 +0100 Message-Id: <1367423416-24640-2-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1367423416-24640-1-git-send-email-will.deacon@arm.com> References: <1367423416-24640-1-git-send-email-will.deacon@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org libfdt is used by powerpc, arm and arm64. This patch factors out the Makefile parts including it and defines a CONFIG_HAS_LIBFDT, so architecture-portable code can make use of fdt if it is available. Signed-off-by: Will Deacon --- tools/kvm/Makefile | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile index a0a0a9b..cb1a9b4 100644 --- a/tools/kvm/Makefile +++ b/tools/kvm/Makefile @@ -114,9 +114,6 @@ ifeq ($(ARCH),x86_64) DEFINES += -DCONFIG_X86_64 endif -LIBFDT_SRC = fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o -LIBFDT_OBJS = $(patsubst %,../../scripts/dtc/libfdt/%,$(LIBFDT_SRC)) - ### Arch-specific stuff #x86 @@ -150,12 +147,10 @@ ifeq ($(ARCH), powerpc) OBJS += powerpc/spapr_hvcons.o OBJS += powerpc/spapr_pci.o OBJS += powerpc/xics.o -# We use libfdt, but it's sometimes not packaged 64bit. It's small too, -# so just build it in: - CFLAGS += -I../../scripts/dtc/libfdt - OTHEROBJS += $(LIBFDT_OBJS) ARCH_INCLUDE := powerpc/include CFLAGS += -m64 + + ARCH_WANT_LIBFDT := y endif # ARM @@ -170,8 +165,8 @@ ifeq ($(ARCH), arm) ARCH_INCLUDE := $(HDRS_ARM_COMMON) ARCH_INCLUDE += -Iarm/aarch32/include CFLAGS += -march=armv7-a - CFLAGS += -I../../scripts/dtc/libfdt - OTHEROBJS += $(LIBFDT_OBJS) + + ARCH_WANT_LIBFDT := y endif # ARM64 @@ -182,8 +177,8 @@ ifeq ($(ARCH), arm64) OBJS += arm/aarch64/kvm-cpu.o ARCH_INCLUDE := $(HDRS_ARM_COMMON) ARCH_INCLUDE += -Iarm/aarch64/include - CFLAGS += -I../../scripts/dtc/libfdt - OTHEROBJS += $(LIBFDT_OBJS) + + ARCH_WANT_LIBFDT := y endif ### @@ -196,6 +191,18 @@ endif ### +# libfdt support + +LIBFDT_SRC = fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o +LIBFDT_OBJS = $(patsubst %,../../scripts/dtc/libfdt/%,$(LIBFDT_SRC)) + +ifeq (y,$(ARCH_WANT_LIBFDT)) + DEFINES += -DCONFIG_HAS_LIBFDT + OTHEROBJS += $(LIBFDT_OBJS) +endif + +### + # Detect optional features. # On a given system, some libs may link statically, some may not; so, check # both and only build those that link! @@ -285,7 +292,7 @@ DEFINES += -DKVMTOOLS_VERSION='"$(KVMTOOLS_VERSION)"' DEFINES += -DBUILD_ARCH='"$(ARCH)"' KVM_INCLUDE := include -CFLAGS += $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include/uapi -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/uapi -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O2 -fno-strict-aliasing -g +CFLAGS += $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include/uapi -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/uapi -I$(KINCL_PATH)/arch/$(ARCH)/include/ -I$(KINCL_PATH)/scripts/dtc/libfdt -O2 -fno-strict-aliasing -g WARNINGS += -Wall WARNINGS += -Wformat=2