1# 2# BSD LICENSE 3# 4# Copyright (c) Intel Corporation. 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 11# * Redistributions of source code must retain the above copyright 12# notice, this list of conditions and the following disclaimer. 13# * Redistributions in binary form must reproduce the above copyright 14# notice, this list of conditions and the following disclaimer in 15# the documentation and/or other materials provided with the 16# distribution. 17# * Neither the name of Intel Corporation nor the names of its 18# contributors may be used to endorse or promote products derived 19# from this software without specific prior written permission. 20# 21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32# 33 34# This makefile snippet must define the following flags: 35# ENV_CFLAGS 36# ENV_CXXFLAGS 37# ENV_LIBS 38# ENV_LINKER_ARGS 39 40DPDK_DIR = $(CONFIG_DPDK_DIR) 41 42export DPDK_ABS_DIR = $(abspath $(DPDK_DIR)) 43 44ifneq (, $(wildcard $(DPDK_ABS_DIR)/include/rte_config.h)) 45DPDK_INC_DIR := $(DPDK_ABS_DIR)/include 46else 47DPDK_INC_DIR := $(DPDK_ABS_DIR)/include/dpdk 48endif 49DPDK_INC := -I$(DPDK_INC_DIR) 50 51DPDK_LIB_LIST = rte_eal rte_mempool rte_ring rte_mbuf rte_pci rte_bus_pci rte_mempool_ring 52 53# DPDK 20.05 eal dependency 54ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_telemetry.*)) 55DPDK_LIB_LIST += rte_telemetry 56endif 57 58# There are some complex dependencies when using crypto, reduce or both so 59# here we add the feature specific ones and set a flag to add the common 60# ones after that. 61DPDK_FRAMEWORK=n 62ifeq ($(CONFIG_CRYPTO),y) 63DPDK_FRAMEWORK=y 64DPDK_LIB_LIST += rte_pmd_aesni_mb rte_reorder 65endif 66 67ifeq ($(CONFIG_REDUCE),y) 68DPDK_FRAMEWORK=y 69DPDK_LIB_LIST += rte_pmd_isal 70endif 71 72ifeq ($(DPDK_FRAMEWORK),y) 73DPDK_LIB_LIST += rte_cryptodev rte_compressdev rte_bus_vdev rte_pmd_qat 74endif 75 76ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_kvargs.*)) 77DPDK_LIB_LIST += rte_kvargs 78endif 79 80LINK_HASH=n 81 82ifeq ($(CONFIG_VHOST),y) 83ifneq ($(CONFIG_VHOST_INTERNAL_LIB),y) 84DPDK_LIB_LIST += rte_vhost rte_net 85LINK_HASH=y 86ifneq ($(DPDK_FRAMEWORK),y) 87DPDK_LIB_LIST += rte_cryptodev 88endif 89endif 90endif 91 92ifeq ($(CONFIG_RAID5),y) 93LINK_HASH=y 94endif 95 96ifeq ($(LINK_HASH),y) 97DPDK_LIB_LIST += rte_hash 98endif 99 100DPDK_SHARED_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%.so) 101DPDK_STATIC_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%.a) 102DPDK_SHARED_LIB_LINKER_ARGS = $(call add_no_as_needed,$(DPDK_SHARED_LIB)) 103DPDK_STATIC_LIB_LINKER_ARGS = $(call add_whole_archive,$(DPDK_STATIC_LIB)) 104 105# SPDK memory registration requires experimental (deprecated) rte_memory API for DPDK 18.05 106ENV_CFLAGS = $(DPDK_INC) -Wno-deprecated-declarations 107ENV_CXXFLAGS = $(ENV_CFLAGS) 108 109DPDK_PRIVATE_LINKER_ARGS = 110 111ifeq ($(CONFIG_IPSEC_MB),y) 112DPDK_PRIVATE_LINKER_ARGS += -lIPSec_MB -L$(IPSEC_MB_DIR) 113endif 114 115ifeq ($(CONFIG_REDUCE),y) 116DPDK_PRIVATE_LINKER_ARGS += -lisal -L$(ISAL_DIR)/.libs 117endif 118 119ifneq (,$(wildcard $(DPDK_INC_DIR)/rte_config.h)) 120ifneq (,$(shell grep -e "define RTE_LIBRTE_VHOST_NUMA 1" -e "define RTE_EAL_NUMA_AWARE_HUGEPAGES 1" $(DPDK_INC_DIR)/rte_config.h)) 121DPDK_PRIVATE_LINKER_ARGS += -lnuma 122endif 123endif 124 125# DPDK built with meson puts those defines elsewhere 126ifneq (,$(wildcard $(DPDK_INC_DIR)/rte_build_config.h)) 127ifneq (,$(shell grep -e "define RTE_LIBRTE_VHOST_NUMA 1" -e "define RTE_EAL_NUMA_AWARE_HUGEPAGES 1" $(DPDK_INC_DIR)/rte_build_config.h)) 128DPDK_PRIVATE_LINKER_ARGS += -lnuma 129endif 130endif 131 132ifeq ($(OS),Linux) 133DPDK_PRIVATE_LINKER_ARGS += -ldl 134endif 135ifeq ($(OS),FreeBSD) 136DPDK_PRIVATE_LINKER_ARGS += -lexecinfo 137endif 138 139ifeq ($(CONFIG_SHARED),y) 140ENV_DPDK_FILE = $(call spdk_lib_list_to_shared_libs,env_dpdk) 141ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_SHARED_LIB) 142DPDK_LINKER_ARGS = -Wl,-rpath-link $(DPDK_ABS_DIR)/lib $(DPDK_SHARED_LIB_LINKER_ARGS) 143ENV_LINKER_ARGS = $(ENV_DPDK_FILE) $(DPDK_LINKER_ARGS) 144else 145ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk) 146ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_STATIC_LIB) 147DPDK_LINKER_ARGS = -Wl,-rpath-link $(DPDK_ABS_DIR)/lib $(DPDK_STATIC_LIB_LINKER_ARGS) 148ENV_LINKER_ARGS = $(ENV_DPDK_FILE) $(DPDK_LINKER_ARGS) 149ENV_LINKER_ARGS += $(DPDK_PRIVATE_LINKER_ARGS) 150endif 151