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