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