From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49CBDA04AA; Tue, 8 Sep 2020 00:08:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A663E1C19A; Tue, 8 Sep 2020 00:07:34 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 3E9CD1C120 for ; Tue, 8 Sep 2020 00:07:30 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E19C05C002F; Mon, 7 Sep 2020 18:07:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 07 Sep 2020 18:07:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=+SZkVop2R1Qnf U5XL3c/Wm6vMeQbQcorNLbQkRHbPao=; b=o+OApbvfI0ZVsJpdS7q4enbOUEi4b rPjfp2hkXyqlUKVR38xSmrRnX2A1nOsf8ZELGcDs0hKC3liEg5SLWRfRvMdCNTTg qlDsroMBb++dPmZEX8afGkgVs6/H2mZ3hXTAoQ476X4KyFpa0hYc51kBH3+8Fa/v 5CoxW2++gNDSQ6aibGavqPoiTyUOQYaxPqDkSozQ/hfvYJPpT/pxU47vUr4yupXZ 7kjKjIYbB1GOysF6sRsx8v3X/52t/fLxl7uvttfQsN+C1OdWLa1Wex7y6MPuskU4 AkQXorJdpUzr10NYuPvjtuuDpmi30uESX36Lzb31qAi/ZglsJzvfbZt5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=+SZkVop2R1QnfU5XL3c/Wm6vMeQbQcorNLbQkRHbPao=; b=DepKLsSt 5SG3qqeFoK3DAbC/FGUY2/vKnE6QsxQP2KNdf8e1CkkfeJNZeEWFHgFcoI+6trEm KRh6VE/laqzVzx1zSldgdzLOZYOptHr0QJ56FLjqGviaV6er5Hjg4CywaahUUDhM xi2vozPoQBa9sUWJ9A+Ac29Qs3/Wtjj9U0G0VhhZgJ5aoTG4U/0PHfx5qxZqWKU+ jK6aZUGQKy41XMJt/OszuvZrYlbekpPi1H7FPE/1MO3Fb5M7kuNAkeWN1B55Tzsj 0dXQH8oWvqDAtq2PR5wFWkfXLOHc58OtPwYAplcuYpZJ89kdc5l7dQQy0ii2GOOx SvB7v254DoTs0A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudehuddgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvieeivedvffelffdttd duffduuedugfelvdelkefgteejkeekhfeiledvueefkeenucffohhmrghinhepvhgrrhhs rdhmkhdpghhnuhdrohhrghdpvgigthgrphhprdhmkhenucfkphepjeejrddufeegrddvtd efrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 1539F3280059; Mon, 7 Sep 2020 18:07:29 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, bruce.richardson@intel.com, ciara.power@intel.com Date: Tue, 8 Sep 2020 00:06:47 +0200 Message-Id: <20200907220711.437405-8-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907220711.437405-1-thomas@monjalon.net> References: <20200903152717.42095-1-ciara.power@intel.com> <20200907220711.437405-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 07/31] examples/vm_power: convert to pkg-config-based build X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Bruce Richardson Convert the makefiles to build using pkg-config rather than the old build system. Signed-off-by: Bruce Richardson --- examples/vm_power_manager/Makefile | 76 ++++++++++---------- examples/vm_power_manager/guest_cli/Makefile | 50 ++++++++----- 2 files changed, 67 insertions(+), 59 deletions(-) diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile index 65c2ad179e..87b9744d8c 100644 --- a/examples/vm_power_manager/Makefile +++ b/examples/vm_power_manager/Makefile @@ -1,65 +1,61 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2014 Intel Corporation +# Copyright(c) 2010-2020 Intel Corporation -ifneq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0) -$(error vm_power_manager requires libvirt >= 0.9.3) -else - -ifeq ($(RTE_SDK),) -$(error "Please define RTE_SDK environment variable") +# Build using pkg-config variables if possible +ifneq ($(shell pkg-config --exists libdpdk && echo 0),0) +$(error "no installation of DPDK found") endif -# Default target, detect a build directory, by looking for a path with a .config -RTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) - -include $(RTE_SDK)/mk/rte.vars.mk - # binary name APP = vm_power_mgr # all source are stored in SRCS-y SRCS-y := main.c vm_power_cli.c power_manager.c channel_manager.c SRCS-y += channel_monitor.c parse.c -ifeq ($(CONFIG_RTE_ARCH_X86_64),y) +ifeq ($(shell uname -m),x86_64) SRCS-y += oob_monitor_x86.c else SRCS-y += oob_monitor_nop.c endif -CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/ -CFLAGS += $(WERROR_FLAGS) -CFLAGS += -DALLOW_EXPERIMENTAL_API +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) -LDLIBS += -lvirt +PKGCONF ?= pkg-config -JANSSON := $(shell pkg-config --exists jansson; echo $$?) +PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) +CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) +LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) + +ifneq ($(shell $(PKGCONF) --atleast-version=0.9.3 libvirt; echo $$?), 0) +$(error vm_power_manager requires libvirt >= 0.9.3) +endif +LDFLAGS += $(shell $(PKGCONF) --libs libvirt) + +JANSSON := $(shell $(PKGCONF) --exists jansson; echo $$?) ifeq ($(JANSSON), 0) -LDLIBS += $(shell pkg-config --libs jansson) +LDFLAGS += $(shell $(PKGCONF) --libs jansson) CFLAGS += -DUSE_JANSSON endif -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +# for shared library builds, we need to explicitly link these PMDs +LDFLAGS_SHARED += -lrte_pmd_ixgbe -lrte_pmd_i40e -lrte_pmd_bnxt -ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y) -LDLIBS += -lrte_pmd_ixgbe -endif +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y) -LDLIBS += -lrte_pmd_i40e -endif +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) -ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y) -LDLIBS += -lrte_pmd_bnxt -endif +build: + @mkdir -p $@ -endif - -# workaround for a gcc bug with noreturn attribute -# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 -ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) -CFLAGS_main.o += -Wno-return-type -endif - -include $(RTE_SDK)/mk/rte.extapp.mk - -endif # libvirt check +.PHONY: clean +clean: + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared + test -d build && rmdir -p build || true diff --git a/examples/vm_power_manager/guest_cli/Makefile b/examples/vm_power_manager/guest_cli/Makefile index 67cf081936..b84deec574 100644 --- a/examples/vm_power_manager/guest_cli/Makefile +++ b/examples/vm_power_manager/guest_cli/Makefile @@ -1,14 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2014 Intel Corporation - -ifeq ($(RTE_SDK),) -$(error "Please define RTE_SDK environment variable") -endif - -# Default target, detect a build directory, by looking for a path with a .config -RTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) - -include $(RTE_SDK)/mk/rte.vars.mk +# Copyright(c) 2010-2020 Intel Corporation # binary name APP = guest_vm_power_mgr @@ -16,14 +7,35 @@ APP = guest_vm_power_mgr # all source are stored in SRCS-y SRCS-y := main.c vm_power_cli_guest.c parse.c -CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/ -CFLAGS += $(WERROR_FLAGS) -CFLAGS += -DALLOW_EXPERIMENTAL_API - -# workaround for a gcc bug with noreturn attribute -# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 -ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) -CFLAGS_main.o += -Wno-return-type +# Build using pkg-config variables if possible +ifneq ($(shell pkg-config --exists libdpdk && echo 0),0) +$(error "no installation of DPDK found") endif -include $(RTE_SDK)/mk/rte.extapp.mk +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + +PKGCONF ?= pkg-config + +PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) +CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) +LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) + +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) + +build: + @mkdir -p $@ + +.PHONY: clean +clean: + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared + test -d build && rmdir -p build || true -- 2.28.0