From patchwork Tue Jun 7 10:01:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Panu Matilainen X-Patchwork-Id: 13304 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id F18C89619; Tue, 7 Jun 2016 12:02:00 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id C56839616 for ; Tue, 7 Jun 2016 12:01:59 +0200 (CEST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C9F5811DF; Tue, 7 Jun 2016 10:01:59 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org.com (vpn1-5-73.ams2.redhat.com [10.36.5.73]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u57A1vmI001825; Tue, 7 Jun 2016 06:01:58 -0400 From: Panu Matilainen To: dev@dpdk.org Cc: christian.ehrhardt@canonical.com, thomas.monjalon@6wind.com, ferruh.yigit@intel.com Date: Tue, 7 Jun 2016 13:01:54 +0300 Message-Id: <62da0f5f31b2ab9db2dcc16acd2f8425a575a26f.1465293714.git.pmatilai@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 07 Jun 2016 10:01:59 +0000 (UTC) Subject: [dpdk-dev] [PATCH] mk: generate internal library dependencies from DEPDIRS-y automatically X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Up to now dependencies between DPDK internal libraries have been untracked at shared library level, requiring applications to know about library internal dependencies and often consequently overlinking. Since the dependencies are already recorded for build ordering in the makefiles, we can use that information to generate LDLIBS entries for internal libraries automatically. Also revert commit 8180554d82b3 ("vhost: fix linkage of driver with library") which is made redundant by this change. Signed-off-by: Panu Matilainen Acked-by: Christian Ehrhardt --- drivers/net/vhost/Makefile | 1 - mk/rte.lib.mk | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile index 30b91a0..f49a69b 100644 --- a/drivers/net/vhost/Makefile +++ b/drivers/net/vhost/Makefile @@ -38,7 +38,6 @@ LIB = librte_pmd_vhost.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -LDLIBS += -lrte_vhost EXPORT_MAP := rte_pmd_vhost_version.map diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index b420280..1ff403f 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -77,6 +77,13 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +# Ignore (sub)directory dependencies which do not provide an actual library +_IGNORE_DIRS = lib/librte_eal/% lib/librte_net lib/librte_compat +_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS-y)) +_LDDIRS = $(subst librte_ether,libethdev,$(_DEPDIRS)) +LDLIBS += $(subst lib/lib,-l,$(_LDDIRS)) + O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")