blob: ebe62bb5a2344542816dbd424b6618d1e7984d45 [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)
83export CROSS=""
Brian Brooks97465522017-08-28 13:05:26 -050084DPDK_TARGET ?= arm64-armv8a-linuxapp-$(DPDK_CC)
85DPDK_MACHINE ?= armv8a
86DPDK_TUNE ?= generic
Brian Brooksa7191842017-09-06 13:19:48 -050087
88CPU_IMP_ARM = 0x41
89CPU_IMP_CAVIUM = 0x43
90
91CPU_PART_ARM_CORTEX_A53 = 0xd03
92CPU_PART_ARM_CORTEX_A57 = 0xd07
93CPU_PART_ARM_CORTEX_A72 = 0xd08
94CPU_PART_ARM_CORTEX_A73 = 0xd09
95
96CPU_PART_CAVIUM_THUNDERX = 0x0a1
97CPU_PART_CAVIUM_THUNDERX_81XX = 0x0a2
98CPU_PART_CAVIUM_THUNDERX_83XX = 0x0a3
99
100MIDR_IMPLEMENTER=$(shell awk '/implementer/ {print $$4;exit}' /proc/cpuinfo)
101MIDR_PARTNUM=$(shell awk '/part/ {print $$4;exit}' /proc/cpuinfo)
102
103ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_ARM))
104##############################################################################
105# Arm Cortex
106##############################################################################
107CPU_PART_ARM_TUNE := $(CPU_PART_ARM_CORTEX_A53)/cortex-a53 \
108 $(CPU_PART_ARM_CORTEX_A57)/cortex-a57 \
109 $(CPU_PART_ARM_CORTEX_A72)/cortex-a72 \
110 $(CPU_PART_ARM_CORTEX_A73)/cortex-a73
111CPU_TUNE = $(notdir $(filter $(MIDR_PARTNUM)/%,$(CPU_PART_ARM_TUNE)))
112ifneq ($(CPU_TUNE),)
113DPDK_TUNE = $(CPU_TUNE)
114else
115$(warning Unknown Arm CPU)
116endif
117
118else ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_CAVIUM))
119##############################################################################
120# Cavium ThunderX
121##############################################################################
122ifneq (,$(findstring $(MIDR_PARTNUM),$(CPU_PART_CAVIUM_THUNDERX) \
123 $(CPU_PART_CAVIUM_THUNDERX_81XX) $(CPU_PART_CAVIUM_THUNDERX_83XX)))
124DPDK_TARGET = arm64-thunderx-linuxapp-$(DPDK_CC)
125DPDK_MACHINE = thunderx
126else
127$(warning Unknown Cavium CPU)
128endif
Brian Brooks97465522017-08-28 13:05:26 -0500129endif
Damjan Marion78edb8e2017-02-06 22:28:52 +0100130
131##############################################################################
Brian Brooksa7191842017-09-06 13:19:48 -0500132# Unknown platform
Damjan Marion78edb8e2017-02-06 22:28:52 +0100133##############################################################################
134else
Brian Brooksa7191842017-09-06 13:19:48 -0500135$(error Unknown platform)
Christophe Fontaine737547e2016-05-11 08:40:33 +0000136endif
137
Chris Lukeb2861e82017-06-14 11:24:41 -0400138# /proc/cpuinfo does not exist on platforms without a /proc and on some
139# platforms, notably inside containers, it has no content. In those cases
140# we assume there's 1 processor; we use 2*ncpu for the -j option.
141# NB: GNU Make 4.2 will let us use '$(file </proc/cpuinfo)' to both test
142# for file presence and content; for now this will have to do.
143JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
Damjan Marion93242842017-11-13 20:09:21 +0100144 $(shell grep -c ^processor /proc/cpuinfo), 2)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700145
146# compiler/linker custom arguments
147DPDK_CPU_CFLAGS := -pie -fPIC
Ed Warnickecb9cada2015-12-08 15:45:58 -0700148
149ifeq ($(DPDK_DEBUG),n)
Damjan Marion1c80e832016-05-11 23:07:18 +0200150DPDK_EXTRA_CFLAGS := -g -mtune=$(DPDK_TUNE)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700151else
Damjan Marione39a7b82016-04-26 14:54:57 +0200152DPDK_EXTRA_CFLAGS := -g -O0
Ed Warnickecb9cada2015-12-08 15:45:58 -0700153endif
154
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000155DPDK_MAKE_EXTRA_ARGS += AESNI_MULTI_BUFFER_LIB_PATH=$(AESNIMB_LIB_SOURCE)
Radu Nicolau2e3677b2017-02-20 12:27:02 +0000156
Ed Warnickecb9cada2015-12-08 15:45:58 -0700157# assemble DPDK make arguments
158DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \
159 T=$(DPDK_TARGET) \
160 RTE_CONFIG_TEMPLATE=../custom-config \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700161 EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \
162 EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \
163 CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \
Damjan Marion2ce7f982017-01-09 20:24:50 +0100164 DESTDIR=$(I) \
Christophe Fontaine737547e2016-05-11 08:40:33 +0000165 $(DPDK_MAKE_EXTRA_ARGS)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700166
Ed Warnickecb9cada2015-12-08 15:45:58 -0700167define set
168@if grep -q CONFIG_$1 $@ ; \
169 then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \
170 else echo CONFIG_$1=$2 >> $@ ; \
171fi
172endef
173
174all: build
175
176$(B)/custom-config: $(B)/.patch.ok Makefile
Damjan Marion106f0ed2016-04-26 10:44:28 +0200177 @echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) ---
178 @cpp -undef -ffreestanding -x assembler-with-cpp $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700179 $(call set,RTE_MACHINE,$(DPDK_MACHINE))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700180 @# modify options
Damjan Marion13f07182016-02-05 06:44:54 -0800181 $(call set,RTE_MAX_LCORE,256)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700182 $(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM))
Damjan Marion3473e492018-02-24 19:21:14 +0100183 $(call set,RTE_CACHE_LINE_SIZE,$(DPDK_CACHE_LINE_SIZE))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700184 $(call set,RTE_LIBEAL_USE_HPET,y)
185 $(call set,RTE_BUILD_COMBINE_LIBS,y)
Damjan Mariona1556802016-06-26 20:12:40 +0200186 $(call set,RTE_PCI_CONFIG,y)
187 $(call set,RTE_PCI_EXTENDED_TAG,"on")
188 $(call set,RTE_PCI_MAX_READ_REQUEST_SIZE,4096)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700189 @# enable debug init for device drivers
190 $(call set,RTE_LIBRTE_I40E_DEBUG_INIT,$(DPDK_DEBUG))
191 $(call set,RTE_LIBRTE_IXGBE_DEBUG_INIT,$(DPDK_DEBUG))
192 $(call set,RTE_LIBRTE_E1000_DEBUG_INIT,$(DPDK_DEBUG))
193 $(call set,RTE_LIBRTE_VIRTIO_DEBUG_INIT,$(DPDK_DEBUG))
194 $(call set,RTE_LIBRTE_VMXNET3_DEBUG_INIT,$(DPDK_DEBUG))
John Lod9bf9ab2016-02-25 11:17:55 -0500195 $(call set,RTE_LIBRTE_PMD_BOND,y)
196 $(call set,RTE_LIBRTE_IP_FRAG,y)
Sergio Gonzalez Monroyd04b60b2017-01-20 15:35:23 +0000197 $(call set,RTE_LIBRTE_PMD_QAT,y)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100198 $(call set,RTE_LIBRTE_PMD_AESNI_MB,$(AESNI))
199 $(call set,RTE_LIBRTE_PMD_AESNI_GCM,$(AESNI))
Damjan Marion6a5be212017-05-11 14:55:43 +0200200 $(call set,RTE_LIBRTE_MLX4_PMD,$(DPDK_MLX4_PMD))
Damjan Marion696f1ad2016-12-23 22:42:41 +0100201 $(call set,RTE_LIBRTE_MLX5_PMD,$(DPDK_MLX5_PMD))
Amir Zeidner0e7fe4f2018-03-05 14:32:22 +0200202 $(call set,RTE_LIBRTE_MLX4_DLOPEN_DEPS,$(DPDK_MLX4_PMD))
203 $(call set,RTE_LIBRTE_MLX5_DLOPEN_DEPS,$(DPDK_MLX5_PMD))
Rui Cai60bd3022018-05-11 21:52:22 +0000204 $(call set,RTE_LIBRTE_PMD_TAP,$(DPDK_TAP_PMD))
205 $(call set,RTE_LIBRTE_PMD_FAILSAFE,$(DPDK_FAILSAFE_PMD))
Ed Warnickecb9cada2015-12-08 15:45:58 -0700206 @# not needed
Ed Warnickecb9cada2015-12-08 15:45:58 -0700207 $(call set,RTE_LIBRTE_TIMER,n)
208 $(call set,RTE_LIBRTE_CFGFILE,n)
209 $(call set,RTE_LIBRTE_LPM,n)
210 $(call set,RTE_LIBRTE_ACL,n)
211 $(call set,RTE_LIBRTE_POWER,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700212 $(call set,RTE_LIBRTE_DISTRIBUTOR,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700213 $(call set,RTE_LIBRTE_PORT,n)
214 $(call set,RTE_LIBRTE_TABLE,n)
215 $(call set,RTE_LIBRTE_PIPELINE,n)
Damjan Marion45b48502017-11-17 09:46:41 +0100216 $(call set,RTE_LIBRTE_FLOW_CLASSIFY,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700217 $(call set,RTE_KNI_KMOD,n)
Damjan Marion68fda1c2017-01-01 16:53:22 +0100218 $(call set,RTE_EAL_IGB_UIO,n)
Marco Varlese1355fcd2018-02-22 16:03:35 +0100219 @# currently broken in 18.02
220 $(call set,RTE_LIBRTE_DPAA_BUS,n)
221 $(call set,RTE_LIBRTE_DPAA_MEMPOOL,n)
222 $(call set,RTE_LIBRTE_DPAA_PMD,n)
223 $(call set,RTE_LIBRTE_PMD_DPAA_SEC,n)
224 $(call set,RTE_LIBRTE_PMD_DPAA_EVENTDEV,n)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700225 @rm -f .config.ok
226
227$(CURDIR)/$(DPDK_TARBALL):
Ed Warnickecb9cada2015-12-08 15:45:58 -0700228 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \
229 then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \
230 else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \
231 fi
232 @rm -f $(B)/.download.ok
233
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100234$(CURDIR)/$(NASM_TARBALL):
235 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) ] ; \
236 then cp $(DPDK_DOWNLOAD_DIR)/$(NASM_TARBALL) $(CURDIR) ; \
237 else curl -o $(CURDIR)/$(NASM_TARBALL) -LO $(NASM_TAR_URL) ; \
238 fi
239
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000240$(CURDIR)/$(AESNIMB_LIB_TARBALL):
241 @if [ -e $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) ] ; \
242 then cp $(DPDK_DOWNLOAD_DIR)/$(AESNIMB_LIB_TARBALL) $(CURDIR) ; \
243 else curl -o $@ -LO $(AESNIMB_LIB_TARBALL_URL) ; \
244 fi
245
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000246DPDK_DOWNLOADS = $(CURDIR)/$(DPDK_TARBALL)
Sergio Gonzalez Monroy618f7b02017-07-19 16:22:28 +0100247ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100248DPDK_DOWNLOADS += $(CURDIR)/$(NASM_TARBALL)
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000249DPDK_DOWNLOADS += $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100250endif
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000251
252$(B)/.download.ok: $(DPDK_DOWNLOADS)
Damjan Marion2ce7f982017-01-09 20:24:50 +0100253 @mkdir -p $(B)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700254 @openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum
Damjan Marionbce6b6a2015-12-16 04:27:37 +0100255 @([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700256 ( echo "Bad Checksum! Please remove $< and retry" && \
257 rm $(B)/$(DPDK_TARBALL).md5sum && false ))
258 @touch $@
259
260.PHONY: download
261download: $(B)/.download.ok
262
263$(B)/.extract.ok: $(B)/.download.ok
264 @echo --- extracting $(DPDK_TARBALL) ---
Thomas Monjalon96e10b52016-06-02 14:52:32 +0200265 @tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL)
Marco Varlese8ddd5182017-08-14 16:07:00 +0200266ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100267 @echo --- extracting $(NASM_TARBALL) ---
268 @tar --directory $(B) --extract --file $(CURDIR)/$(NASM_TARBALL)
Radu Nicolau6ca42d32017-02-16 13:54:42 +0000269 @echo --- extracting $(AESNIMB_LIB_TARBALL) ---
270 @tar --directory $(B) --extract --file $(CURDIR)/$(AESNIMB_LIB_TARBALL)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100271endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100272 @touch $@
Ed Warnickecb9cada2015-12-08 15:45:58 -0700273
274.PHONY: extract
275extract: $(B)/.extract.ok
276
277$(B)/.patch.ok: $(B)/.extract.ok
Damjan Marion0df78dd2016-03-29 22:37:02 +0200278ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700279 @echo --- patching ---
Damjan Marion2ce7f982017-01-09 20:24:50 +0100280 @for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
Ed Warnickecb9cada2015-12-08 15:45:58 -0700281 echo Applying patch: $$(basename $$f) ; \
282 patch -p1 -d $(DPDK_SOURCE) < $$f ; \
283 done
Damjan Marion0df78dd2016-03-29 22:37:02 +0200284endif
Ed Warnickecb9cada2015-12-08 15:45:58 -0700285 @touch $@
286
287.PHONY: patch
288patch: $(B)/.patch.ok
289
290$(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config
291 @make $(DPDK_MAKE_ARGS) config
292 @touch $@
293
294.PHONY: config
295config: $(B)/.config.ok
296
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100297.PHONY: build-nasm
298build-nasm:
299 cd $(NASM_SOURCE) && sh configure && make -j
300
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100301.PHONY: build-ipsec-mb
302build-ipsec-mb:
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000303 mkdir -p $(I)/lib/
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100304 # Do not build GCM stuff if we are building ISA_L
Damjan Marion07510dd2018-02-15 11:59:04 +0100305 make -C $(AESNIMB_LIB_SOURCE) -j \
Damjan Marion66e0ce82018-02-21 11:37:24 +0100306 EXTRA_CFLAGS=-fPIC NASM=$(NASM_SOURCE)/nasm
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000307 cp $(AESNIMB_LIB_SOURCE)/libIPSec_MB.a $(I)/lib/
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100308
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100309.PHONY: build-dpdk
310build-dpdk:
311 @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi
Sergio Gonzalez Monroyfa80f2e2017-03-07 14:39:29 +0000312 @make $(DPDK_MAKE_ARGS) install
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100313
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100314# Order matters
315ifeq ($(AESNI),y)
Sergio Gonzalez Monroy6184db32017-10-27 08:58:38 +0100316BUILD_TARGETS += build-nasm
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100317BUILD_TARGETS += build-ipsec-mb
318endif
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100319BUILD_TARGETS += build-dpdk
320
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100321$(B)/.build.ok: $(BUILD_TARGETS)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700322 @touch $@
323
324.PHONY: build
325build: $(B)/.build.ok
326
Damjan Marion2ce7f982017-01-09 20:24:50 +0100327.PHONY: install
328install: $(B)/.build.ok
329
Ed Warnickecb9cada2015-12-08 15:45:58 -0700330.PHONY: clean
331clean:
332 @rm -rf $(B) $(I)
333
Damjan Marion2ce7f982017-01-09 20:24:50 +0100334##############################################################################
335# .deb packaging
336##############################################################################
337
338DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
339DEV_DEB=vpp-dpdk-dev_$(DPDK_VERSION)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
340INSTALLED_DEB_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-dpdk-dev 2> /dev/null)
341
342.PHONY: build-deb install-deb check-deb
343
344deb/debian/changelog: Makefile
345 @echo "vpp-dpdk ($(DPDK_VERSION)-$(PKG_SUFFIX)) unstable; urgency=low" > $@
346 @echo "" >> $@
347 @echo " * DPDK Release $(DPDK_VERSION)" >> $@
348 @echo "" >> $@
349 @echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R)" >> $@
350
351$(DEV_DEB): deb/debian/changelog
352 @cd deb && dpkg-buildpackage -b -uc -us
353 git clean -fdx deb
354
355build-deb: $(DEV_DEB)
356
357install-deb:
358ifneq ($(INSTALLED_DEB_VER),$(DPDK_VERSION)-$(PKG_SUFFIX))
Ed Warnicke798150b2017-11-08 13:39:31 -0700359 @echo "=========================================================="
360 @echo " Out of date DPDK package installed."
361 @echo " Installed: $(INSTALLED_DEB_VER)"
362 @echo " Needed: $(DPDK_VERSION)-$(PKG_SUFFIX)"
363 @echo "=========================================================="
Damjan Marion2ce7f982017-01-09 20:24:50 +0100364 @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