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 |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 22 | DPDK_CRYPTO_SW_PMD ?= 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 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 25 | |
| 26 | B := $(DPDK_BUILD_DIR) |
| 27 | I := $(DPDK_INSTALL_DIR) |
Damjan Marion | 6a5be21 | 2017-05-11 14:55:43 +0200 | [diff] [blame] | 28 | DPDK_VERSION ?= 17.05 |
Sergio Gonzalez Monroy | 0e2e10b | 2017-03-22 15:22:14 +0000 | [diff] [blame] | 29 | PKG_SUFFIX ?= vpp4 |
Thomas Monjalon | 96e10b5 | 2016-06-02 14:52:32 +0200 | [diff] [blame] | 30 | DPDK_BASE_URL ?= http://fast.dpdk.org/rel |
| 31 | DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz |
Damjan Marion | dab123b | 2016-03-29 16:43:58 +0200 | [diff] [blame] | 32 | DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL) |
Damjan Marion | 4983e47 | 2017-02-16 20:28:35 +0100 | [diff] [blame] | 33 | DPDK_17.02_TARBALL_MD5_CKSUM := 6b9f7387c35641f4e8dbba3e528f2376 |
Damjan Marion | 6a5be21 | 2017-05-11 14:55:43 +0200 | [diff] [blame] | 34 | DPDK_17.05_TARBALL_MD5_CKSUM := 0a68c31cd6a6cabeed0a4331073e4c05 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 35 | DPDK_SOURCE := $(B)/dpdk-$(DPDK_VERSION) |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 36 | |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 37 | ifeq ($(DPDK_CRYPTO_SW_PMD),y) |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 38 | AESNIMB_LIB_TARBALL := v0.44-gcm.2.tar.gz |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 39 | AESNIMB_LIB_TARBALL_URL := http://github.com/01org/intel-ipsec-mb/archive/$(AESNIMB_LIB_TARBALL) |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 40 | AESNIMB_LIB_SOURCE := $(B)/intel-ipsec-mb-0.44-gcm.2 |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 41 | ISA_L_CRYPTO_LIB_TARBALL := isa_l_crypto.tar.gz |
| 42 | ISA_L_CRYPTO_LIB_TARBALL_URL := http://github.com/01org/isa-l_crypto/archive/master.tar.gz |
| 43 | ISA_L_CRYPTO_LIB_SOURCE := $(B)/isa-l_crypto-master |
Sergio Gonzalez Monroy | 0e2e10b | 2017-03-22 15:22:14 +0000 | [diff] [blame] | 44 | ISA_L_CRYPTO_INSTALL_DIR := $(ISA_L_CRYPTO_LIB_SOURCE)/install |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 45 | endif |
Damjan Marion | e39a7b8 | 2016-04-26 14:54:57 +0200 | [diff] [blame] | 46 | |
| 47 | ifneq (,$(findstring clang,$(CC))) |
| 48 | DPDK_CC=clang |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 49 | else ifneq (,$(findstring icc,$(CC))) |
| 50 | DPDK_CC=icc |
Damjan Marion | e39a7b8 | 2016-04-26 14:54:57 +0200 | [diff] [blame] | 51 | else |
| 52 | DPDK_CC=gcc |
| 53 | endif |
| 54 | |
Damjan Marion | 1664f9b | 2017-04-24 20:48:53 +0200 | [diff] [blame] | 55 | MACHINE=$(shell uname -m) |
| 56 | |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 57 | ############################################################################## |
Damjan Marion | 1664f9b | 2017-04-24 20:48:53 +0200 | [diff] [blame] | 58 | # Intel x86 |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 59 | ############################################################################## |
Damjan Marion | 1664f9b | 2017-04-24 20:48:53 +0200 | [diff] [blame] | 60 | ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686)) |
| 61 | DPDK_TARGET ?= $(MACHINE)-native-linuxapp-$(DPDK_CC) |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 62 | DPDK_MACHINE ?= nhm |
| 63 | DPDK_TUNE ?= core-avx2 |
Christophe Fontaine | 737547e | 2016-05-11 08:40:33 +0000 | [diff] [blame] | 64 | |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 65 | ############################################################################## |
| 66 | # Cavium ThunderX |
| 67 | ############################################################################## |
| 68 | else ifneq (,$(findstring thunder,$(shell cat /sys/bus/pci/devices/0000:00:01.0/uevent | grep cavium))) |
| 69 | export CROSS="" |
| 70 | DPDK_TARGET ?= arm64-thunderx-linuxapp-$(DPDK_CC) |
| 71 | DPDK_MACHINE ?= thunderx |
| 72 | DPDK_TUNE ?= generic |
| 73 | |
| 74 | ############################################################################## |
| 75 | # Unknown platofrm |
| 76 | ############################################################################## |
| 77 | else |
| 78 | $(error unknown platform) |
Christophe Fontaine | 737547e | 2016-05-11 08:40:33 +0000 | [diff] [blame] | 79 | endif |
| 80 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 81 | JOBS := $(shell grep processor /proc/cpuinfo | wc -l) |
| 82 | |
| 83 | # compiler/linker custom arguments |
| 84 | DPDK_CPU_CFLAGS := -pie -fPIC |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 85 | DPDK_EXTRA_LDFLAGS := -g |
| 86 | |
| 87 | ifeq ($(DPDK_DEBUG),n) |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 88 | DPDK_EXTRA_CFLAGS := -g -mtune=$(DPDK_TUNE) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 89 | else |
Damjan Marion | e39a7b8 | 2016-04-26 14:54:57 +0200 | [diff] [blame] | 90 | DPDK_EXTRA_CFLAGS := -g -O0 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 91 | endif |
| 92 | |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 93 | ifeq ($(DPDK_CRYPTO_SW_PMD),y) |
Sergio Gonzalez Monroy | 0e2e10b | 2017-03-22 15:22:14 +0000 | [diff] [blame] | 94 | DPDK_EXTRA_CFLAGS += -I$(ISA_L_CRYPTO_INSTALL_DIR)/include |
| 95 | DPDK_EXTRA_LDFLAGS += -L$(ISA_L_CRYPTO_INSTALL_DIR)/lib |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 96 | DPDK_MAKE_EXTRA_ARGS += AESNI_MULTI_BUFFER_LIB_PATH=$(AESNIMB_LIB_SOURCE) |
| 97 | endif |
| 98 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 99 | # assemble DPDK make arguments |
| 100 | DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \ |
| 101 | T=$(DPDK_TARGET) \ |
| 102 | RTE_CONFIG_TEMPLATE=../custom-config \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 103 | EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \ |
| 104 | EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \ |
| 105 | CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \ |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 106 | DESTDIR=$(I) \ |
Christophe Fontaine | 737547e | 2016-05-11 08:40:33 +0000 | [diff] [blame] | 107 | $(DPDK_MAKE_EXTRA_ARGS) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 108 | |
Damjan Marion | 78edb8e | 2017-02-06 22:28:52 +0100 | [diff] [blame] | 109 | DPDK_SOURCE_FILES := $(shell [ -e $(DPDK_SOURCE) ] && find $(DPDK_SOURCE) -name "*.[chS]") |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 110 | |
| 111 | define set |
| 112 | @if grep -q CONFIG_$1 $@ ; \ |
| 113 | then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \ |
| 114 | else echo CONFIG_$1=$2 >> $@ ; \ |
| 115 | fi |
| 116 | endef |
| 117 | |
| 118 | all: build |
| 119 | |
| 120 | $(B)/custom-config: $(B)/.patch.ok Makefile |
Damjan Marion | 106f0ed | 2016-04-26 10:44:28 +0200 | [diff] [blame] | 121 | @echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) --- |
| 122 | @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] | 123 | $(call set,RTE_MACHINE,$(DPDK_MACHINE)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 124 | @# modify options |
Damjan Marion | 13f0718 | 2016-02-05 06:44:54 -0800 | [diff] [blame] | 125 | $(call set,RTE_MAX_LCORE,256) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 126 | $(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM)) |
| 127 | $(call set,RTE_LIBEAL_USE_HPET,y) |
| 128 | $(call set,RTE_BUILD_COMBINE_LIBS,y) |
Damjan Marion | a155680 | 2016-06-26 20:12:40 +0200 | [diff] [blame] | 129 | $(call set,RTE_PCI_CONFIG,y) |
| 130 | $(call set,RTE_PCI_EXTENDED_TAG,"on") |
| 131 | $(call set,RTE_PCI_MAX_READ_REQUEST_SIZE,4096) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 132 | @# enable debug init for device drivers |
| 133 | $(call set,RTE_LIBRTE_I40E_DEBUG_INIT,$(DPDK_DEBUG)) |
| 134 | $(call set,RTE_LIBRTE_IXGBE_DEBUG_INIT,$(DPDK_DEBUG)) |
| 135 | $(call set,RTE_LIBRTE_E1000_DEBUG_INIT,$(DPDK_DEBUG)) |
| 136 | $(call set,RTE_LIBRTE_VIRTIO_DEBUG_INIT,$(DPDK_DEBUG)) |
| 137 | $(call set,RTE_LIBRTE_VMXNET3_DEBUG_INIT,$(DPDK_DEBUG)) |
John Lo | d9bf9ab | 2016-02-25 11:17:55 -0500 | [diff] [blame] | 138 | $(call set,RTE_LIBRTE_PMD_BOND,y) |
| 139 | $(call set,RTE_LIBRTE_IP_FRAG,y) |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 140 | $(call set,RTE_LIBRTE_PMD_QAT,y) |
| 141 | $(call set,RTE_LIBRTE_PMD_AESNI_MB,$(DPDK_CRYPTO_SW_PMD)) |
| 142 | $(call set,RTE_LIBRTE_PMD_AESNI_GCM,$(DPDK_CRYPTO_SW_PMD)) |
Damjan Marion | 6a5be21 | 2017-05-11 14:55:43 +0200 | [diff] [blame] | 143 | $(call set,RTE_LIBRTE_MLX4_PMD,$(DPDK_MLX4_PMD)) |
Damjan Marion | 696f1ad | 2016-12-23 22:42:41 +0100 | [diff] [blame] | 144 | $(call set,RTE_LIBRTE_MLX5_PMD,$(DPDK_MLX5_PMD)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 145 | @# not needed |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 146 | $(call set,RTE_LIBRTE_TIMER,n) |
| 147 | $(call set,RTE_LIBRTE_CFGFILE,n) |
| 148 | $(call set,RTE_LIBRTE_LPM,n) |
| 149 | $(call set,RTE_LIBRTE_ACL,n) |
| 150 | $(call set,RTE_LIBRTE_POWER,n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 151 | $(call set,RTE_LIBRTE_DISTRIBUTOR,n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 152 | $(call set,RTE_LIBRTE_PORT,n) |
| 153 | $(call set,RTE_LIBRTE_TABLE,n) |
| 154 | $(call set,RTE_LIBRTE_PIPELINE,n) |
| 155 | $(call set,RTE_KNI_KMOD,n) |
Damjan Marion | 68fda1c | 2017-01-01 16:53:22 +0100 | [diff] [blame] | 156 | $(call set,RTE_EAL_IGB_UIO,n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 157 | @rm -f .config.ok |
| 158 | |
| 159 | $(CURDIR)/$(DPDK_TARBALL): |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 160 | @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \ |
| 161 | then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \ |
| 162 | else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \ |
| 163 | fi |
| 164 | @rm -f $(B)/.download.ok |
| 165 | |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 166 | $(CURDIR)/$(AESNIMB_LIB_TARBALL): |
| 167 | @if [ -e $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) ] ; \ |
| 168 | then cp $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) $(CURDIR) ; \ |
| 169 | else curl -o $@ -LO $(AESNIMB_LIB_TARBALL_URL) ; \ |
| 170 | fi |
Sergio Gonzalez Monroy | 0e2e10b | 2017-03-22 15:22:14 +0000 | [diff] [blame] | 171 | @rm -f $(B)/.download.ok |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 172 | |
| 173 | $(CURDIR)/$(ISA_L_CRYPTO_LIB_TARBALL): |
| 174 | @if [ -e $(DPDK_DOWNLOAD_DIR)/$(ISA_L_CRYPTO_LIB_TARBALL) ] ; \ |
| 175 | then cp $(DPDK_DOWNLOAD_DIR)/$(ISA_L_CRYPTO_LIB_TARBALL) $(CURDIR) ; \ |
| 176 | else curl -o $@ -LO $(ISA_L_CRYPTO_LIB_TARBALL_URL) ; \ |
| 177 | fi |
Sergio Gonzalez Monroy | 0e2e10b | 2017-03-22 15:22:14 +0000 | [diff] [blame] | 178 | @rm -f $(B)/.download.ok |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 179 | |
| 180 | DPDK_DOWNLOADS = $(CURDIR)/$(DPDK_TARBALL) |
| 181 | ifeq ($(DPDK_CRYPTO_SW_PMD),y) |
| 182 | DPDK_DOWNLOADS += $(CURDIR)/$(AESNIMB_LIB_TARBALL) |
| 183 | DPDK_DOWNLOADS += $(CURDIR)/$(ISA_L_CRYPTO_LIB_TARBALL) |
| 184 | endif |
| 185 | |
| 186 | $(B)/.download.ok: $(DPDK_DOWNLOADS) |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 187 | @mkdir -p $(B) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 188 | @openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum |
Damjan Marion | bce6b6a | 2015-12-16 04:27:37 +0100 | [diff] [blame] | 189 | @([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 190 | ( echo "Bad Checksum! Please remove $< and retry" && \ |
| 191 | rm $(B)/$(DPDK_TARBALL).md5sum && false )) |
| 192 | @touch $@ |
| 193 | |
| 194 | .PHONY: download |
| 195 | download: $(B)/.download.ok |
| 196 | |
| 197 | $(B)/.extract.ok: $(B)/.download.ok |
| 198 | @echo --- extracting $(DPDK_TARBALL) --- |
Thomas Monjalon | 96e10b5 | 2016-06-02 14:52:32 +0200 | [diff] [blame] | 199 | @tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL) |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 200 | ifeq ($(DPDK_CRYPTO_SW_PMD),y) |
| 201 | @echo --- extracting $(AESNIMB_LIB_TARBALL) --- |
| 202 | @tar --directory $(B) --extract --file $(CURDIR)/$(AESNIMB_LIB_TARBALL) |
Radu Nicolau | 2e3677b | 2017-02-20 12:27:02 +0000 | [diff] [blame] | 203 | @echo --- extracting $(ISA_L_CRYPTO_LIB_TARBALL) --- |
| 204 | @tar --directory $(B) --extract --file $(CURDIR)/$(ISA_L_CRYPTO_LIB_TARBALL) |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 205 | endif |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 206 | @touch $@ |
| 207 | |
| 208 | .PHONY: extract |
| 209 | extract: $(B)/.extract.ok |
| 210 | |
| 211 | $(B)/.patch.ok: $(B)/.extract.ok |
Damjan Marion | 0df78dd | 2016-03-29 22:37:02 +0200 | [diff] [blame] | 212 | ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 213 | @echo --- patching --- |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 214 | @for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 215 | echo Applying patch: $$(basename $$f) ; \ |
| 216 | patch -p1 -d $(DPDK_SOURCE) < $$f ; \ |
| 217 | done |
Damjan Marion | 0df78dd | 2016-03-29 22:37:02 +0200 | [diff] [blame] | 218 | endif |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 219 | @touch $@ |
| 220 | |
| 221 | .PHONY: patch |
| 222 | patch: $(B)/.patch.ok |
| 223 | |
| 224 | $(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config |
| 225 | @make $(DPDK_MAKE_ARGS) config |
| 226 | @touch $@ |
| 227 | |
| 228 | .PHONY: config |
| 229 | config: $(B)/.config.ok |
| 230 | |
| 231 | $(B)/.build.ok: $(DPDK_SOURCE_FILES) |
| 232 | @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 233 | ifeq ($(DPDK_CRYPTO_SW_PMD),y) |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 234 | # Build IPsec_MB library |
| 235 | mkdir -p $(I)/lib/ |
| 236 | make -C $(AESNIMB_LIB_SOURCE) -j NO_GCM=y |
| 237 | cp $(AESNIMB_LIB_SOURCE)/libIPSec_MB.a $(I)/lib/ |
| 238 | # Build ISA-L Crypto library |
Sergio Gonzalez Monroy | 0e2e10b | 2017-03-22 15:22:14 +0000 | [diff] [blame] | 239 | cd $(ISA_L_CRYPTO_LIB_SOURCE) && ./autogen.sh && \ |
| 240 | ./configure --prefix=$(ISA_L_CRYPTO_INSTALL_DIR) CFLAGS='-fPIC -DPIC -O2' |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 241 | make -C $(ISA_L_CRYPTO_LIB_SOURCE) -j install |
Sergio Gonzalez Monroy | 0e2e10b | 2017-03-22 15:22:14 +0000 | [diff] [blame] | 242 | cp $(ISA_L_CRYPTO_INSTALL_DIR)/lib/libisal_crypto.* $(I)/lib/ |
Radu Nicolau | 6ca42d3 | 2017-02-16 13:54:42 +0000 | [diff] [blame] | 243 | endif |
Sergio Gonzalez Monroy | fa80f2e | 2017-03-07 14:39:29 +0000 | [diff] [blame] | 244 | @make $(DPDK_MAKE_ARGS) install |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 245 | @touch $@ |
| 246 | |
| 247 | .PHONY: build |
| 248 | build: $(B)/.build.ok |
| 249 | |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 250 | .PHONY: install |
| 251 | install: $(B)/.build.ok |
| 252 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 253 | .PHONY: clean |
| 254 | clean: |
| 255 | @rm -rf $(B) $(I) |
| 256 | |
Damjan Marion | 2ce7f98 | 2017-01-09 20:24:50 +0100 | [diff] [blame] | 257 | ############################################################################## |
| 258 | # .deb packaging |
| 259 | ############################################################################## |
| 260 | |
| 261 | DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null) |
| 262 | DEV_DEB=vpp-dpdk-dev_$(DPDK_VERSION)-$(PKG_SUFFIX)_$(DEB_ARCH).deb |
| 263 | INSTALLED_DEB_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-dpdk-dev 2> /dev/null) |
| 264 | |
| 265 | .PHONY: build-deb install-deb check-deb |
| 266 | |
| 267 | deb/debian/changelog: Makefile |
| 268 | @echo "vpp-dpdk ($(DPDK_VERSION)-$(PKG_SUFFIX)) unstable; urgency=low" > $@ |
| 269 | @echo "" >> $@ |
| 270 | @echo " * DPDK Release $(DPDK_VERSION)" >> $@ |
| 271 | @echo "" >> $@ |
| 272 | @echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R)" >> $@ |
| 273 | |
| 274 | $(DEV_DEB): deb/debian/changelog |
| 275 | @cd deb && dpkg-buildpackage -b -uc -us |
| 276 | git clean -fdx deb |
| 277 | |
| 278 | build-deb: $(DEV_DEB) |
| 279 | |
| 280 | install-deb: |
| 281 | ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
| 282 | @make $(DEV_DEB) |
| 283 | @sudo dpkg -i $(DEV_DEB) |
| 284 | else |
| 285 | @echo "==========================================================" |
| 286 | @echo " Up-to-date DPDK package already installed" |
| 287 | @echo "==========================================================" |
| 288 | endif |
| 289 | |
| 290 | check-deb: |
| 291 | ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
| 292 | @echo "==========================================================" |
| 293 | @echo " Outdated DPDK package detected:" |
| 294 | @echo " Installed: vpp-dpdk-dev $(INSTALLED_DEB_VER)" |
| 295 | @echo " Current: vpp-dpdk-dev $(DPDK_VERSION)-$(PKG_SUFFIX)" |
| 296 | @echo "" |
| 297 | @echo " Please upgrade by invoking 'make dpdk-install-dev'" |
| 298 | @echo " from the top level directory." |
| 299 | @echo "==========================================================" |
| 300 | endif |
| 301 | |
| 302 | ############################################################################## |
| 303 | # .rpm packaging |
| 304 | ############################################################################## |
| 305 | |
| 306 | RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null) |
| 307 | DEV_RPM=vpp-dpdk-devel-$(DPDK_VERSION)-$(PKG_SUFFIX).$(RPM_ARCH).rpm |
Damjan Marion | 248968b | 2017-01-20 23:59:28 +0100 | [diff] [blame] | 308 | 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] | 309 | |
| 310 | .PHONY: build-rpm install-rpm check-rpm |
| 311 | |
| 312 | $(DEV_RPM): Makefile rpm/vpp-dpdk.spec |
| 313 | @rpmbuild -bb \ |
| 314 | --define "_topdir $(CURDIR)/rpm" \ |
| 315 | --define "_version $(DPDK_VERSION)" \ |
| 316 | --define "_release $(PKG_SUFFIX)" \ |
| 317 | $(CURDIR)/rpm/vpp-dpdk.spec |
| 318 | mv rpm/RPMS/$(RPM_ARCH)/*.rpm . |
| 319 | git clean -fdx rpm |
| 320 | |
| 321 | build-rpm: $(DEV_RPM) |
| 322 | |
| 323 | install-rpm: |
| 324 | ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
| 325 | @make $(DEV_RPM) |
| 326 | sudo rpm -Uih $(DEV_RPM) |
| 327 | else |
| 328 | @echo "==========================================================" |
| 329 | @echo " Up-to-date DPDK package already installed" |
| 330 | @echo "==========================================================" |
| 331 | endif |
| 332 | |
| 333 | check-rpm: |
| 334 | ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX)) |
| 335 | @echo "==========================================================" |
| 336 | @echo " Outdated DPDK package detected:" |
| 337 | @echo " Installed: vpp-dpdk-devel $(INSTALLED_RPM_VER)" |
| 338 | @echo " Current: vpp-dpdk-devel $(DPDK_VERSION)-$(PKG_SUFFIX)" |
| 339 | @echo "" |
| 340 | @echo " Please upgrade by invoking 'make dpdk-install-dev'" |
| 341 | @echo " from the top level directory." |
| 342 | @echo "==========================================================" |
| 343 | endif |
| 344 | |
| 345 | ############################################################################## |
| 346 | # ebuild support |
| 347 | ############################################################################## |
| 348 | |
| 349 | .PHONY: ebuild-build ebuild-install |
| 350 | |
| 351 | ebuild-build: |
| 352 | ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),) |
| 353 | @echo "==========================================================" |
| 354 | @echo "Building DPDK from source. Consider installing development" |
| 355 | @echo "package by invoking 'make dpdk-install-dev' from the" |
| 356 | @echo "top level directory" |
| 357 | @echo "==========================================================" |
| 358 | make config |
| 359 | else |
| 360 | ifneq ($(INSTALLED_DEB_VER),) |
| 361 | make check-deb |
| 362 | endif |
| 363 | ifneq ($(INSTALLED_RPM_VER),) |
| 364 | make check-rpm |
| 365 | endif |
| 366 | endif |
| 367 | |
| 368 | ebuild-install: |
| 369 | ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),) |
| 370 | make install |
| 371 | endif |