blob: 4e0ad4f3690e9801ff13a46ae1f704bd8b210f77 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001# 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
15SHELL := /bin/bash
16
17DPDK_BUILD_DIR ?= $(CURDIR)/_build
18DPDK_INSTALL_DIR ?= $(CURDIR)/_install
Damjan Marion19010202016-03-24 17:17:47 +010019DPDK_PKTMBUF_HEADROOM ?= 128
Ed Warnickecb9cada2015-12-08 15:45:58 -070020DPDK_DOWNLOAD_DIR ?= $(HOME)/Downloads
Ed Warnickecb9cada2015-12-08 15:45:58 -070021DPDK_DEBUG ?= n
Damjan Marion6a5be212017-05-11 14:55:43 +020022DPDK_MLX4_PMD ?= n
Damjan Marion696f1ad2016-12-23 22:42:41 +010023DPDK_MLX5_PMD ?= n
Ed Warnickecb9cada2015-12-08 15:45:58 -070024
25B := $(DPDK_BUILD_DIR)
26I := $(DPDK_INSTALL_DIR)
Damjan Marion206b2d42017-08-25 19:10:57 +020027DPDK_VERSION ?= 17.08
28PKG_SUFFIX ?= vpp1
Thomas Monjalon96e10b52016-06-02 14:52:32 +020029DPDK_BASE_URL ?= http://fast.dpdk.org/rel
30DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
Damjan Mariondab123b2016-03-29 16:43:58 +020031DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
Damjan Marion6a5be212017-05-11 14:55:43 +020032DPDK_17.05_TARBALL_MD5_CKSUM := 0a68c31cd6a6cabeed0a4331073e4c05
Marco Varlese3a079ce2017-08-14 10:53:28 +020033DPDK_17.08_TARBALL_MD5_CKSUM := 0641f59ea8ea98afefa7cfa2699f6241
Ed Warnickecb9cada2015-12-08 15:45:58 -070034DPDK_SOURCE := $(B)/dpdk-$(DPDK_VERSION)
Damjan Marion5f22f4d2017-08-21 22:19:04 +020035MACHINE=$(shell uname -m)
Radu Nicolau2e3677b2017-02-20 12:27:02 +000036
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010037ISA_L_CRYPTO_LIB := n
38
39IPSEC_MB_VER ?= 0.46
40ISA_L_CRYPTO_VER := 2.18.0
41
Marco Varlese8ddd5182017-08-14 16:07:00 +020042ifeq ($(MACHINE),$(filter $(MACHINE),x86_64))
Thomas F Herbert4b0ac822017-08-29 16:07:51 -040043 AESNI ?= y
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010044# 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 Herbert4b0ac822017-08-29 16:07:51 -040051else
52 AESNI ?= N
Marco Varlese8ddd5182017-08-14 16:07:00 +020053endif
54
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010055AESNIMB_LIB_TARBALL := v$(IPSEC_MB_VER).tar.gz
Radu Nicolau6ca42d32017-02-16 13:54:42 +000056AESNIMB_LIB_TARBALL_URL := http://github.com/01org/intel-ipsec-mb/archive/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010057AESNIMB_LIB_SOURCE := $(B)/intel-ipsec-mb-$(IPSEC_MB_VER)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010058
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010059ISA_L_CRYPTO_LIB_TARBALL := v$(ISA_L_CRYPTO_VER).tar.gz
60ISA_L_CRYPTO_LIB_TARBALL_URL := http://github.com/01org/isa-l_crypto/archive/$(ISA_L_CRYPTO_LIB_TARBALL)
61ISA_L_CRYPTO_LIB_SOURCE := $(B)/isa-l_crypto-$(ISA_L_CRYPTO_VER)
62ISA_L_CRYPTO_INSTALL_DIR := $(ISA_L_CRYPTO_LIB_SOURCE)/install
Damjan Marione39a7b82016-04-26 14:54:57 +020063
64ifneq (,$(findstring clang,$(CC)))
65DPDK_CC=clang
Damjan Marion78edb8e2017-02-06 22:28:52 +010066else ifneq (,$(findstring icc,$(CC)))
67DPDK_CC=icc
Damjan Marione39a7b82016-04-26 14:54:57 +020068else
69DPDK_CC=gcc
70endif
71
Damjan Marion78edb8e2017-02-06 22:28:52 +010072##############################################################################
Damjan Marion1664f9b2017-04-24 20:48:53 +020073# Intel x86
Damjan Marion78edb8e2017-02-06 22:28:52 +010074##############################################################################
Damjan Marion1664f9b2017-04-24 20:48:53 +020075ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686))
76DPDK_TARGET ?= $(MACHINE)-native-linuxapp-$(DPDK_CC)
Damjan Marion78edb8e2017-02-06 22:28:52 +010077DPDK_MACHINE ?= nhm
78DPDK_TUNE ?= core-avx2
Brian Brooksa7191842017-09-06 13:19:48 -050079
80##############################################################################
81# ARM64
82##############################################################################
Brian Brooks97465522017-08-28 13:05:26 -050083else ifeq ($(MACHINE),aarch64)
84export CROSS=""
Brian Brooks97465522017-08-28 13:05:26 -050085DPDK_TARGET ?= arm64-armv8a-linuxapp-$(DPDK_CC)
86DPDK_MACHINE ?= armv8a
87DPDK_TUNE ?= generic
Brian Brooksa7191842017-09-06 13:19:48 -050088
89CPU_IMP_ARM = 0x41
90CPU_IMP_CAVIUM = 0x43
91
92CPU_PART_ARM_CORTEX_A53 = 0xd03
93CPU_PART_ARM_CORTEX_A57 = 0xd07
94CPU_PART_ARM_CORTEX_A72 = 0xd08
95CPU_PART_ARM_CORTEX_A73 = 0xd09
96
97CPU_PART_CAVIUM_THUNDERX = 0x0a1
98CPU_PART_CAVIUM_THUNDERX_81XX = 0x0a2
99CPU_PART_CAVIUM_THUNDERX_83XX = 0x0a3
100
101MIDR_IMPLEMENTER=$(shell awk '/implementer/ {print $$4;exit}' /proc/cpuinfo)
102MIDR_PARTNUM=$(shell awk '/part/ {print $$4;exit}' /proc/cpuinfo)
103
104ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_ARM))
105##############################################################################
106# Arm Cortex
107##############################################################################
108CPU_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
112CPU_TUNE = $(notdir $(filter $(MIDR_PARTNUM)/%,$(CPU_PART_ARM_TUNE)))
113ifneq ($(CPU_TUNE),)
114DPDK_TUNE = $(CPU_TUNE)
115else
116$(warning Unknown Arm CPU)
117endif
118
119else ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_CAVIUM))
120##############################################################################
121# Cavium ThunderX
122##############################################################################
123ifneq (,$(findstring $(MIDR_PARTNUM),$(CPU_PART_CAVIUM_THUNDERX) \
124 $(CPU_PART_CAVIUM_THUNDERX_81XX) $(CPU_PART_CAVIUM_THUNDERX_83XX)))
125DPDK_TARGET = arm64-thunderx-linuxapp-$(DPDK_CC)
126DPDK_MACHINE = thunderx
127else
128$(warning Unknown Cavium CPU)
129endif
Brian Brooks97465522017-08-28 13:05:26 -0500130endif
Damjan Marion78edb8e2017-02-06 22:28:52 +0100131
132##############################################################################
Brian Brooksa7191842017-09-06 13:19:48 -0500133# Unknown platform
Damjan Marion78edb8e2017-02-06 22:28:52 +0100134##############################################################################
135else
Brian Brooksa7191842017-09-06 13:19:48 -0500136$(error Unknown platform)
Christophe Fontaine737547e2016-05-11 08:40:33 +0000137endif
138
Chris Lukeb2861e82017-06-14 11:24:41 -0400139# /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.
144JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
145 $(shell expr 2 '*' $$(grep -c ^processor /proc/cpuinfo)), 2)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700146
147# compiler/linker custom arguments
148DPDK_CPU_CFLAGS := -pie -fPIC
Ed Warnickecb9cada2015-12-08 15:45:58 -0700149DPDK_EXTRA_LDFLAGS := -g
150
151ifeq ($(DPDK_DEBUG),n)
Damjan Marion1c80e832016-05-11 23:07:18 +0200152DPDK_EXTRA_CFLAGS := -g -mtune=$(DPDK_TUNE)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700153else
Damjan Marione39a7b82016-04-26 14:54:57 +0200154DPDK_EXTRA_CFLAGS := -g -O0
Ed Warnickecb9cada2015-12-08 15:45:58 -0700155endif
156
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100157ifeq ($(ISA_L_CRYPTO_LIB),y)
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100158DPDK_EXTRA_CFLAGS += -I$(ISA_L_CRYPTO_INSTALL_DIR)/include -Wl,-z,muldefs
Peter Mikusad625f52017-05-31 15:23:59 +0000159DPDK_EXTRA_LDFLAGS += -L$(I)/lib
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100160endif
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000161DPDK_MAKE_EXTRA_ARGS += AESNI_MULTI_BUFFER_LIB_PATH=$(AESNIMB_LIB_SOURCE)
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000162
Ed Warnickecb9cada2015-12-08 15:45:58 -0700163# assemble DPDK make arguments
164DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \
165 T=$(DPDK_TARGET) \
166 RTE_CONFIG_TEMPLATE=../custom-config \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700167 EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \
168 EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \
169 CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \
Damjan Marion2ce7f982017-01-09 20:24:50 +0100170 DESTDIR=$(I) \
Christophe Fontaine737547e2016-05-11 08:40:33 +0000171 $(DPDK_MAKE_EXTRA_ARGS)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700172
Ed Warnickecb9cada2015-12-08 15:45:58 -0700173define set
174@if grep -q CONFIG_$1 $@ ; \
175 then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \
176 else echo CONFIG_$1=$2 >> $@ ; \
177fi
178endef
179
180all: build
181
182$(B)/custom-config: $(B)/.patch.ok Makefile
Damjan Marion106f0ed2016-04-26 10:44:28 +0200183 @echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) ---
184 @cpp -undef -ffreestanding -x assembler-with-cpp $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700185 $(call set,RTE_MACHINE,$(DPDK_MACHINE))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700186 @# modify options
Damjan Marion13f07182016-02-05 06:44:54 -0800187 $(call set,RTE_MAX_LCORE,256)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700188 $(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM))
189 $(call set,RTE_LIBEAL_USE_HPET,y)
190 $(call set,RTE_BUILD_COMBINE_LIBS,y)
Damjan Mariona1556802016-06-26 20:12:40 +0200191 $(call set,RTE_PCI_CONFIG,y)
192 $(call set,RTE_PCI_EXTENDED_TAG,"on")
193 $(call set,RTE_PCI_MAX_READ_REQUEST_SIZE,4096)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700194 @# enable debug init for device drivers
195 $(call set,RTE_LIBRTE_I40E_DEBUG_INIT,$(DPDK_DEBUG))
196 $(call set,RTE_LIBRTE_IXGBE_DEBUG_INIT,$(DPDK_DEBUG))
197 $(call set,RTE_LIBRTE_E1000_DEBUG_INIT,$(DPDK_DEBUG))
198 $(call set,RTE_LIBRTE_VIRTIO_DEBUG_INIT,$(DPDK_DEBUG))
199 $(call set,RTE_LIBRTE_VMXNET3_DEBUG_INIT,$(DPDK_DEBUG))
John Lod9bf9ab2016-02-25 11:17:55 -0500200 $(call set,RTE_LIBRTE_PMD_BOND,y)
201 $(call set,RTE_LIBRTE_IP_FRAG,y)
Sergio Gonzalez Monroyd04b60b2017-01-20 15:35:23 +0000202 $(call set,RTE_LIBRTE_PMD_QAT,y)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100203 $(call set,RTE_LIBRTE_PMD_AESNI_MB,$(AESNI))
204 $(call set,RTE_LIBRTE_PMD_AESNI_GCM,$(AESNI))
Damjan Marion6a5be212017-05-11 14:55:43 +0200205 $(call set,RTE_LIBRTE_MLX4_PMD,$(DPDK_MLX4_PMD))
Damjan Marion696f1ad2016-12-23 22:42:41 +0100206 $(call set,RTE_LIBRTE_MLX5_PMD,$(DPDK_MLX5_PMD))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700207 @# not needed
Damjan Marion844e0eb2017-08-21 22:27:04 +0200208 $(call set,RTE_LIBRTE_PMD_TAP,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700209 $(call set,RTE_LIBRTE_TIMER,n)
210 $(call set,RTE_LIBRTE_CFGFILE,n)
211 $(call set,RTE_LIBRTE_LPM,n)
212 $(call set,RTE_LIBRTE_ACL,n)
213 $(call set,RTE_LIBRTE_POWER,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700214 $(call set,RTE_LIBRTE_DISTRIBUTOR,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700215 $(call set,RTE_LIBRTE_PORT,n)
216 $(call set,RTE_LIBRTE_TABLE,n)
217 $(call set,RTE_LIBRTE_PIPELINE,n)
218 $(call set,RTE_KNI_KMOD,n)
Damjan Marion68fda1c2017-01-01 16:53:22 +0100219 $(call set,RTE_EAL_IGB_UIO,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700220 @rm -f .config.ok
221
222$(CURDIR)/$(DPDK_TARBALL):
Ed Warnickecb9cada2015-12-08 15:45:58 -0700223 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \
224 then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \
225 else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \
226 fi
227 @rm -f $(B)/.download.ok
228
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000229$(CURDIR)/$(AESNIMB_LIB_TARBALL):
230 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) ] ; \
231 then cp $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) $(CURDIR) ; \
232 else curl -o $@ -LO $(AESNIMB_LIB_TARBALL_URL) ; \
233 fi
234
235$(CURDIR)/$(ISA_L_CRYPTO_LIB_TARBALL):
236 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(ISA_L_CRYPTO_LIB_TARBALL) ] ; \
237 then cp $(DPDK_DOWNLOAD_DIR)/$(ISA_L_CRYPTO_LIB_TARBALL) $(CURDIR) ; \
238 else curl -o $@ -LO $(ISA_L_CRYPTO_LIB_TARBALL_URL) ; \
239 fi
240
241DPDK_DOWNLOADS = $(CURDIR)/$(DPDK_TARBALL)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100242ifeq ($(AESNI),y)
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000243DPDK_DOWNLOADS += $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100244endif
245ifeq ($(ISA_L_CRYPTO_LIB),y)
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000246DPDK_DOWNLOADS += $(CURDIR)/$(ISA_L_CRYPTO_LIB_TARBALL)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100247endif
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000248
249$(B)/.download.ok: $(DPDK_DOWNLOADS)
Damjan Marion2ce7f982017-01-09 20:24:50 +0100250 @mkdir -p $(B)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700251 @openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum
Damjan Marionbce6b6a2015-12-16 04:27:37 +0100252 @([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700253 ( echo "Bad Checksum! Please remove $< and retry" && \
254 rm $(B)/$(DPDK_TARBALL).md5sum && false ))
255 @touch $@
256
257.PHONY: download
258download: $(B)/.download.ok
259
260$(B)/.extract.ok: $(B)/.download.ok
261 @echo --- extracting $(DPDK_TARBALL) ---
Thomas Monjalon96e10b52016-06-02 14:52:32 +0200262 @tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL)
Marco Varlese8ddd5182017-08-14 16:07:00 +0200263ifeq ($(AESNI),y)
Radu Nicolau6ca42d32017-02-16 13:54:42 +0000264 @echo --- extracting $(AESNIMB_LIB_TARBALL) ---
265 @tar --directory $(B) --extract --file $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100266endif
267ifeq ($(ISA_L_CRYPTO_LIB),y)
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000268 @echo --- extracting $(ISA_L_CRYPTO_LIB_TARBALL) ---
269 @tar --directory $(B) --extract --file $(CURDIR)/$(ISA_L_CRYPTO_LIB_TARBALL)
Marco Varlese8ddd5182017-08-14 16:07:00 +0200270endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100271 @touch $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700272
273.PHONY: extract
274extract: $(B)/.extract.ok
275
276$(B)/.patch.ok: $(B)/.extract.ok
Damjan Marion0df78dd2016-03-29 22:37:02 +0200277ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700278 @echo --- patching ---
Damjan Marion2ce7f982017-01-09 20:24:50 +0100279 @for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700280 echo Applying patch: $$(basename $$f) ; \
281 patch -p1 -d $(DPDK_SOURCE) < $$f ; \
282 done
Damjan Marion0df78dd2016-03-29 22:37:02 +0200283endif
Ed Warnickecb9cada2015-12-08 15:45:58 -0700284 @touch $@
285
286.PHONY: patch
287patch: $(B)/.patch.ok
288
289$(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config
290 @make $(DPDK_MAKE_ARGS) config
291 @touch $@
292
293.PHONY: config
294config: $(B)/.config.ok
295
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100296.PHONY: build-ipsec-mb
297build-ipsec-mb:
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000298 mkdir -p $(I)/lib/
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100299 # Do not build GCM stuff if we are building ISA_L
300 make -C $(AESNIMB_LIB_SOURCE) -j NO_GCM=$(ISA_L_CRYPTO_LIB)
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000301 cp $(AESNIMB_LIB_SOURCE)/libIPSec_MB.a $(I)/lib/
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100302
303.PHONY: build-isal-crypto
304build-isal-crypto:
305 mkdir -p $(I)/lib/
306 cd $(ISA_L_CRYPTO_LIB_SOURCE) && ./autogen.sh && \
Sergio Gonzalez Monroy4aef5b72017-08-14 09:26:44 +0100307 ./configure --prefix=$(ISA_L_CRYPTO_INSTALL_DIR) \
308 --libdir=$(ISA_L_CRYPTO_INSTALL_DIR)/lib CFLAGS='-fPIC -DPIC -O2'
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000309 make -C $(ISA_L_CRYPTO_LIB_SOURCE) -j install
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100310 cp $(ISA_L_CRYPTO_INSTALL_DIR)/lib/libisal_crypto.a $(I)/lib/
311
312.PHONY: build-dpdk
313build-dpdk:
314 @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000315 @make $(DPDK_MAKE_ARGS) install
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100316
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100317# Order matters
318ifeq ($(AESNI),y)
319BUILD_TARGETS += build-ipsec-mb
320endif
321ifeq ($(ISA_L_CRYPTO_LIB),y)
322BUILD_TARGETS += build-isal-crypto
323endif
324BUILD_TARGETS += build-dpdk
325
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100326$(B)/.build.ok: $(BUILD_TARGETS)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700327 @touch $@
328
329.PHONY: build
330build: $(B)/.build.ok
331
Damjan Marion2ce7f982017-01-09 20:24:50 +0100332.PHONY: install
333install: $(B)/.build.ok
334
Ed Warnickecb9cada2015-12-08 15:45:58 -0700335.PHONY: clean
336clean:
337 @rm -rf $(B) $(I)
338
Damjan Marion2ce7f982017-01-09 20:24:50 +0100339##############################################################################
340# .deb packaging
341##############################################################################
342
343DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
344DEV_DEB=vpp-dpdk-dev_$(DPDK_VERSION)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
345INSTALLED_DEB_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-dpdk-dev 2> /dev/null)
346
347.PHONY: build-deb install-deb check-deb
348
349deb/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
360build-deb: $(DEV_DEB)
361
362install-deb:
363ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
364 @make $(DEV_DEB)
365 @sudo dpkg -i $(DEV_DEB)
366else
367 @echo "=========================================================="
368 @echo " Up-to-date DPDK package already installed"
369 @echo "=========================================================="
370endif
371
372check-deb:
373ifneq ($(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 "=========================================================="
382endif
383
384##############################################################################
385# .rpm packaging
386##############################################################################
387
388RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
389DEV_RPM=vpp-dpdk-devel-$(DPDK_VERSION)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
Damjan Marion248968b2017-01-20 23:59:28 +0100390INSTALLED_RPM_VER=$(shell rpm -q --queryformat '%{VERSION}-%{RELEASE}' vpp-dpdk-devel 2> /dev/null | grep -v "not inst")
Damjan Marion2ce7f982017-01-09 20:24:50 +0100391
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
403build-rpm: $(DEV_RPM)
404
405install-rpm:
406ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100407 @$(MAKE) $(DEV_RPM)
Damjan Marion2ce7f982017-01-09 20:24:50 +0100408 sudo rpm -Uih $(DEV_RPM)
409else
410 @echo "=========================================================="
411 @echo " Up-to-date DPDK package already installed"
412 @echo "=========================================================="
413endif
414
415check-rpm:
416ifneq ($(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 "=========================================================="
425endif
426
427##############################################################################
428# ebuild support
429##############################################################################
430
431.PHONY: ebuild-build ebuild-install
432
433ebuild-build:
434ifeq ($(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
441else
442ifneq ($(INSTALLED_DEB_VER),)
443 make check-deb
444endif
445ifneq ($(INSTALLED_RPM_VER),)
446 make check-rpm
447endif
448endif
449
450ebuild-install:
451ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
452 make install
453endif