Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | # Copyright (c) 2015 Cisco and/or its affiliates. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at: |
| 5 | # |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # |
| 8 | # Unless required by applicable law or agreed to in writing, software |
| 9 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. |
| 13 | |
| 14 | # Scripts require non-POSIX parts of bash |
| 15 | SHELL := /bin/bash |
| 16 | |
| 17 | DPDK_BUILD_DIR ?= $(CURDIR)/_build |
| 18 | DPDK_INSTALL_DIR ?= $(CURDIR)/_install |
Damjan Marion | 1901020 | 2016-03-24 17:17:47 +0100 | [diff] [blame] | 19 | DPDK_PKTMBUF_HEADROOM ?= 128 |
Damjan Marion | 3473e49 | 2018-02-24 19:21:14 +0100 | [diff] [blame] | 20 | DPDK_CACHE_LINE_SIZE ?= 64 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 21 | DPDK_DOWNLOAD_DIR ?= $(HOME)/Downloads |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 22 | DPDK_DEBUG ?= n |
Damjan Marion | 6a5be21 | 2017-05-11 14:55:43 +0200 | [diff] [blame] | 23 | DPDK_MLX4_PMD ?= n |
Damjan Marion | 696f1ad | 2016-12-23 22:42:41 +0100 | [diff] [blame] | 24 | DPDK_MLX5_PMD ?= n |
Rui Cai | 60bd302 | 2018-05-11 21:52:22 +0000 | [diff] [blame] | 25 | DPDK_TAP_PMD ?= n |
| 26 | DPDK_FAILSAFE_PMD ?= n |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 27 | |
| 28 | B := $(DPDK_BUILD_DIR) |
| 29 | I := $(DPDK_INSTALL_DIR) |
Damjan Marion | 7ee1182 | 2018-08-12 00:26:55 +0200 | [diff] [blame] | 30 | DPDK_VERSION ?= 18.08 |
Matthew Smith | 7fc631f | 2018-08-28 13:42:09 -0500 | [diff] [blame^] | 31 | PKG_SUFFIX ?= vpp2 |
Damjan Marion | de3ff7a | 2017-11-29 12:28:38 +0100 | [diff] [blame] | 32 | DPDK_BASE_URL ?= http://fast.dpdk.org/rel |
Thomas Monjalon | 96e10b5 | 2016-06-02 14:52:32 +0200 | [diff] [blame] | 33 | DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz |
Damjan Marion | dab123b | 2016-03-29 16:43:58 +0200 | [diff] [blame] | 34 | DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL) |
Damjan Marion | 0e969ac | 2018-06-06 14:23:42 +0200 | [diff] [blame] | 35 | DPDK_18.05_TARBALL_MD5_CKSUM := 9fc86367cd9407ff6a8dfea56c4eddc4 |
Damjan Marion | 3bf6c2b | 2018-08-12 00:26:45 +0200 | [diff] [blame] | 36 | DPDK_18.08_TARBALL_MD5_CKSUM := da5e7fb25ab063c47e53929fb8c58be5 |
Damjan Marion | 5f22f4d | 2017-08-21 22:19:04 +0200 | [diff] [blame] | 37 | MACHINE=$(shell uname -m) |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 38 | |
Damjan Marion | 0e969ac | 2018-06-06 14:23:42 +0200 | [diff] [blame] | 39 | # replace dot with space, and if 3rd word exists we deal with stable dpdk rel |
| 40 | ifeq ($(word 3,$(subst ., ,$(DPDK_VERSION))),) |
| 41 | DPDK_SOURCE := $(B)/dpdk-$(DPDK_VERSION) |
| 42 | else |
| 43 | DPDK_SOURCE := $(B)/dpdk-stable-$(DPDK_VERSION) |
| 44 | endif |
| 45 | |
Sergio Gonzalez Monroy | 6184db3 | 2017-10-27 08:58:38 +0100 | [diff] [blame] | 46 | NASM_BASE_URL := http://www.nasm.us/pub/nasm/releasebuilds |
Marco Varlese | a74ee1f | 2018-08-20 14:41:20 +0200 | [diff] [blame] | 47 | NASM_VER := 2.13.03 |
Sergio Gonzalez Monroy | 6184db3 | 2017-10-27 08:58:38 +0100 | [diff] [blame] | 48 | NASM_TARBALL := nasm-$(NASM_VER).tar.xz |
| 49 | NASM_TAR_URL := $(NASM_BASE_URL)/$(NASM_VER)/$(NASM_TARBALL) |
| 50 | NASM_SOURCE := $(B)/nasm-$(NASM_VER) |
| 51 | |
Damjan Marion | 0e969ac | 2018-06-06 14:23:42 +0200 | [diff] [blame] | 52 | ifneq (,$(findstring 18.02,$(DPDK_VERSION))) |
Damjan Marion | 07510dd | 2018-02-15 11:59:04 +0100 | [diff] [blame] | 53 | IPSEC_MB_VER ?= 0.48 |
Damjan Marion | 0e969ac | 2018-06-06 14:23:42 +0200 | [diff] [blame] | 54 | else |
| 55 | IPSEC_MB_VER ?= 0.49 |
Damjan Marion | 45b4850 | 2017-11-17 09:46:41 +0100 | [diff] [blame] | 56 | endif |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 57 | |
Marco Varlese | 8ddd518 | 2017-08-14 16:07:00 +0200 | [diff] [blame] | 58 | ifeq ($(MACHINE),$(filter $(MACHINE),x86_64)) |
Thomas F Herbert | 4b0ac82 | 2017-08-29 16:07:51 -0400 | [diff] [blame] | 59 | AESNI ?= y |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 60 | $(info Building IPSec-MB $(IPSEC_MB_VER) library) |
Thomas F Herbert | 4b0ac82 | 2017-08-29 16:07:51 -0400 | [diff] [blame] | 61 | else |
| 62 | AESNI ?= N |
Marco Varlese | 8ddd518 | 2017-08-14 16:07:00 +0200 | [diff] [blame] | 63 | endif |
| 64 | |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 65 | AESNIMB_LIB_TARBALL := v$(IPSEC_MB_VER).tar.gz |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 66 | AESNIMB_LIB_TARBALL_URL := http://github.com/01org/intel-ipsec-mb/archive/$(AESNIMB_LIB_TARBALL) |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 67 | AESNIMB_LIB_SOURCE := $(B)/intel-ipsec-mb-$(IPSEC_MB_VER) |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 68 | |
Damjan Marion | e39a7b8 | 2016-04-26 14:54:57 +0200 | [diff] [blame] | 69 | ifneq (,$(findstring clang,$(CC))) |
| 70 | DPDK_CC=clang |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 71 | else ifneq (,$(findstring icc,$(CC))) |
| 72 | DPDK_CC=icc |
Damjan Marion | e39a7b8 | 2016-04-26 14:54:57 +0200 | [diff] [blame] | 73 | else |
| 74 | DPDK_CC=gcc |
| 75 | endif |
| 76 | |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 77 | ############################################################################## |
Damjan Marion | 1664f9b | 2017-04-24 20:48:53 +0200 | [diff] [blame] | 78 | # Intel x86 |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 79 | ############################################################################## |
Damjan Marion | 1664f9b | 2017-04-24 20:48:53 +0200 | [diff] [blame] | 80 | ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686)) |
| 81 | DPDK_TARGET ?= $(MACHINE)-native-linuxapp-$(DPDK_CC) |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 82 | DPDK_MACHINE ?= nhm |
| 83 | DPDK_TUNE ?= core-avx2 |
Brian Brooks | a719184 | 2017-09-06 13:19:48 -0500 | [diff] [blame] | 84 | |
| 85 | ############################################################################## |
| 86 | # ARM64 |
| 87 | ############################################################################## |
Brian Brooks | 9746552 | 2017-08-28 13:05:26 -0500 | [diff] [blame] | 88 | else ifeq ($(MACHINE),aarch64) |
Bin Huang | 096e6be | 2018-05-24 16:43:19 +0800 | [diff] [blame] | 89 | CROSS := |
| 90 | export CROSS |
Brian Brooks | 9746552 | 2017-08-28 13:05:26 -0500 | [diff] [blame] | 91 | DPDK_TARGET ?= arm64-armv8a-linuxapp-$(DPDK_CC) |
| 92 | DPDK_MACHINE ?= armv8a |
| 93 | DPDK_TUNE ?= generic |
Brian Brooks | a719184 | 2017-09-06 13:19:48 -0500 | [diff] [blame] | 94 | |
| 95 | CPU_IMP_ARM = 0x41 |
| 96 | CPU_IMP_CAVIUM = 0x43 |
| 97 | |
| 98 | CPU_PART_ARM_CORTEX_A53 = 0xd03 |
| 99 | CPU_PART_ARM_CORTEX_A57 = 0xd07 |
| 100 | CPU_PART_ARM_CORTEX_A72 = 0xd08 |
| 101 | CPU_PART_ARM_CORTEX_A73 = 0xd09 |
| 102 | |
| 103 | CPU_PART_CAVIUM_THUNDERX = 0x0a1 |
| 104 | CPU_PART_CAVIUM_THUNDERX_81XX = 0x0a2 |
| 105 | CPU_PART_CAVIUM_THUNDERX_83XX = 0x0a3 |
| 106 | |
| 107 | MIDR_IMPLEMENTER=$(shell awk '/implementer/ {print $$4;exit}' /proc/cpuinfo) |
| 108 | MIDR_PARTNUM=$(shell awk '/part/ {print $$4;exit}' /proc/cpuinfo) |
| 109 | |
| 110 | ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_ARM)) |
| 111 | ############################################################################## |
| 112 | # Arm Cortex |
| 113 | ############################################################################## |
| 114 | CPU_PART_ARM_TUNE := $(CPU_PART_ARM_CORTEX_A53)/cortex-a53 \ |
| 115 | $(CPU_PART_ARM_CORTEX_A57)/cortex-a57 \ |
| 116 | $(CPU_PART_ARM_CORTEX_A72)/cortex-a72 \ |
| 117 | $(CPU_PART_ARM_CORTEX_A73)/cortex-a73 |
| 118 | CPU_TUNE = $(notdir $(filter $(MIDR_PARTNUM)/%,$(CPU_PART_ARM_TUNE))) |
| 119 | ifneq ($(CPU_TUNE),) |
| 120 | DPDK_TUNE = $(CPU_TUNE) |
| 121 | else |
| 122 | $(warning Unknown Arm CPU) |
| 123 | endif |
| 124 | |
| 125 | else ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_CAVIUM)) |
| 126 | ############################################################################## |
| 127 | # Cavium ThunderX |
| 128 | ############################################################################## |
| 129 | ifneq (,$(findstring $(MIDR_PARTNUM),$(CPU_PART_CAVIUM_THUNDERX) \ |
| 130 | $(CPU_PART_CAVIUM_THUNDERX_81XX) $(CPU_PART_CAVIUM_THUNDERX_83XX))) |
| 131 | DPDK_TARGET = arm64-thunderx-linuxapp-$(DPDK_CC) |
| 132 | DPDK_MACHINE = thunderx |
Dave Barach | 473f461 | 2018-05-29 17:06:45 -0400 | [diff] [blame] | 133 | DPDK_CACHE_LINE_SIZE := 128 |
Brian Brooks | a719184 | 2017-09-06 13:19:48 -0500 | [diff] [blame] | 134 | else |
| 135 | $(warning Unknown Cavium CPU) |
| 136 | endif |
Brian Brooks | 9746552 | 2017-08-28 13:05:26 -0500 | [diff] [blame] | 137 | endif |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 138 | |
| 139 | ############################################################################## |
Brian Brooks | a719184 | 2017-09-06 13:19:48 -0500 | [diff] [blame] | 140 | # Unknown platform |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 141 | ############################################################################## |
| 142 | else |
Brian Brooks | a719184 | 2017-09-06 13:19:48 -0500 | [diff] [blame] | 143 | $(error Unknown platform) |
Christophe Fontaine | 737547e | 2016-05-11 08:40:33 +0000 | [diff] [blame] | 144 | endif |
| 145 | |
Chris Luke | b2861e8 | 2017-06-14 11:24:41 -0400 | [diff] [blame] | 146 | # /proc/cpuinfo does not exist on platforms without a /proc and on some |
| 147 | # platforms, notably inside containers, it has no content. In those cases |
| 148 | # we assume there's 1 processor; we use 2*ncpu for the -j option. |
| 149 | # NB: GNU Make 4.2 will let us use '$(file </proc/cpuinfo)' to both test |
| 150 | # for file presence and content; for now this will have to do. |
| 151 | JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\ |
Damjan Marion | 9324284 | 2017-11-13 20:09:21 +0100 | [diff] [blame] | 152 | $(shell grep -c ^processor /proc/cpuinfo), 2) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 153 | |
| 154 | # compiler/linker custom arguments |
Sirshak Das | 6495c4b | 2018-05-29 21:06:28 -0500 | [diff] [blame] | 155 | ifeq ($(DPDK_CC),clang) |
| 156 | DPDK_CPU_CFLAGS := -fPIE -fPIC |
| 157 | else |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 158 | DPDK_CPU_CFLAGS := -pie -fPIC |
Sirshak Das | 6495c4b | 2018-05-29 21:06:28 -0500 | [diff] [blame] | 159 | endif |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 160 | |
| 161 | ifeq ($(DPDK_DEBUG),n) |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 162 | DPDK_EXTRA_CFLAGS := -g -mtune=$(DPDK_TUNE) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 163 | else |
Damjan Marion | e39a7b8 | 2016-04-26 14:54:57 +0200 | [diff] [blame] | 164 | DPDK_EXTRA_CFLAGS := -g -O0 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 165 | endif |
| 166 | |
Lijian Zhang | f315410 | 2018-08-07 11:11:58 +0800 | [diff] [blame] | 167 | # -Wimplicit-fallthrough was introduced starting from GCC 7, |
| 168 | # and it requires newer version of ccache. |
| 169 | # Disable fallthrough warning for old ccache version. |
| 170 | ifeq ($(DPDK_CC),gcc) |
| 171 | GCC_VER_V = "7.0.0" |
| 172 | CCACHE_VER_V = "3.4.1" |
| 173 | GCC_VER = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') |
| 174 | CCACHE_VER = $(shell ccache --version | grep ^ccache | sed 's/^.* //g') |
| 175 | ifeq ($(shell expr "$(GCC_VER)" ">=" "$(GCC_VER_V)"),1) |
| 176 | ifeq ($(shell expr "$(CCACHE_VER)" "<" "$(CCACHE_VER_V)"),1) |
| 177 | DPDK_EXTRA_CFLAGS += -Wimplicit-fallthrough=0 |
| 178 | endif |
| 179 | endif |
| 180 | endif |
| 181 | |
Damjan Marion | 0e969ac | 2018-06-06 14:23:42 +0200 | [diff] [blame] | 182 | ifeq ($(AESNI),y) |
| 183 | IPSEC_MB_BUILD_PATH := $(B)/intel-ipsec-mb-$(IPSEC_MB_VER) |
| 184 | DPDK_EXTRA_CFLAGS += -L$(IPSEC_MB_BUILD_PATH) -I$(IPSEC_MB_BUILD_PATH) |
| 185 | endif |
| 186 | |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 187 | DPDK_MAKE_EXTRA_ARGS += AESNI_MULTI_BUFFER_LIB_PATH=$(AESNIMB_LIB_SOURCE) |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 188 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 189 | # assemble DPDK make arguments |
| 190 | DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \ |
| 191 | T=$(DPDK_TARGET) \ |
| 192 | RTE_CONFIG_TEMPLATE=../custom-config \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 193 | EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \ |
| 194 | EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \ |
| 195 | CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \ |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 196 | DESTDIR=$(I) \ |
Christophe Fontaine | 737547e | 2016-05-11 08:40:33 +0000 | [diff] [blame] | 197 | $(DPDK_MAKE_EXTRA_ARGS) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 198 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 199 | define set |
| 200 | @if grep -q CONFIG_$1 $@ ; \ |
| 201 | then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \ |
| 202 | else echo CONFIG_$1=$2 >> $@ ; \ |
| 203 | fi |
| 204 | endef |
| 205 | |
| 206 | all: build |
| 207 | |
| 208 | $(B)/custom-config: $(B)/.patch.ok Makefile |
Damjan Marion | 106f0ed | 2016-04-26 10:44:28 +0200 | [diff] [blame] | 209 | @echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) --- |
| 210 | @cpp -undef -ffreestanding -x assembler-with-cpp $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) $@ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 211 | $(call set,RTE_MACHINE,$(DPDK_MACHINE)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 212 | @# modify options |
Damjan Marion | 13f0718 | 2016-02-05 06:44:54 -0800 | [diff] [blame] | 213 | $(call set,RTE_MAX_LCORE,256) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 214 | $(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM)) |
Damjan Marion | 3473e49 | 2018-02-24 19:21:14 +0100 | [diff] [blame] | 215 | $(call set,RTE_CACHE_LINE_SIZE,$(DPDK_CACHE_LINE_SIZE)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 216 | $(call set,RTE_LIBEAL_USE_HPET,y) |
| 217 | $(call set,RTE_BUILD_COMBINE_LIBS,y) |
Damjan Marion | a155680 | 2016-06-26 20:12:40 +0200 | [diff] [blame] | 218 | $(call set,RTE_PCI_CONFIG,y) |
| 219 | $(call set,RTE_PCI_EXTENDED_TAG,"on") |
| 220 | $(call set,RTE_PCI_MAX_READ_REQUEST_SIZE,4096) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 221 | @# enable debug init for device drivers |
| 222 | $(call set,RTE_LIBRTE_I40E_DEBUG_INIT,$(DPDK_DEBUG)) |
| 223 | $(call set,RTE_LIBRTE_IXGBE_DEBUG_INIT,$(DPDK_DEBUG)) |
| 224 | $(call set,RTE_LIBRTE_E1000_DEBUG_INIT,$(DPDK_DEBUG)) |
| 225 | $(call set,RTE_LIBRTE_VIRTIO_DEBUG_INIT,$(DPDK_DEBUG)) |
| 226 | $(call set,RTE_LIBRTE_VMXNET3_DEBUG_INIT,$(DPDK_DEBUG)) |
John Lo | d9bf9ab | 2016-02-25 11:17:55 -0500 | [diff] [blame] | 227 | $(call set,RTE_LIBRTE_PMD_BOND,y) |
| 228 | $(call set,RTE_LIBRTE_IP_FRAG,y) |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 229 | $(call set,RTE_LIBRTE_PMD_QAT,y) |
Sergio Gonzalez Monroy | 618f7b0 | 2017-07-19 16:22:28 +0100 | [diff] [blame] | 230 | $(call set,RTE_LIBRTE_PMD_AESNI_MB,$(AESNI)) |
| 231 | $(call set,RTE_LIBRTE_PMD_AESNI_GCM,$(AESNI)) |
Damjan Marion | 6a5be21 | 2017-05-11 14:55:43 +0200 | [diff] [blame] | 232 | $(call set,RTE_LIBRTE_MLX4_PMD,$(DPDK_MLX4_PMD)) |
Damjan Marion | 696f1ad | 2016-12-23 22:42:41 +0100 | [diff] [blame] | 233 | $(call set,RTE_LIBRTE_MLX5_PMD,$(DPDK_MLX5_PMD)) |
Damjan Marion | 3bf6c2b | 2018-08-12 00:26:45 +0200 | [diff] [blame] | 234 | $(call set,RTE_LIBRTE_PMD_SOFTNIC,n) |
Amir Zeidner | 0e7fe4f | 2018-03-05 14:32:22 +0200 | [diff] [blame] | 235 | $(call set,RTE_LIBRTE_MLX4_DLOPEN_DEPS,$(DPDK_MLX4_PMD)) |
| 236 | $(call set,RTE_LIBRTE_MLX5_DLOPEN_DEPS,$(DPDK_MLX5_PMD)) |
Rui Cai | 60bd302 | 2018-05-11 21:52:22 +0000 | [diff] [blame] | 237 | $(call set,RTE_LIBRTE_PMD_TAP,$(DPDK_TAP_PMD)) |
| 238 | $(call set,RTE_LIBRTE_PMD_FAILSAFE,$(DPDK_FAILSAFE_PMD)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 239 | @# not needed |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 240 | $(call set,RTE_LIBRTE_CFGFILE,n) |
| 241 | $(call set,RTE_LIBRTE_LPM,n) |
| 242 | $(call set,RTE_LIBRTE_ACL,n) |
| 243 | $(call set,RTE_LIBRTE_POWER,n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 244 | $(call set,RTE_LIBRTE_DISTRIBUTOR,n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 245 | $(call set,RTE_LIBRTE_PORT,n) |
| 246 | $(call set,RTE_LIBRTE_TABLE,n) |
| 247 | $(call set,RTE_LIBRTE_PIPELINE,n) |
Damjan Marion | 45b4850 | 2017-11-17 09:46:41 +0100 | [diff] [blame] | 248 | $(call set,RTE_LIBRTE_FLOW_CLASSIFY,n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 249 | $(call set,RTE_KNI_KMOD,n) |
Damjan Marion | 68fda1c | 2017-01-01 16:53:22 +0100 | [diff] [blame] | 250 | $(call set,RTE_EAL_IGB_UIO,n) |
Marco Varlese | 1355fcd | 2018-02-22 16:03:35 +0100 | [diff] [blame] | 251 | @# currently broken in 18.02 |
| 252 | $(call set,RTE_LIBRTE_DPAA_BUS,n) |
| 253 | $(call set,RTE_LIBRTE_DPAA_MEMPOOL,n) |
| 254 | $(call set,RTE_LIBRTE_DPAA_PMD,n) |
| 255 | $(call set,RTE_LIBRTE_PMD_DPAA_SEC,n) |
| 256 | $(call set,RTE_LIBRTE_PMD_DPAA_EVENTDEV,n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 257 | @rm -f .config.ok |
| 258 | |
| 259 | $(CURDIR)/$(DPDK_TARBALL): |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 260 | @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \ |
| 261 | then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \ |
| 262 | else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \ |
| 263 | fi |
| 264 | @rm -f $(B)/.download.ok |
| 265 | |
Sergio Gonzalez Monroy | 6184db3 | 2017-10-27 08:58:38 +0100 | [diff] [blame] | 266 | $(CURDIR)/$(NASM_TARBALL): |
| 267 | @if [ -e $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) ] ; \ |
| 268 | then cp $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) $(CURDIR) ; \ |
| 269 | else curl -o $(CURDIR)/$(NASM_TARBALL) -LO $(NASM_TAR_URL) ; \ |
| 270 | fi |
| 271 | |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 272 | $(CURDIR)/$(AESNIMB_LIB_TARBALL): |
| 273 | @if [ -e $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) ] ; \ |
| 274 | then cp $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) $(CURDIR) ; \ |
| 275 | else curl -o $@ -LO $(AESNIMB_LIB_TARBALL_URL) ; \ |
| 276 | fi |
| 277 | |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 278 | DPDK_DOWNLOADS = $(CURDIR)/$(DPDK_TARBALL) |
Sergio Gonzalez Monroy | 618f7b0 | 2017-07-19 16:22:28 +0100 | [diff] [blame] | 279 | ifeq ($(AESNI),y) |
Sergio Gonzalez Monroy | 6184db3 | 2017-10-27 08:58:38 +0100 | [diff] [blame] | 280 | DPDK_DOWNLOADS += $(CURDIR)/$(NASM_TARBALL) |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 281 | DPDK_DOWNLOADS += $(CURDIR)/$(AESNIMB_LIB_TARBALL) |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 282 | endif |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 283 | |
| 284 | $(B)/.download.ok: $(DPDK_DOWNLOADS) |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 285 | @mkdir -p $(B) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 286 | @openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum |
Damjan Marion | bce6b6a | 2015-12-16 04:27:37 +0100 | [diff] [blame] | 287 | @([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 288 | ( echo "Bad Checksum! Please remove $< and retry" && \ |
| 289 | rm $(B)/$(DPDK_TARBALL).md5sum && false )) |
| 290 | @touch $@ |
| 291 | |
| 292 | .PHONY: download |
| 293 | download: $(B)/.download.ok |
| 294 | |
| 295 | $(B)/.extract.ok: $(B)/.download.ok |
| 296 | @echo --- extracting $(DPDK_TARBALL) --- |
Thomas Monjalon | 96e10b5 | 2016-06-02 14:52:32 +0200 | [diff] [blame] | 297 | @tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL) |
Marco Varlese | 8ddd518 | 2017-08-14 16:07:00 +0200 | [diff] [blame] | 298 | ifeq ($(AESNI),y) |
Sergio Gonzalez Monroy | 6184db3 | 2017-10-27 08:58:38 +0100 | [diff] [blame] | 299 | @echo --- extracting $(NASM_TARBALL) --- |
| 300 | @tar --directory $(B) --extract --file $(CURDIR)/$(NASM_TARBALL) |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 301 | @echo --- extracting $(AESNIMB_LIB_TARBALL) --- |
| 302 | @tar --directory $(B) --extract --file $(CURDIR)/$(AESNIMB_LIB_TARBALL) |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 303 | endif |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 304 | @touch $@ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 305 | |
| 306 | .PHONY: extract |
| 307 | extract: $(B)/.extract.ok |
| 308 | |
| 309 | $(B)/.patch.ok: $(B)/.extract.ok |
Damjan Marion | 0df78dd | 2016-03-29 22:37:02 +0200 | [diff] [blame] | 310 | ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 311 | @echo --- patching --- |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 312 | @for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 313 | echo Applying patch: $$(basename $$f) ; \ |
| 314 | patch -p1 -d $(DPDK_SOURCE) < $$f ; \ |
| 315 | done |
Damjan Marion | 0df78dd | 2016-03-29 22:37:02 +0200 | [diff] [blame] | 316 | endif |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 317 | @touch $@ |
| 318 | |
| 319 | .PHONY: patch |
| 320 | patch: $(B)/.patch.ok |
| 321 | |
| 322 | $(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config |
| 323 | @make $(DPDK_MAKE_ARGS) config |
| 324 | @touch $@ |
| 325 | |
| 326 | .PHONY: config |
| 327 | config: $(B)/.config.ok |
| 328 | |
Sergio Gonzalez Monroy | 6184db3 | 2017-10-27 08:58:38 +0100 | [diff] [blame] | 329 | .PHONY: build-nasm |
| 330 | build-nasm: |
| 331 | cd $(NASM_SOURCE) && sh configure && make -j |
| 332 | |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 333 | .PHONY: build-ipsec-mb |
| 334 | build-ipsec-mb: |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 335 | mkdir -p $(I)/lib/ |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 336 | # Do not build GCM stuff if we are building ISA_L |
Damjan Marion | 0e969ac | 2018-06-06 14:23:42 +0200 | [diff] [blame] | 337 | make -C $(AESNIMB_LIB_SOURCE) -j SHARED=n \ |
Damjan Marion | 66e0ce8 | 2018-02-21 11:37:24 +0100 | [diff] [blame] | 338 | EXTRA_CFLAGS=-fPIC NASM=$(NASM_SOURCE)/nasm |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 339 | cp $(AESNIMB_LIB_SOURCE)/libIPSec_MB.a $(I)/lib/ |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 340 | |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 341 | .PHONY: build-dpdk |
| 342 | build-dpdk: |
| 343 | @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 344 | @make $(DPDK_MAKE_ARGS) install |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 345 | |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 346 | # Order matters |
| 347 | ifeq ($(AESNI),y) |
Sergio Gonzalez Monroy | 6184db3 | 2017-10-27 08:58:38 +0100 | [diff] [blame] | 348 | BUILD_TARGETS += build-nasm |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 349 | BUILD_TARGETS += build-ipsec-mb |
| 350 | endif |
Sergio Gonzalez Monroy | acdc306 | 2017-08-24 14:09:17 +0100 | [diff] [blame] | 351 | BUILD_TARGETS += build-dpdk |
| 352 | |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 353 | $(B)/.build.ok: $(BUILD_TARGETS) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 354 | @touch $@ |
| 355 | |
| 356 | .PHONY: build |
| 357 | build: $(B)/.build.ok |
| 358 | |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 359 | .PHONY: install |
| 360 | install: $(B)/.build.ok |
| 361 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 362 | .PHONY: clean |
| 363 | clean: |
| 364 | @rm -rf $(B) $(I) |
| 365 | |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 366 | ############################################################################## |
| 367 | # .deb packaging |
| 368 | ############################################################################## |
| 369 | |
| 370 | DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null) |
| 371 | DEV_DEB=vpp-dpdk-dev_$(DPDK_VERSION)-$(PKG_SUFFIX)_$(DEB_ARCH).deb |
| 372 | INSTALLED_DEB_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-dpdk-dev 2> /dev/null) |
| 373 | |
| 374 | .PHONY: build-deb install-deb check-deb |
| 375 | |
| 376 | deb/debian/changelog: Makefile |
| 377 | @echo "vpp-dpdk ($(DPDK_VERSION)-$(PKG_SUFFIX)) unstable; urgency=low" > $@ |
| 378 | @echo "" >> $@ |
| 379 | @echo " * DPDK Release $(DPDK_VERSION)" >> $@ |
| 380 | @echo "" >> $@ |
| 381 | @echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R)" >> $@ |
| 382 | |
| 383 | $(DEV_DEB): deb/debian/changelog |
| 384 | @cd deb && dpkg-buildpackage -b -uc -us |
| 385 | git clean -fdx deb |
| 386 | |
| 387 | build-deb: $(DEV_DEB) |
| 388 | |
| 389 | install-deb: |
| 390 | ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
Ed Warnicke | 798150b | 2017-11-08 13:39:31 -0700 | [diff] [blame] | 391 | @echo "==========================================================" |
| 392 | @echo " Out of date DPDK package installed." |
| 393 | @echo " Installed: $(INSTALLED_DEB_VER)" |
| 394 | @echo " Needed: $(DPDK_VERSION)-$(PKG_SUFFIX)" |
| 395 | @echo "==========================================================" |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 396 | @make $(DEV_DEB) |
| 397 | @sudo dpkg -i $(DEV_DEB) |
| 398 | else |
| 399 | @echo "==========================================================" |
| 400 | @echo " Up-to-date DPDK package already installed" |
| 401 | @echo "==========================================================" |
| 402 | endif |
| 403 | |
| 404 | check-deb: |
| 405 | ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
| 406 | @echo "==========================================================" |
| 407 | @echo " Outdated DPDK package detected:" |
| 408 | @echo " Installed: vpp-dpdk-dev $(INSTALLED_DEB_VER)" |
| 409 | @echo " Current: vpp-dpdk-dev $(DPDK_VERSION)-$(PKG_SUFFIX)" |
| 410 | @echo "" |
| 411 | @echo " Please upgrade by invoking 'make dpdk-install-dev'" |
| 412 | @echo " from the top level directory." |
| 413 | @echo "==========================================================" |
| 414 | endif |
| 415 | |
| 416 | ############################################################################## |
| 417 | # .rpm packaging |
| 418 | ############################################################################## |
| 419 | |
| 420 | RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null) |
| 421 | DEV_RPM=vpp-dpdk-devel-$(DPDK_VERSION)-$(PKG_SUFFIX).$(RPM_ARCH).rpm |
Damjan Marion | 248968b | 2017-01-20 23:59:28 +0100 | [diff] [blame] | 422 | INSTALLED_RPM_VER=$(shell rpm -q --queryformat '%{VERSION}-%{RELEASE}' vpp-dpdk-devel 2> /dev/null | grep -v "not inst") |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 423 | |
| 424 | .PHONY: build-rpm install-rpm check-rpm |
| 425 | |
| 426 | $(DEV_RPM): Makefile rpm/vpp-dpdk.spec |
| 427 | @rpmbuild -bb \ |
| 428 | --define "_topdir $(CURDIR)/rpm" \ |
| 429 | --define "_version $(DPDK_VERSION)" \ |
| 430 | --define "_release $(PKG_SUFFIX)" \ |
| 431 | $(CURDIR)/rpm/vpp-dpdk.spec |
| 432 | mv rpm/RPMS/$(RPM_ARCH)/*.rpm . |
| 433 | git clean -fdx rpm |
| 434 | |
| 435 | build-rpm: $(DEV_RPM) |
| 436 | |
| 437 | install-rpm: |
| 438 | ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
Sergio Gonzalez Monroy | 3b12cdc | 2017-06-06 15:29:16 +0100 | [diff] [blame] | 439 | @$(MAKE) $(DEV_RPM) |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 440 | sudo rpm -Uih $(DEV_RPM) |
| 441 | else |
| 442 | @echo "==========================================================" |
| 443 | @echo " Up-to-date DPDK package already installed" |
| 444 | @echo "==========================================================" |
| 445 | endif |
| 446 | |
| 447 | check-rpm: |
| 448 | ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
| 449 | @echo "==========================================================" |
| 450 | @echo " Outdated DPDK package detected:" |
| 451 | @echo " Installed: vpp-dpdk-devel $(INSTALLED_RPM_VER)" |
| 452 | @echo " Current: vpp-dpdk-devel $(DPDK_VERSION)-$(PKG_SUFFIX)" |
| 453 | @echo "" |
| 454 | @echo " Please upgrade by invoking 'make dpdk-install-dev'" |
| 455 | @echo " from the top level directory." |
| 456 | @echo "==========================================================" |
| 457 | endif |
| 458 | |
| 459 | ############################################################################## |
| 460 | # ebuild support |
| 461 | ############################################################################## |
| 462 | |
| 463 | .PHONY: ebuild-build ebuild-install |
| 464 | |
| 465 | ebuild-build: |
| 466 | ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),) |
| 467 | @echo "==========================================================" |
| 468 | @echo "Building DPDK from source. Consider installing development" |
| 469 | @echo "package by invoking 'make dpdk-install-dev' from the" |
| 470 | @echo "top level directory" |
| 471 | @echo "==========================================================" |
| 472 | make config |
| 473 | else |
| 474 | ifneq ($(INSTALLED_DEB_VER),) |
| 475 | make check-deb |
| 476 | endif |
| 477 | ifneq ($(INSTALLED_RPM_VER),) |
| 478 | make check-rpm |
| 479 | endif |
| 480 | endif |
| 481 | |
| 482 | ebuild-install: |
| 483 | ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),) |
| 484 | make install |
| 485 | endif |