]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/lib/env_dpdk/env.mk
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / lib / env_dpdk / env.mk
CommitLineData
7c673cae
FG
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
11fdf7f2 40DPDK_DIR = $(CONFIG_DPDK_DIR)
7c673cae 41
7c673cae 42export DPDK_ABS_DIR = $(abspath $(DPDK_DIR))
7c673cae
FG
43
44ifneq (, $(wildcard $(DPDK_ABS_DIR)/include/rte_config.h))
11fdf7f2 45DPDK_INC_DIR := $(DPDK_ABS_DIR)/include
7c673cae 46else
11fdf7f2 47DPDK_INC_DIR := $(DPDK_ABS_DIR)/include/dpdk
7c673cae 48endif
11fdf7f2 49DPDK_INC := -I$(DPDK_INC_DIR)
7c673cae
FG
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
58
11fdf7f2
TL
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
7c673cae
FG
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
11fdf7f2
TL
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
81ifeq ($(CONFIG_CRYPTO),y)
82DPDK_LIB_LIST += rte_cryptodev rte_reorder rte_bus_vdev rte_pmd_aesni_mb rte_pmd_qat rte_mbuf
83endif
84
85ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_kvargs.*))
86DPDK_LIB_LIST += rte_kvargs
87endif
88
7c673cae 89DPDK_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%$(DPDK_LIB_EXT))
11fdf7f2
TL
90ifeq ($(CONFIG_CRYPTO),y)
91DPDK_LIB += $(SPDK_ROOT_DIR)/intel-ipsec-mb/libIPSec_MB.a
92endif
7c673cae 93
11fdf7f2
TL
94# SPDK memory registration requires experimental (deprecated) rte_memory API for DPDK 18.05
95ENV_CFLAGS = $(DPDK_INC) -Wno-deprecated-declarations
7c673cae 96ENV_CXXFLAGS = $(ENV_CFLAGS)
11fdf7f2 97ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk)
7c673cae 98ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_LIB)
11fdf7f2
TL
99ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive $(DPDK_LIB) -Wl,--no-whole-archive
100
101ifneq (,$(wildcard $(DPDK_INC_DIR)/rte_config.h))
102ifneq (,$(shell grep -e "define RTE_LIBRTE_VHOST_NUMA 1" -e "define RTE_EAL_NUMA_AWARE_HUGEPAGES 1" $(DPDK_INC_DIR)/rte_config.h))
103ENV_LINKER_ARGS += -lnuma
104endif
105endif
7c673cae
FG
106
107ifeq ($(OS),Linux)
108ENV_LINKER_ARGS += -ldl
109endif
110ifeq ($(OS),FreeBSD)
111ENV_LINKER_ARGS += -lexecinfo
112endif