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