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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-01-25 17:23:37 -07:00
parent bc7b070deb
commit aaa87dc00e

View File

@ -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)