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