blob: 40c7b9a164205a6ba0a8039aab6839d4efb6553f [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
Ed Warnickecb9cada2015-12-08 15:45:58 -070025
26B := $(DPDK_BUILD_DIR)
27I := $(DPDK_INSTALL_DIR)
Damjan Marion1d3ab722018-02-16 09:07:42 +010028DPDK_VERSION ?= 18.02
Damjan Marion7f0d1d32017-11-21 16:22:55 +010029PKG_SUFFIX ?= vpp1
Damjan Marionde3ff7a2017-11-29 12:28:38 +010030DPDK_BASE_URL ?= http://fast.dpdk.org/rel
Thomas Monjalon96e10b52016-06-02 14:52:32 +020031DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
Damjan Mariondab123b2016-03-29 16:43:58 +020032DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
Damjan Marion45b48502017-11-17 09:46:41 +010033DPDK_17.11_TARBALL_MD5_CKSUM := 53ee9e054a8797c9e67ffa0eb5d0c701
Damjan Marion07510dd2018-02-15 11:59:04 +010034DPDK_18.02_TARBALL_MD5_CKSUM := ca13077a014a2102c6e10153dfa3b920
Damjan Marionde3ff7a2017-11-29 12:28:38 +010035DPDK_SOURCE := $(B)/dpdk-$(DPDK_VERSION)
Damjan Marion5f22f4d2017-08-21 22:19:04 +020036MACHINE=$(shell uname -m)
Radu Nicolau2e3677b2017-02-20 12:27:02 +000037
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +010038NASM_BASE_URL := http://www.nasm.us/pub/nasm/releasebuilds
39NASM_VER := 2.13.01
40NASM_TARBALL := nasm-$(NASM_VER).tar.xz
41NASM_TAR_URL := $(NASM_BASE_URL)/$(NASM_VER)/$(NASM_TARBALL)
42NASM_SOURCE := $(B)/nasm-$(NASM_VER)
43
Damjan Marion07510dd2018-02-15 11:59:04 +010044ifeq ($(DPDK_VERSION),17.11)
Damjan Marion45b48502017-11-17 09:46:41 +010045IPSEC_MB_VER ?= 0.47
Damjan Marion07510dd2018-02-15 11:59:04 +010046else
47IPSEC_MB_VER ?= 0.48
Damjan Marion45b48502017-11-17 09:46:41 +010048endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010049
Marco Varlese8ddd5182017-08-14 16:07:00 +020050ifeq ($(MACHINE),$(filter $(MACHINE),x86_64))
Thomas F Herbert4b0ac822017-08-29 16:07:51 -040051 AESNI ?= y
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010052$(info Building IPSec-MB $(IPSEC_MB_VER) library)
Thomas F Herbert4b0ac822017-08-29 16:07:51 -040053else
54 AESNI ?= N
Marco Varlese8ddd5182017-08-14 16:07:00 +020055endif
56
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010057AESNIMB_LIB_TARBALL := v$(IPSEC_MB_VER).tar.gz
Radu Nicolau6ca42d32017-02-16 13:54:42 +000058AESNIMB_LIB_TARBALL_URL := http://github.com/01org/intel-ipsec-mb/archive/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010059AESNIMB_LIB_SOURCE := $(B)/intel-ipsec-mb-$(IPSEC_MB_VER)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +010060
Damjan Marione39a7b82016-04-26 14:54:57 +020061ifneq (,$(findstring clang,$(CC)))
62DPDK_CC=clang
Damjan Marion78edb8e2017-02-06 22:28:52 +010063else ifneq (,$(findstring icc,$(CC)))
64DPDK_CC=icc
Damjan Marione39a7b82016-04-26 14:54:57 +020065else
66DPDK_CC=gcc
67endif
68
Damjan Marion78edb8e2017-02-06 22:28:52 +010069##############################################################################
Damjan Marion1664f9b2017-04-24 20:48:53 +020070# Intel x86
Damjan Marion78edb8e2017-02-06 22:28:52 +010071##############################################################################
Damjan Marion1664f9b2017-04-24 20:48:53 +020072ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686))
73DPDK_TARGET ?= $(MACHINE)-native-linuxapp-$(DPDK_CC)
Damjan Marion78edb8e2017-02-06 22:28:52 +010074DPDK_MACHINE ?= nhm
75DPDK_TUNE ?= core-avx2
Brian Brooksa7191842017-09-06 13:19:48 -050076
77##############################################################################
78# ARM64
79##############################################################################
Brian Brooks97465522017-08-28 13:05:26 -050080else ifeq ($(MACHINE),aarch64)
81export CROSS=""
Brian Brooks97465522017-08-28 13:05:26 -050082DPDK_TARGET ?= arm64-armv8a-linuxapp-$(DPDK_CC)
83DPDK_MACHINE ?= armv8a
84DPDK_TUNE ?= generic
Brian Brooksa7191842017-09-06 13:19:48 -050085
86CPU_IMP_ARM = 0x41
87CPU_IMP_CAVIUM = 0x43
88
89CPU_PART_ARM_CORTEX_A53 = 0xd03
90CPU_PART_ARM_CORTEX_A57 = 0xd07
91CPU_PART_ARM_CORTEX_A72 = 0xd08
92CPU_PART_ARM_CORTEX_A73 = 0xd09
93
94CPU_PART_CAVIUM_THUNDERX = 0x0a1
95CPU_PART_CAVIUM_THUNDERX_81XX = 0x0a2
96CPU_PART_CAVIUM_THUNDERX_83XX = 0x0a3
97
98MIDR_IMPLEMENTER=$(shell awk '/implementer/ {print $$4;exit}' /proc/cpuinfo)
99MIDR_PARTNUM=$(shell awk '/part/ {print $$4;exit}' /proc/cpuinfo)
100
101ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_ARM))
102##############################################################################
103# Arm Cortex
104##############################################################################
105CPU_PART_ARM_TUNE := $(CPU_PART_ARM_CORTEX_A53)/cortex-a53 \
106 $(CPU_PART_ARM_CORTEX_A57)/cortex-a57 \
107 $(CPU_PART_ARM_CORTEX_A72)/cortex-a72 \
108 $(CPU_PART_ARM_CORTEX_A73)/cortex-a73
109CPU_TUNE = $(notdir $(filter $(MIDR_PARTNUM)/%,$(CPU_PART_ARM_TUNE)))
110ifneq ($(CPU_TUNE),)
111DPDK_TUNE = $(CPU_TUNE)
112else
113$(warning Unknown Arm CPU)
114endif
115
116else ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_CAVIUM))
117##############################################################################
118# Cavium ThunderX
119##############################################################################
120ifneq (,$(findstring $(MIDR_PARTNUM),$(CPU_PART_CAVIUM_THUNDERX) \
121 $(CPU_PART_CAVIUM_THUNDERX_81XX) $(CPU_PART_CAVIUM_THUNDERX_83XX)))
122DPDK_TARGET = arm64-thunderx-linuxapp-$(DPDK_CC)
123DPDK_MACHINE = thunderx
124else
125$(warning Unknown Cavium CPU)
126endif
Brian Brooks97465522017-08-28 13:05:26 -0500127endif
Damjan Marion78edb8e2017-02-06 22:28:52 +0100128
129##############################################################################
Brian Brooksa7191842017-09-06 13:19:48 -0500130# Unknown platform
Damjan Marion78edb8e2017-02-06 22:28:52 +0100131##############################################################################
132else
Brian Brooksa7191842017-09-06 13:19:48 -0500133$(error Unknown platform)
Christophe Fontaine737547e2016-05-11 08:40:33 +0000134endif
135
Chris Lukeb2861e82017-06-14 11:24:41 -0400136# /proc/cpuinfo does not exist on platforms without a /proc and on some
137# platforms, notably inside containers, it has no content. In those cases
138# we assume there's 1 processor; we use 2*ncpu for the -j option.
139# NB: GNU Make 4.2 will let us use '$(file </proc/cpuinfo)' to both test
140# for file presence and content; for now this will have to do.
141JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
Damjan Marion93242842017-11-13 20:09:21 +0100142 $(shell grep -c ^processor /proc/cpuinfo), 2)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700143
144# compiler/linker custom arguments
145DPDK_CPU_CFLAGS := -pie -fPIC
Ed Warnickecb9cada2015-12-08 15:45:58 -0700146
147ifeq ($(DPDK_DEBUG),n)
Damjan Marion1c80e832016-05-11 23:07:18 +0200148DPDK_EXTRA_CFLAGS := -g -mtune=$(DPDK_TUNE)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700149else
Damjan Marione39a7b82016-04-26 14:54:57 +0200150DPDK_EXTRA_CFLAGS := -g -O0
Ed Warnickecb9cada2015-12-08 15:45:58 -0700151endif
152
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000153DPDK_MAKE_EXTRA_ARGS += AESNI_MULTI_BUFFER_LIB_PATH=$(AESNIMB_LIB_SOURCE)
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000154
Ed Warnickecb9cada2015-12-08 15:45:58 -0700155# assemble DPDK make arguments
156DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \
157 T=$(DPDK_TARGET) \
158 RTE_CONFIG_TEMPLATE=../custom-config \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700159 EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \
160 EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \
161 CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \
Damjan Marion2ce7f982017-01-09 20:24:50 +0100162 DESTDIR=$(I) \
Christophe Fontaine737547e2016-05-11 08:40:33 +0000163 $(DPDK_MAKE_EXTRA_ARGS)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700164
Ed Warnickecb9cada2015-12-08 15:45:58 -0700165define set
166@if grep -q CONFIG_$1 $@ ; \
167 then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \
168 else echo CONFIG_$1=$2 >> $@ ; \
169fi
170endef
171
172all: build
173
174$(B)/custom-config: $(B)/.patch.ok Makefile
Damjan Marion106f0ed2016-04-26 10:44:28 +0200175 @echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) ---
176 @cpp -undef -ffreestanding -x assembler-with-cpp $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700177 $(call set,RTE_MACHINE,$(DPDK_MACHINE))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700178 @# modify options
Damjan Marion13f07182016-02-05 06:44:54 -0800179 $(call set,RTE_MAX_LCORE,256)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700180 $(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM))
Damjan Marion3473e492018-02-24 19:21:14 +0100181 $(call set,RTE_CACHE_LINE_SIZE,$(DPDK_CACHE_LINE_SIZE))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700182 $(call set,RTE_LIBEAL_USE_HPET,y)
183 $(call set,RTE_BUILD_COMBINE_LIBS,y)
Damjan Mariona1556802016-06-26 20:12:40 +0200184 $(call set,RTE_PCI_CONFIG,y)
185 $(call set,RTE_PCI_EXTENDED_TAG,"on")
186 $(call set,RTE_PCI_MAX_READ_REQUEST_SIZE,4096)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700187 @# enable debug init for device drivers
188 $(call set,RTE_LIBRTE_I40E_DEBUG_INIT,$(DPDK_DEBUG))
189 $(call set,RTE_LIBRTE_IXGBE_DEBUG_INIT,$(DPDK_DEBUG))
190 $(call set,RTE_LIBRTE_E1000_DEBUG_INIT,$(DPDK_DEBUG))
191 $(call set,RTE_LIBRTE_VIRTIO_DEBUG_INIT,$(DPDK_DEBUG))
192 $(call set,RTE_LIBRTE_VMXNET3_DEBUG_INIT,$(DPDK_DEBUG))
John Lod9bf9ab2016-02-25 11:17:55 -0500193 $(call set,RTE_LIBRTE_PMD_BOND,y)
194 $(call set,RTE_LIBRTE_IP_FRAG,y)
Sergio Gonzalez Monroyd04b60b2017-01-20 15:35:23 +0000195 $(call set,RTE_LIBRTE_PMD_QAT,y)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100196 $(call set,RTE_LIBRTE_PMD_AESNI_MB,$(AESNI))
197 $(call set,RTE_LIBRTE_PMD_AESNI_GCM,$(AESNI))
Damjan Marion6a5be212017-05-11 14:55:43 +0200198 $(call set,RTE_LIBRTE_MLX4_PMD,$(DPDK_MLX4_PMD))
Damjan Marion696f1ad2016-12-23 22:42:41 +0100199 $(call set,RTE_LIBRTE_MLX5_PMD,$(DPDK_MLX5_PMD))
Amir Zeidner0e7fe4f2018-03-05 14:32:22 +0200200 $(call set,RTE_LIBRTE_MLX4_DLOPEN_DEPS,$(DPDK_MLX4_PMD))
201 $(call set,RTE_LIBRTE_MLX5_DLOPEN_DEPS,$(DPDK_MLX5_PMD))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700202 @# not needed
Damjan Marion844e0eb2017-08-21 22:27:04 +0200203 $(call set,RTE_LIBRTE_PMD_TAP,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700204 $(call set,RTE_LIBRTE_TIMER,n)
205 $(call set,RTE_LIBRTE_CFGFILE,n)
206 $(call set,RTE_LIBRTE_LPM,n)
207 $(call set,RTE_LIBRTE_ACL,n)
208 $(call set,RTE_LIBRTE_POWER,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700209 $(call set,RTE_LIBRTE_DISTRIBUTOR,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700210 $(call set,RTE_LIBRTE_PORT,n)
211 $(call set,RTE_LIBRTE_TABLE,n)
212 $(call set,RTE_LIBRTE_PIPELINE,n)
Damjan Marion45b48502017-11-17 09:46:41 +0100213 $(call set,RTE_LIBRTE_FLOW_CLASSIFY,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700214 $(call set,RTE_KNI_KMOD,n)
Damjan Marion68fda1c2017-01-01 16:53:22 +0100215 $(call set,RTE_EAL_IGB_UIO,n)
Marco Varlese1355fcd2018-02-22 16:03:35 +0100216 @# currently broken in 18.02
217 $(call set,RTE_LIBRTE_DPAA_BUS,n)
218 $(call set,RTE_LIBRTE_DPAA_MEMPOOL,n)
219 $(call set,RTE_LIBRTE_DPAA_PMD,n)
220 $(call set,RTE_LIBRTE_PMD_DPAA_SEC,n)
221 $(call set,RTE_LIBRTE_PMD_DPAA_EVENTDEV,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700222 @rm -f .config.ok
223
224$(CURDIR)/$(DPDK_TARBALL):
Ed Warnickecb9cada2015-12-08 15:45:58 -0700225 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \
226 then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \
227 else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \
228 fi
229 @rm -f $(B)/.download.ok
230
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100231$(CURDIR)/$(NASM_TARBALL):
232 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) ] ; \
233 then cp $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) $(CURDIR) ; \
234 else curl -o $(CURDIR)/$(NASM_TARBALL) -LO $(NASM_TAR_URL) ; \
235 fi
236
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000237$(CURDIR)/$(AESNIMB_LIB_TARBALL):
238 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) ] ; \
239 then cp $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) $(CURDIR) ; \
240 else curl -o $@ -LO $(AESNIMB_LIB_TARBALL_URL) ; \
241 fi
242
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000243DPDK_DOWNLOADS = $(CURDIR)/$(DPDK_TARBALL)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100244ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100245DPDK_DOWNLOADS += $(CURDIR)/$(NASM_TARBALL)
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000246DPDK_DOWNLOADS += $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +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)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100264 @echo --- extracting $(NASM_TARBALL) ---
265 @tar --directory $(B) --extract --file $(CURDIR)/$(NASM_TARBALL)
Radu Nicolau6ca42d32017-02-16 13:54:42 +0000266 @echo --- extracting $(AESNIMB_LIB_TARBALL) ---
267 @tar --directory $(B) --extract --file $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100268endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100269 @touch $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700270
271.PHONY: extract
272extract: $(B)/.extract.ok
273
274$(B)/.patch.ok: $(B)/.extract.ok
Damjan Marion0df78dd2016-03-29 22:37:02 +0200275ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700276 @echo --- patching ---
Damjan Marion2ce7f982017-01-09 20:24:50 +0100277 @for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700278 echo Applying patch: $$(basename $$f) ; \
279 patch -p1 -d $(DPDK_SOURCE) < $$f ; \
280 done
Damjan Marion0df78dd2016-03-29 22:37:02 +0200281endif
Ed Warnickecb9cada2015-12-08 15:45:58 -0700282 @touch $@
283
284.PHONY: patch
285patch: $(B)/.patch.ok
286
287$(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config
288 @make $(DPDK_MAKE_ARGS) config
289 @touch $@
290
291.PHONY: config
292config: $(B)/.config.ok
293
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100294.PHONY: build-nasm
295build-nasm:
296 cd $(NASM_SOURCE) && sh configure && make -j
297
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100298.PHONY: build-ipsec-mb
299build-ipsec-mb:
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000300 mkdir -p $(I)/lib/
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100301 # Do not build GCM stuff if we are building ISA_L
Damjan Marion07510dd2018-02-15 11:59:04 +0100302 make -C $(AESNIMB_LIB_SOURCE) -j \
Damjan Marion66e0ce82018-02-21 11:37:24 +0100303 EXTRA_CFLAGS=-fPIC NASM=$(NASM_SOURCE)/nasm
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000304 cp $(AESNIMB_LIB_SOURCE)/libIPSec_MB.a $(I)/lib/
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100305
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100306.PHONY: build-dpdk
307build-dpdk:
308 @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000309 @make $(DPDK_MAKE_ARGS) install
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100310
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100311# Order matters
312ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100313BUILD_TARGETS += build-nasm
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100314BUILD_TARGETS += build-ipsec-mb
315endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100316BUILD_TARGETS += build-dpdk
317
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100318$(B)/.build.ok: $(BUILD_TARGETS)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700319 @touch $@
320
321.PHONY: build
322build: $(B)/.build.ok
323
Damjan Marion2ce7f982017-01-09 20:24:50 +0100324.PHONY: install
325install: $(B)/.build.ok
326
Ed Warnickecb9cada2015-12-08 15:45:58 -0700327.PHONY: clean
328clean:
329 @rm -rf $(B) $(I)
330
Damjan Marion2ce7f982017-01-09 20:24:50 +0100331##############################################################################
332# .deb packaging
333##############################################################################
334
335DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
336DEV_DEB=vpp-dpdk-dev_$(DPDK_VERSION)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
337INSTALLED_DEB_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-dpdk-dev 2> /dev/null)
338
339.PHONY: build-deb install-deb check-deb
340
341deb/debian/changelog: Makefile
342 @echo "vpp-dpdk ($(DPDK_VERSION)-$(PKG_SUFFIX)) unstable; urgency=low" > $@
343 @echo "" >> $@
344 @echo " * DPDK Release $(DPDK_VERSION)" >> $@
345 @echo "" >> $@
346 @echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R)" >> $@
347
348$(DEV_DEB): deb/debian/changelog
349 @cd deb && dpkg-buildpackage -b -uc -us
350 git clean -fdx deb
351
352build-deb: $(DEV_DEB)
353
354install-deb:
355ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
Ed Warnicke798150b2017-11-08 13:39:31 -0700356 @echo "=========================================================="
357 @echo " Out of date DPDK package installed."
358 @echo " Installed: $(INSTALLED_DEB_VER)"
359 @echo " Needed: $(DPDK_VERSION)-$(PKG_SUFFIX)"
360 @echo "=========================================================="
Damjan Marion2ce7f982017-01-09 20:24:50 +0100361 @make $(DEV_DEB)
362 @sudo dpkg -i $(DEV_DEB)
363else
364 @echo "=========================================================="
365 @echo " Up-to-date DPDK package already installed"
366 @echo "=========================================================="
367endif
368
369check-deb:
370ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
371 @echo "=========================================================="
372 @echo " Outdated DPDK package detected:"
373 @echo " Installed: vpp-dpdk-dev $(INSTALLED_DEB_VER)"
374 @echo " Current: vpp-dpdk-dev $(DPDK_VERSION)-$(PKG_SUFFIX)"
375 @echo ""
376 @echo " Please upgrade by invoking 'make dpdk-install-dev'"
377 @echo " from the top level directory."
378 @echo "=========================================================="
379endif
380
381##############################################################################
382# .rpm packaging
383##############################################################################
384
385RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
386DEV_RPM=vpp-dpdk-devel-$(DPDK_VERSION)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
Damjan Marion248968b2017-01-20 23:59:28 +0100387INSTALLED_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 +0100388
389.PHONY: build-rpm install-rpm check-rpm
390
391$(DEV_RPM): Makefile rpm/vpp-dpdk.spec
392 @rpmbuild -bb \
393 --define "_topdir $(CURDIR)/rpm" \
394 --define "_version $(DPDK_VERSION)" \
395 --define "_release $(PKG_SUFFIX)" \
396 $(CURDIR)/rpm/vpp-dpdk.spec
397 mv rpm/RPMS/$(RPM_ARCH)/*.rpm .
398 git clean -fdx rpm
399
400build-rpm: $(DEV_RPM)
401
402install-rpm:
403ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100404 @$(MAKE) $(DEV_RPM)
Damjan Marion2ce7f982017-01-09 20:24:50 +0100405 sudo rpm -Uih $(DEV_RPM)
406else
407 @echo "=========================================================="
408 @echo " Up-to-date DPDK package already installed"
409 @echo "=========================================================="
410endif
411
412check-rpm:
413ifneq ($(INSTALLED_RPM_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
414 @echo "=========================================================="
415 @echo " Outdated DPDK package detected:"
416 @echo " Installed: vpp-dpdk-devel $(INSTALLED_RPM_VER)"
417 @echo " Current: vpp-dpdk-devel $(DPDK_VERSION)-$(PKG_SUFFIX)"
418 @echo ""
419 @echo " Please upgrade by invoking 'make dpdk-install-dev'"
420 @echo " from the top level directory."
421 @echo "=========================================================="
422endif
423
424##############################################################################
425# ebuild support
426##############################################################################
427
428.PHONY: ebuild-build ebuild-install
429
430ebuild-build:
431ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
432 @echo "=========================================================="
433 @echo "Building DPDK from source. Consider installing development"
434 @echo "package by invoking 'make dpdk-install-dev' from the"
435 @echo "top level directory"
436 @echo "=========================================================="
437 make config
438else
439ifneq ($(INSTALLED_DEB_VER),)
440 make check-deb
441endif
442ifneq ($(INSTALLED_RPM_VER),)
443 make check-rpm
444endif
445endif
446
447ebuild-install:
448ifeq ($(INSTALLED_DEB_VER)$(INSTALLED_RPM_VER),)
449 make install
450endif