From aaa87dc00ef8dca32fe19d0662e67c1d12b1cd1d Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 25 Jan 2017 17:23:37 -0700 Subject: [PATCH] env_dpdk: allow linking against DPDK shared libs Detect whether the specified DPDK directory contains static or shared libraries, and use the appropriate extension when building the library list. Static libraries are still preferred. Change-Id: I78c68fd38fba1ea42dd605fb77209651f8cdca75 Signed-off-by: Daniel Verkamp --- lib/env_dpdk/env.mk | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/env_dpdk/env.mk b/lib/env_dpdk/env.mk index 0116b321c..8efffa9e9 100644 --- a/lib/env_dpdk/env.mk +++ b/lib/env_dpdk/env.mk @@ -54,15 +54,23 @@ DPDK_INC = -I$(DPDK_ABS_DIR)/include else DPDK_INC = -I$(DPDK_ABS_DIR)/include/dpdk endif -DPDK_LIB = $(DPDK_ABS_DIR)/lib/librte_eal.a $(DPDK_ABS_DIR)/lib/librte_mempool.a \ - $(DPDK_ABS_DIR)/lib/librte_ring.a + +ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_eal.a)) +DPDK_LIB_EXT = .a +else +DPDK_LIB_EXT = .so +endif + +DPDK_LIB_LIST = rte_eal rte_mempool rte_ring # librte_malloc was removed after DPDK 2.1. Link this library conditionally based on its # existence to maintain backward compatibility. ifneq ($(wildcard $(DPDK_ABS_DIR)/lib/librte_malloc.*),) -DPDK_LIB += $(DPDK_ABS_DIR)/lib/librte_malloc.a +DPDK_LIB_LIST += rte_malloc endif +DPDK_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%$(DPDK_LIB_EXT)) + ENV_CFLAGS = $(DPDK_INC) ENV_CXXFLAGS = $(ENV_CFLAGS) ENV_DPDK_FILE = $(call spdk_lib_list_to_files,env_dpdk)