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 51ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_eal.a)) 52DPDK_LIB_EXT = .a 53else 54DPDK_LIB_EXT = .so 55endif 56 57DPDK_LIB_LIST = rte_eal rte_mempool rte_ring rte_mbuf 58 59# librte_mempool_ring was new added from DPDK 17.05. Link this library used for 60# ring based mempool management API. 61ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_mempool_ring.*)) 62DPDK_LIB_LIST += rte_mempool_ring 63endif 64 65# librte_malloc was removed after DPDK 2.1. Link this library conditionally based on its 66# existence to maintain backward compatibility. 67ifneq ($(wildcard $(DPDK_ABS_DIR)/lib/librte_malloc.*),) 68DPDK_LIB_LIST += rte_malloc 69endif 70 71# librte_pci and librte_bus_pci were added in DPDK 17.11. Link these libraries conditionally 72# based on their existence to maintain backward compatibility. 73ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_pci.*)) 74DPDK_LIB_LIST += rte_pci 75endif 76 77ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_bus_pci.*)) 78DPDK_LIB_LIST += rte_bus_pci 79endif 80 81# There are some complex dependencies when using crypto, reduce or both so 82# here we add the feature specific ones and set a flag to add the common 83# ones after that. 84DPDK_FRAMEWORK=n 85ifeq ($(CONFIG_CRYPTO),y) 86DPDK_FRAMEWORK=y 87DPDK_LIB_LIST += rte_pmd_aesni_mb rte_reorder 88endif 89 90ifeq ($(CONFIG_REDUCE),y) 91DPDK_FRAMEWORK=y 92DPDK_LIB_LIST += rte_pmd_isal_comp 93endif 94 95ifeq ($(DPDK_FRAMEWORK),y) 96DPDK_LIB_LIST += rte_cryptodev rte_compressdev rte_bus_vdev rte_pmd_qat 97endif 98 99ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_kvargs.*)) 100DPDK_LIB_LIST += rte_kvargs 101endif 102 103ifneq ($(CONFIG_VHOST_INTERNAL_LIB),y) 104ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_vhost.*)) 105DPDK_LIB_LIST += rte_vhost rte_net rte_hash 106ifneq ($(DPDK_FRAMEWORK),y) 107DPDK_LIB_LIST += rte_cryptodev 108endif 109endif 110endif 111 112DPDK_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%$(DPDK_LIB_EXT)) 113 114# SPDK memory registration requires experimental (deprecated) rte_memory API for DPDK 18.05 115ENV_CFLAGS = $(DPDK_INC) -Wno-deprecated-declarations 116ENV_CXXFLAGS = $(ENV_CFLAGS) 117ifeq ($(CONFIG_SHARED),y) 118ENV_DPDK_FILE = $(call spdk_lib_list_to_shared_libs,env_dpdk) 119else 120ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk) 121endif 122ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_LIB) 123ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive,--no-as-needed $(DPDK_LIB) -Wl,--no-whole-archive 124 125ifeq ($(CONFIG_IPSEC_MB),y) 126ENV_LINKER_ARGS += -lIPSec_MB -L$(IPSEC_MB_DIR) 127endif 128 129ifeq ($(CONFIG_REDUCE),y) 130ENV_LINKER_ARGS += -lisal -L$(ISAL_DIR)/.libs 131endif 132 133ifneq (,$(wildcard $(DPDK_INC_DIR)/rte_config.h)) 134ifneq (,$(shell grep -e "define RTE_LIBRTE_VHOST_NUMA 1" -e "define RTE_EAL_NUMA_AWARE_HUGEPAGES 1" $(DPDK_INC_DIR)/rte_config.h)) 135ENV_LINKER_ARGS += -lnuma 136endif 137endif 138 139ifeq ($(OS),Linux) 140ENV_LINKER_ARGS += -ldl 141endif 142ifeq ($(OS),FreeBSD) 143ENV_LINKER_ARGS += -lexecinfo 144endif 145