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