]>
Commit | Line | Data |
---|---|---|
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 | 40 | DPDK_DIR = $(CONFIG_DPDK_DIR) |
7c673cae | 41 | |
7c673cae | 42 | export DPDK_ABS_DIR = $(abspath $(DPDK_DIR)) |
7c673cae FG |
43 | |
44 | ifneq (, $(wildcard $(DPDK_ABS_DIR)/include/rte_config.h)) | |
11fdf7f2 | 45 | DPDK_INC_DIR := $(DPDK_ABS_DIR)/include |
7c673cae | 46 | else |
11fdf7f2 | 47 | DPDK_INC_DIR := $(DPDK_ABS_DIR)/include/dpdk |
7c673cae | 48 | endif |
11fdf7f2 | 49 | DPDK_INC := -I$(DPDK_INC_DIR) |
7c673cae FG |
50 | |
51 | ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_eal.a)) | |
52 | DPDK_LIB_EXT = .a | |
53 | else | |
54 | DPDK_LIB_EXT = .so | |
55 | endif | |
56 | ||
57 | DPDK_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. | |
61 | ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_mempool_ring.*)) | |
62 | DPDK_LIB_LIST += rte_mempool_ring | |
63 | endif | |
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. | |
67 | ifneq ($(wildcard $(DPDK_ABS_DIR)/lib/librte_malloc.*),) | |
68 | DPDK_LIB_LIST += rte_malloc | |
69 | endif | |
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. | |
73 | ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_pci.*)) | |
74 | DPDK_LIB_LIST += rte_pci | |
75 | endif | |
76 | ||
77 | ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_bus_pci.*)) | |
78 | DPDK_LIB_LIST += rte_bus_pci | |
79 | endif | |
80 | ||
81 | ifeq ($(CONFIG_CRYPTO),y) | |
82 | DPDK_LIB_LIST += rte_cryptodev rte_reorder rte_bus_vdev rte_pmd_aesni_mb rte_pmd_qat rte_mbuf | |
83 | endif | |
84 | ||
85 | ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_kvargs.*)) | |
86 | DPDK_LIB_LIST += rte_kvargs | |
87 | endif | |
88 | ||
7c673cae | 89 | DPDK_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%$(DPDK_LIB_EXT)) |
11fdf7f2 TL |
90 | ifeq ($(CONFIG_CRYPTO),y) |
91 | DPDK_LIB += $(SPDK_ROOT_DIR)/intel-ipsec-mb/libIPSec_MB.a | |
92 | endif | |
7c673cae | 93 | |
11fdf7f2 TL |
94 | # SPDK memory registration requires experimental (deprecated) rte_memory API for DPDK 18.05 |
95 | ENV_CFLAGS = $(DPDK_INC) -Wno-deprecated-declarations | |
7c673cae | 96 | ENV_CXXFLAGS = $(ENV_CFLAGS) |
11fdf7f2 | 97 | ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk) |
7c673cae | 98 | ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_LIB) |
11fdf7f2 TL |
99 | ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive $(DPDK_LIB) -Wl,--no-whole-archive |
100 | ||
101 | ifneq (,$(wildcard $(DPDK_INC_DIR)/rte_config.h)) | |
102 | ifneq (,$(shell grep -e "define RTE_LIBRTE_VHOST_NUMA 1" -e "define RTE_EAL_NUMA_AWARE_HUGEPAGES 1" $(DPDK_INC_DIR)/rte_config.h)) | |
103 | ENV_LINKER_ARGS += -lnuma | |
104 | endif | |
105 | endif | |
7c673cae FG |
106 | |
107 | ifeq ($(OS),Linux) | |
108 | ENV_LINKER_ARGS += -ldl | |
109 | endif | |
110 | ifeq ($(OS),FreeBSD) | |
111 | ENV_LINKER_ARGS += -lexecinfo | |
112 | endif |