blob: 331e1c34886a36771da769fdccbd7cbf20b05fc0 [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
Damjan Marion3473e492018-02-24 19:21:14 +010020DPDK_CACHE_LINE_SIZE ?= 64
Ed Warnickecb9cada2015-12-08 15:45:58 -070021DPDK_DOWNLOAD_DIR ?= $(HOME)/Downloads
Ed Warnickecb9cada2015-12-08 15:45:58 -070022DPDK_DEBUG ?= n
Damjan Marion6a5be212017-05-11 14:55:43 +020023DPDK_MLX4_PMD ?= n
Damjan Marion696f1ad2016-12-23 22:42:41 +010024DPDK_MLX5_PMD ?= n
Rui Cai60bd3022018-05-11 21:52:22 +000025DPDK_TAP_PMD ?= n
26DPDK_FAILSAFE_PMD ?= n
Ed Warnickecb9cada2015-12-08 15:45:58 -070027
28B := $(DPDK_BUILD_DIR)
29I := $(DPDK_INSTALL_DIR)
Marco Varlese4fcfbea2018-04-23 19:54:51 +020030DPDK_VERSION ?= 18.02.1
Damjan Marion7f0d1d32017-11-21 16:22:55 +010031PKG_SUFFIX ?= vpp1
Damjan Marionde3ff7a2017-11-29 12:28:38 +010032DPDK_BASE_URL ?= http://fast.dpdk.org/rel
Thomas Monjalon96e10b52016-06-02 14:52:32 +020033DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
Damjan Mariondab123b2016-03-29 16:43:58 +020034DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
Damjan Marion45b48502017-11-17 09:46:41 +010035DPDK_17.11_TARBALL_MD5_CKSUM := 53ee9e054a8797c9e67ffa0eb5d0c701
Marco Varlese4fcfbea2018-04-23 19:54:51 +020036DPDK_18.02.1_TARBALL_MD5_CKSUM := 3bbb5468f662e1f7472d4abc5c4cf08e
37DPDK_SOURCE := $(B)/dpdk-stable-$(DPDK_VERSION)
Damjan Marion5f22f4d2017-08-21 22:19:04 +020038MACHINE=$(shell uname -m)
Radu Nicolau2e3677b2017-02-20 12:27:02 +000039
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +010040NASM_BASE_URL := http://www.nasm.us/pub/nasm/releasebuilds
41NASM_VER := 2.13.01
42NASM_TARBALL := nasm-$(NASM_VER).tar.xz
43NASM_TAR_URL := $(NASM_BASE_URL)/$(NASM_VER)/$(NASM_TARBALL)
44NASM_SOURCE := $(B)/nasm-$(NASM_VER)
45
Damjan Marion07510dd2018-02-15 11:59:04 +010046ifeq ($(DPDK_VERSION),17.11)
Damjan Marion45b48502017-11-17 09:46:41 +010047IPSEC_MB_VER ?= 0.47
Damjan Marion07510dd2018-02-15 11:59:04 +010048else
49IPSEC_MB_VER ?= 0.48
Damjan Marion45b48502017-11-17 09:46:41 +010050endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010051
Marco Varlese8ddd5182017-08-14 16:07:00 +020052ifeq ($(MACHINE),$(filter $(MACHINE),x86_64))
Thomas F Herbert4b0ac822017-08-29 16:07:51 -040053 AESNI ?= y
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010054$(info Building IPSec-MB $(IPSEC_MB_VER) library)
Thomas F Herbert4b0ac822017-08-29 16:07:51 -040055else
56 AESNI ?= N
Marco Varlese8ddd5182017-08-14 16:07:00 +020057endif
58
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010059AESNIMB_LIB_TARBALL := v$(IPSEC_MB_VER).tar.gz
Radu Nicolau6ca42d32017-02-16 13:54:42 +000060AESNIMB_LIB_TARBALL_URL := http://github.com/01org/intel-ipsec-mb/archive/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010061AESNIMB_LIB_SOURCE := $(B)/intel-ipsec-mb-$(IPSEC_MB_VER)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010062
Damjan Marione39a7b82016-04-26 14:54:57 +020063ifneq (,$(findstring clang,$(CC)))
64DPDK_CC=clang
Damjan Marion78edb8e2017-02-06 22:28:52 +010065else ifneq (,$(findstring icc,$(CC)))
66DPDK_CC=icc
Damjan Marione39a7b82016-04-26 14:54:57 +020067else
68DPDK_CC=gcc
69endif
70
Damjan Marion78edb8e2017-02-06 22:28:52 +010071##############################################################################
Damjan Marion1664f9b2017-04-24 20:48:53 +020072# Intel x86
Damjan Marion78edb8e2017-02-06 22:28:52 +010073##############################################################################
Damjan Marion1664f9b2017-04-24 20:48:53 +020074ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686))
75DPDK_TARGET ?= $(MACHINE)-native-linuxapp-$(DPDK_CC)
Damjan Marion78edb8e2017-02-06 22:28:52 +010076DPDK_MACHINE ?= nhm
77DPDK_TUNE ?= core-avx2
Brian Brooksa7191842017-09-06 13:19:48 -050078
79##############################################################################
80# ARM64
81##############################################################################
Brian Brooks97465522017-08-28 13:05:26 -050082else ifeq ($(MACHINE),aarch64)
Bin Huang096e6be2018-05-24 16:43:19 +080083CROSS :=
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),\
Damjan Marion93242842017-11-13 20:09:21 +0100145 $(shell grep -c ^processor /proc/cpuinfo), 2)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700146
147# compiler/linker custom arguments
Sirshak Das6495c4b2018-05-29 21:06:28 -0500148ifeq ($(DPDK_CC),clang)
149DPDK_CPU_CFLAGS := -fPIE -fPIC
150else
Ed Warnickecb9cada2015-12-08 15:45:58 -0700151DPDK_CPU_CFLAGS := -pie -fPIC
Sirshak Das6495c4b2018-05-29 21:06:28 -0500152endif
Ed Warnickecb9cada2015-12-08 15:45:58 -0700153
154ifeq ($(DPDK_DEBUG),n)
Damjan Marion1c80e832016-05-11 23:07:18 +0200155DPDK_EXTRA_CFLAGS := -g -mtune=$(DPDK_TUNE)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700156else
Damjan Marione39a7b82016-04-26 14:54:57 +0200157DPDK_EXTRA_CFLAGS := -g -O0
Ed Warnickecb9cada2015-12-08 15:45:58 -0700158endif
159
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000160DPDK_MAKE_EXTRA_ARGS += AESNI_MULTI_BUFFER_LIB_PATH=$(AESNIMB_LIB_SOURCE)
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000161
Ed Warnickecb9cada2015-12-08 15:45:58 -0700162# assemble DPDK make arguments
163DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \
164 T=$(DPDK_TARGET) \
165 RTE_CONFIG_TEMPLATE=../custom-config \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700166 EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \
167 EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \
168 CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \
Damjan Marion2ce7f982017-01-09 20:24:50 +0100169 DESTDIR=$(I) \
Christophe Fontaine737547e2016-05-11 08:40:33 +0000170 $(DPDK_MAKE_EXTRA_ARGS)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700171
Ed Warnickecb9cada2015-12-08 15:45:58 -0700172define set
173@if grep -q CONFIG_$1 $@ ; \
174 then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \
175 else echo CONFIG_$1=$2 >> $@ ; \
176fi
177endef
178
179all: build
180
181$(B)/custom-config: $(B)/.patch.ok Makefile
Damjan Marion106f0ed2016-04-26 10:44:28 +0200182 @echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) ---
183 @cpp -undef -ffreestanding -x assembler-with-cpp $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700184 $(call set,RTE_MACHINE,$(DPDK_MACHINE))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700185 @# modify options
Damjan Marion13f07182016-02-05 06:44:54 -0800186 $(call set,RTE_MAX_LCORE,256)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700187 $(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM))
Damjan Marion3473e492018-02-24 19:21:14 +0100188 $(call set,RTE_CACHE_LINE_SIZE,$(DPDK_CACHE_LINE_SIZE))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700189 $(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))
Amir Zeidner0e7fe4f2018-03-05 14:32:22 +0200207 $(call set,RTE_LIBRTE_MLX4_DLOPEN_DEPS,$(DPDK_MLX4_PMD))
208 $(call set,RTE_LIBRTE_MLX5_DLOPEN_DEPS,$(DPDK_MLX5_PMD))
Rui Cai60bd3022018-05-11 21:52:22 +0000209 $(call set,RTE_LIBRTE_PMD_TAP,$(DPDK_TAP_PMD))
210 $(call set,RTE_LIBRTE_PMD_FAILSAFE,$(DPDK_FAILSAFE_PMD))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700211 @# not needed
Ed Warnickecb9cada2015-12-08 15:45:58 -0700212 $(call set,RTE_LIBRTE_TIMER,n)
213 $(call set,RTE_LIBRTE_CFGFILE,n)
214 $(call set,RTE_LIBRTE_LPM,n)
215 $(call set,RTE_LIBRTE_ACL,n)
216 $(call set,RTE_LIBRTE_POWER,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700217 $(call set,RTE_LIBRTE_DISTRIBUTOR,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700218 $(call set,RTE_LIBRTE_PORT,n)
219 $(call set,RTE_LIBRTE_TABLE,n)
220 $(call set,RTE_LIBRTE_PIPELINE,n)
Damjan Marion45b48502017-11-17 09:46:41 +0100221 $(call set,RTE_LIBRTE_FLOW_CLASSIFY,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700222 $(call set,RTE_KNI_KMOD,n)
Damjan Marion68fda1c2017-01-01 16:53:22 +0100223 $(call set,RTE_EAL_IGB_UIO,n)
Marco Varlese1355fcd2018-02-22 16:03:35 +0100224 @# currently broken in 18.02
225 $(call set,RTE_LIBRTE_DPAA_BUS,n)
226 $(call set,RTE_LIBRTE_DPAA_MEMPOOL,n)
227 $(call set,RTE_LIBRTE_DPAA_PMD,n)
228 $(call set,RTE_LIBRTE_PMD_DPAA_SEC,n)
229 $(call set,RTE_LIBRTE_PMD_DPAA_EVENTDEV,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700230 @rm -f .config.ok
231
232$(CURDIR)/$(DPDK_TARBALL):
Ed Warnickecb9cada2015-12-08 15:45:58 -0700233 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \
234 then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \
235 else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \
236 fi
237 @rm -f $(B)/.download.ok
238
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100239$(CURDIR)/$(NASM_TARBALL):
240 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) ] ; \
241 then cp $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) $(CURDIR) ; \
242 else curl -o $(CURDIR)/$(NASM_TARBALL) -LO $(NASM_TAR_URL) ; \
243 fi
244
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000245$(CURDIR)/$(AESNIMB_LIB_TARBALL):
246 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) ] ; \
247 then cp $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) $(CURDIR) ; \
248 else curl -o $@ -LO $(AESNIMB_LIB_TARBALL_URL) ; \
249 fi
250
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000251DPDK_DOWNLOADS = $(CURDIR)/$(DPDK_TARBALL)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100252ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100253DPDK_DOWNLOADS += $(CURDIR)/$(NASM_TARBALL)
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000254DPDK_DOWNLOADS += $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100255endif
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000256
257$(B)/.download.ok: $(DPDK_DOWNLOADS)
Damjan Marion2ce7f982017-01-09 20:24:50 +0100258 @mkdir -p $(B)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700259 @openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum
Damjan Marionbce6b6a2015-12-16 04:27:37 +0100260 @([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700261 ( echo "Bad Checksum! Please remove $< and retry" && \
262 rm $(B)/$(DPDK_TARBALL).md5sum && false ))
263 @touch $@
264
265.PHONY: download
266download: $(B)/.download.ok
267
268$(B)/.extract.ok: $(B)/.download.ok
269 @echo --- extracting $(DPDK_TARBALL) ---
Thomas Monjalon96e10b52016-06-02 14:52:32 +0200270 @tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL)
Marco Varlese8ddd5182017-08-14 16:07:00 +0200271ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100272 @echo --- extracting $(NASM_TARBALL) ---
273 @tar --directory $(B) --extract --file $(CURDIR)/$(NASM_TARBALL)
Radu Nicolau6ca42d32017-02-16 13:54:42 +0000274 @echo --- extracting $(AESNIMB_LIB_TARBALL) ---
275 @tar --directory $(B) --extract --file $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100276endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100277 @touch $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700278
279.PHONY: extract
280extract: $(B)/.extract.ok
281
282$(B)/.patch.ok: $(B)/.extract.ok
Damjan Marion0df78dd2016-03-29 22:37:02 +0200283ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700284 @echo --- patching ---
Damjan Marion2ce7f982017-01-09 20:24:50 +0100285 @for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700286 echo Applying patch: $$(basename $$f) ; \
287 patch -p1 -d $(DPDK_SOURCE) < $$f ; \
288 done
Damjan Marion0df78dd2016-03-29 22:37:02 +0200289endif
Ed Warnickecb9cada2015-12-08 15:45:58 -0700290 @touch $@
291
292.PHONY: patch
293patch: $(B)/.patch.ok
294
295$(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config
296 @make $(DPDK_MAKE_ARGS) config
297 @touch $@
298
299.PHONY: config
300config: $(B)/.config.ok
301
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100302.PHONY: build-nasm
303build-nasm:
304 cd $(NASM_SOURCE) && sh configure && make -j
305
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100306.PHONY: build-ipsec-mb
307build-ipsec-mb:
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000308 mkdir -p $(I)/lib/
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100309 # Do not build GCM stuff if we are building ISA_L
Damjan Marion07510dd2018-02-15 11:59:04 +0100310 make -C $(AESNIMB_LIB_SOURCE) -j \
Damjan Marion66e0ce82018-02-21 11:37:24 +0100311 EXTRA_CFLAGS=-fPIC NASM=$(NASM_SOURCE)/nasm
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000312 cp $(AESNIMB_LIB_SOURCE)/libIPSec_MB.a $(I)/lib/
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100313
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100314.PHONY: build-dpdk
315build-dpdk:
316 @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000317 @make $(DPDK_MAKE_ARGS) install
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100318
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100319# Order matters
320ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100321BUILD_TARGETS += build-nasm
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100322BUILD_TARGETS += build-ipsec-mb
323endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100324BUILD_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))
Ed Warnicke798150b2017-11-08 13:39:31 -0700364 @echo "=========================================================="
365 @echo " Out of date DPDK package installed."
366 @echo " Installed: $(INSTALLED_DEB_VER)"
367 @echo " Needed: $(DPDK_VERSION)-$(PKG_SUFFIX)"
368 @echo "=========================================================="
Damjan Marion2ce7f982017-01-09 20:24:50 +0100369 @make $(DEV_DEB)
370 @sudo dpkg -i $(DEV_DEB)
371else
372 @echo "=========================================================="
373 @echo " Up-to-date DPDK package already installed"
374 @echo "=========================================================="
375endif
376
377check-deb:
378ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
379 @echo "=========================================================="
380 @echo " Outdated DPDK package detected:"
381 @echo " Installed: vpp-dpdk-dev $(INSTALLED_DEB_VER)"
382 @echo " Current: vpp-dpdk-dev $(DPDK_VERSION)-$(PKG_SUFFIX)"
383 @echo ""
384 @echo " Please upgrade by invoking 'make dpdk-install-dev'"
385 @echo " from the top level directory."
386 @echo "=========================================================="
387endif
388
389##############################################################################
390# .rpm packaging
391##############################################################################
392
393RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
394DEV_RPM=vpp-dpdk-devel-$(DPDK_VERSION)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
Damjan Marion248968b2017-01-20 23:59:28 +0100395INSTALLED_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 +0100396
397.PHONY: build-rpm install-rpm check-rpm
398
399$(DEV_RPM): Makefile rpm/vpp-dpdk.spec
400 @rpmbuild -bb \
401 --define "_topdir $(CURDIR)/rpm" \
402 --define "_version $(DPDK_VERSION)" \
403 --define "_release $(PKG_SUFFIX)" \
404 $(CURDIR)/rpm/vpp-dpdk.spec
405 mv rpm/RPMS/$(RPM_ARCH)/*.rpm .
406 git clean -fdx rpm
407
408build-rpm: $(DEV_RPM)
409
410install-rpm:
411ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100412 @$(MAKE) $(DEV_RPM)
Damjan Marion2ce7f982017-01-09 20:24:50 +0100413 sudo rpm -Uih $(DEV_RPM)
414else
415 @echo "=========================================================="
416 @echo " Up-to-date DPDK package already installed"
417 @echo "=========================================================="
418endif
419
420check-rpm:
421ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
422 @echo "=========================================================="
423 @echo " Outdated DPDK package detected:"
424 @echo " Installed: vpp-dpdk-devel $(INSTALLED_RPM_VER)"
425 @echo " Current: vpp-dpdk-devel $(DPDK_VERSION)-$(PKG_SUFFIX)"
426 @echo ""
427 @echo " Please upgrade by invoking 'make dpdk-install-dev'"
428 @echo " from the top level directory."
429 @echo "=========================================================="
430endif
431
432##############################################################################
433# ebuild support
434##############################################################################
435
436.PHONY: ebuild-build ebuild-install
437
438ebuild-build:
439ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
440 @echo "=========================================================="
441 @echo "Building DPDK from source. Consider installing development"
442 @echo "package by invoking 'make dpdk-install-dev' from the"
443 @echo "top level directory"
444 @echo "=========================================================="
445 make config
446else
447ifneq ($(INSTALLED_DEB_VER),)
448 make check-deb
449endif
450ifneq ($(INSTALLED_RPM_VER),)
451 make check-rpm
452endif
453endif
454
455ebuild-install:
456ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
457 make install
458endif