blob: a2d8b18be3b0a0e5db0212682a4ee5fc7d2a348b [file] [log] [blame]
Dave Wallace51a037d2021-11-06 10:59:22 -04001# Copyright (c) 2021 Cisco and/or its affiliates.
Damjan Marione17fdb52016-02-10 00:36:06 +01002# 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
Damjan Marion6484b3b2017-01-15 21:30:50 +010014export WS_ROOT=$(CURDIR)
15export BR=$(WS_ROOT)/build-root
Damjan Marione17fdb52016-02-10 00:36:06 +010016CCACHE_DIR?=$(BR)/.ccache
Tom Jonesc3b416c2024-01-18 14:51:44 +000017SHELL:=$(shell which bash)
Damjan Marione17fdb52016-02-10 00:36:06 +010018GDB?=gdb
Damjan Marione6f90232016-03-16 22:49:05 +010019PLATFORM?=vpp
Damjan Marion0dc3f192017-05-31 19:25:08 +020020SAMPLE_PLUGIN?=no
Damjan Marion005849e2018-07-19 14:39:40 +020021STARTUP_DIR?=$(PWD)
Brian Brooks40b655c2017-09-22 12:26:34 -050022MACHINE=$(shell uname -m)
Damjan Marion8950c272020-10-21 23:55:08 +020023SUDO?=sudo -E
Damjan Marionbe7ef3b2019-09-24 17:45:49 +020024DPDK_CONFIG?=no-pci
Brian Brooks40b655c2017-09-22 12:26:34 -050025
Damjan Marionb1dab652017-06-30 11:51:41 +020026,:=,
27define disable_plugins
28$(if $(1), \
29 "plugins {" \
30 $(patsubst %,"plugin %_plugin.so { disable }",$(subst $(,), ,$(1))) \
31 " }" \
32 ,)
33endef
34
35MINIMAL_STARTUP_CONF=" \
36unix { \
37 interactive \
38 cli-listen /run/vpp/cli.sock \
39 gid $(shell id -g) \
40 $(if $(wildcard startup.vpp),"exec startup.vpp",) \
41} \
42$(if $(DPDK_CONFIG), "dpdk { $(DPDK_CONFIG) }",) \
Andrew Yourtchenkof234b0d2022-03-14 09:49:15 +000043$(if $(EXTRA_VPP_CONFIG), "$(EXTRA_VPP_CONFIG)",) \
Damjan Marionb1dab652017-06-30 11:51:41 +020044$(call disable_plugins,$(DISABLED_PLUGINS)) \
45"
Damjan Marione17fdb52016-02-10 00:36:06 +010046
Damjan Marioneef4d992016-02-23 22:04:50 +010047GDB_ARGS= -ex "handle SIGUSR1 noprint nostop"
48
Damjan Marionc5e86812016-05-02 19:40:27 +020049#
50# OS Detection
51#
Chris Luke36d25062016-09-22 20:52:26 -040052# We allow Darwin (MacOS) for docs generation; VPP build will still fail.
53ifneq ($(shell uname),Darwin)
Damjan Marionc5e86812016-05-02 19:40:27 +020054OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
55OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
Chris Luke36d25062016-09-22 20:52:26 -040056endif
Damjan Marionc5e86812016-05-02 19:40:27 +020057
spencercoderecb62d22023-08-22 12:42:09 +080058ifeq ($(filter ubuntu debian linuxmint,$(OS_ID)),$(OS_ID))
Damjan Marion2ce7f982017-01-09 20:24:50 +010059PKG=deb
Kaj Niemi088d1a02023-10-09 13:14:51 +000060else ifeq ($(filter rhel centos fedora opensuse-leap rocky almalinux,$(OS_ID)),$(OS_ID))
Damjan Marion2ce7f982017-01-09 20:24:50 +010061PKG=rpm
62endif
63
Dave Wallaced756b352017-07-03 13:11:38 -040064# +libganglia1-dev if building the gmond plugin
65
Ole Troan9d420872017-10-12 13:06:35 +020066DEB_DEPENDS = curl build-essential autoconf automake ccache
Nick Brownb8e7a452021-08-10 09:20:32 +010067DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-python
Damjan Marion6bbf83a2017-01-10 10:39:21 +010068DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
Dave Wallace1c95e122023-06-21 23:14:38 -040069DEB_DEPENDS += gcovr lcov chrpath autoconf libnuma-dev
Damjan Mariona4164932020-05-12 12:22:18 +020070DEB_DEPENDS += python3-all python3-setuptools check
Florin Coras1f2070a2022-01-28 18:35:12 -080071DEB_DEPENDS += libffi-dev python3-ply
Damjan Marion37066362023-07-28 20:06:09 +020072DEB_DEPENDS += cmake ninja-build python3-jsonschema python3-yaml
Paul Vinciguerra2c6efec2019-11-20 19:15:46 -050073DEB_DEPENDS += python3-venv # ensurepip
Saima Yunus776ee672022-05-19 11:48:59 -070074DEB_DEPENDS += python3-dev python3-pip
Neale Ranns616447c2021-02-05 09:04:35 +000075DEB_DEPENDS += libnl-3-dev libnl-route-3-dev libmnl-dev
Andrew Yourtchenkoa4720312022-02-02 19:32:18 +000076# DEB_DEPENDS += enchant # for docs
Dave Wallace719d5602021-11-12 18:25:32 -050077DEB_DEPENDS += python3-virtualenv
78DEB_DEPENDS += libssl-dev
Yulong Peif9a17482023-01-05 02:26:32 +000079DEB_DEPENDS += libelf-dev libpcap-dev # for libxdp (af_xdp)
Dave Wallacefa5aabb2022-02-05 09:27:05 -050080DEB_DEPENDS += iperf3 # for 'make test TEST=vcl'
Damjan Marionaa659ef2022-04-05 19:26:51 +020081DEB_DEPENDS += nasm
Naveen Joy1ee30fd2022-12-20 08:39:06 -080082DEB_DEPENDS += iperf ethtool # for 'make test TEST=vm_vpp_interfaces'
Mohammed Hawariccd30702023-06-09 16:50:56 +020083DEB_DEPENDS += libpcap-dev
Dave Wallace8800f732023-08-31 00:47:44 -040084DEB_DEPENDS += tshark
Dave Barach6d97e622020-03-18 10:14:40 -040085
Chuan Hanf30e07e2020-09-25 15:34:06 -070086LIBFFI=libffi6 # works on all but 20.04 and debian-testing
Dave Barach6e6968f2020-03-21 11:15:48 -040087
Saima Yunusbbc99f42022-06-10 19:34:04 -070088ifeq ($(OS_VERSION_ID),22.04)
89 DEB_DEPENDS += python3-virtualenv
90 DEB_DEPENDS += libssl-dev
Saima Yunusbbc99f42022-06-10 19:34:04 -070091 DEB_DEPENDS += clang clang-format-11
92 LIBFFI=libffi7
93 DEB_DEPENDS += enchant-2 # for docs
94else ifeq ($(OS_VERSION_ID),20.04)
Damjan Mariona4164932020-05-12 12:22:18 +020095 DEB_DEPENDS += python3-virtualenv
Jieqiang Wanga5cf6e02020-06-04 14:09:57 +080096 DEB_DEPENDS += libssl-dev
Damjan Marion8cb5d362022-04-14 22:18:19 +020097 DEB_DEPENDS += clang clang-format-11
Dave Barach6e6968f2020-03-21 11:15:48 -040098 LIBFFI=libffi7
Dave Wallace719d5602021-11-12 18:25:32 -050099 DEB_DEPENDS += enchant-2 # for docs
Pim van Peltb6f367e2020-12-29 00:10:42 +0100100else ifeq ($(OS_VERSION_ID),20.10)
Damjan Marion8cb5d362022-04-14 22:18:19 +0200101 DEB_DEPENDS += clang clang-format-11
Dave Wallacefb1135d2021-11-09 13:58:12 -0500102 LIBFFI=libffi8ubuntu1
Benoît Ganne3f0ae662020-09-09 12:50:07 +0200103else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-10)
Dave Wallace719d5602021-11-12 18:25:32 -0500104 DEB_DEPENDS += virtualenv
Andrew Yourtchenkoa4720312022-02-02 19:32:18 +0000105else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-11)
106 DEB_DEPENDS += virtualenv
Damjan Marion8cb5d362022-04-14 22:18:19 +0200107 DEB_DEPENDS += clang clang-format-11
Andrew Yourtchenkoa4720312022-02-02 19:32:18 +0000108 LIBFFI=libffi7
Pim van Pelt712fc032024-01-14 21:02:41 +0100109else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-12)
110 DEB_DEPENDS += virtualenv
111 DEB_DEPENDS += clang-14 clang-format-14
Pim van Pelt4a515d32024-01-15 11:06:19 +0100112 # for extras/scripts/checkstyle.sh
113 export CLANG_FORMAT_VER=14
Pim van Pelt712fc032024-01-14 21:02:41 +0100114 LIBFFI=libffi8
Damjan Marion005849e2018-07-19 14:39:40 +0200115else
Dave Wallace4a332312022-03-17 17:44:35 -0400116 DEB_DEPENDS += clang-11 clang-format-11
Chuan Hanf30e07e2020-09-25 15:34:06 -0700117 LIBFFI=libffi7
Dave Wallace719d5602021-11-12 18:25:32 -0500118 DEB_DEPENDS += enchant-2 # for docs
Ed Warnicke027103e2016-05-05 18:03:27 -0500119endif
Damjan Marione17fdb52016-02-10 00:36:06 +0100120
Dave Barach6e6968f2020-03-21 11:15:48 -0400121DEB_DEPENDS += $(LIBFFI)
122
Christian Svensson184a70a2023-02-06 17:25:16 +0100123RPM_DEPENDS = glibc-static
Gabriel Ganne555d9202017-09-06 10:44:07 +0200124RPM_DEPENDS += apr-devel
Thomas F Herbertbd8e2422017-08-03 11:04:24 -0400125RPM_DEPENDS += numactl-devel
Thomas F Herberte4128912017-10-09 15:03:55 -0400126RPM_DEPENDS += check check-devel
Billy McFall28cf3b72018-01-15 17:54:52 -0500127RPM_DEPENDS += selinux-policy selinux-policy-devel
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500128RPM_DEPENDS += ninja-build
Yichen Wang81355d72020-06-08 17:13:01 -0700129RPM_DEPENDS += ccache
130RPM_DEPENDS += xmlto
Christian Svensson184a70a2023-02-06 17:25:16 +0100131RPM_DEPENDS += elfutils-libelf-devel libpcap-devel
Neale Ranns616447c2021-02-05 09:04:35 +0000132RPM_DEPENDS += libnl3-devel libmnl-devel
Tianyu Li46f1dbc2022-04-12 15:05:08 +0800133RPM_DEPENDS += nasm
Klement Sekerad3e671e2017-09-29 12:36:37 +0200134
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500135ifeq ($(OS_ID),fedora)
136 RPM_DEPENDS += dnf-utils
Thomas F Herbert66731782018-03-05 17:21:56 -0500137 RPM_DEPENDS += subunit subunit-devel
Thomas F Herbert440751b2017-09-11 08:58:23 -0400138 RPM_DEPENDS += compat-openssl10-devel
Ed Kern86e8bce2020-02-05 08:30:00 -0700139 RPM_DEPENDS += python3-devel # needed for python3 -m pip install psutil
Paul Vinciguerra9d0ca072019-11-20 00:09:04 -0500140 RPM_DEPENDS += python3-ply # for vppapigen
Ole Troan6a3064f2019-05-14 13:24:10 +0200141 RPM_DEPENDS += python3-virtualenv python3-jsonschema
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500142 RPM_DEPENDS += cmake
Thomas F Herbertbc1c8482017-05-17 19:00:07 -0400143 RPM_DEPENDS_GROUPS = 'C Development Tools and Libraries'
Christian Svensson184a70a2023-02-06 17:25:16 +0100144else ifeq ($(OS_ID),rocky)
145 RPM_DEPENDS += yum-utils
146 RPM_DEPENDS += subunit subunit-devel
147 RPM_DEPENDS += openssl-devel
148 RPM_DEPENDS += python3-devel # needed for python3 -m pip install psutil
149 RPM_DEPENDS += python3-ply # for vppapigen
150 RPM_DEPENDS += python3-virtualenv python3-jsonschema
151 RPM_DEPENDS += infiniband-diags llvm clang cmake
152 RPM_DEPENDS_GROUPS = 'Development Tools'
Kaj Niemi088d1a02023-10-09 13:14:51 +0000153else ifeq ($(OS_ID),almalinux)
154 RPM_DEPENDS += yum-utils
155 RPM_DEPENDS += subunit subunit-devel
156 RPM_DEPENDS += openssl-devel
157 RPM_DEPENDS += python3-devel # needed for python3 -m pip install psutil
158 RPM_DEPENDS += python3-ply # for vppapigen
159 RPM_DEPENDS += python3-virtualenv python3-jsonschema
160 RPM_DEPENDS += infiniband-diags llvm clang cmake
161 RPM_DEPENDS_GROUPS = 'Development Tools'
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -0600162else ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8)
Ed Kern86e8bce2020-02-05 08:30:00 -0700163 RPM_DEPENDS += yum-utils
Dave Wallace35ef8652021-01-14 16:46:49 -0500164 RPM_DEPENDS += compat-openssl10 openssl-devel
Yichen Wang81355d72020-06-08 17:13:01 -0700165 RPM_DEPENDS += python2-devel python36-devel python3-ply
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -0600166 RPM_DEPENDS += python3-virtualenv python3-jsonschema
Dave Wallacee20d3c82021-06-04 22:55:18 -0400167 RPM_DEPENDS += libarchive cmake
Tianyu Lie7adafe2022-10-26 09:15:12 +0000168 RPM_DEPENDS += infiniband-diags libibumad
Tianyu Li590a82c2023-01-28 07:58:45 +0000169 RPM_DEPENDS += libpcap-devel llvm-toolset
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -0600170 RPM_DEPENDS_GROUPS = 'Development Tools'
Thomas F Herbert28ea2512017-03-29 10:40:16 -0400171else
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500172 RPM_DEPENDS += yum-utils
Thomas F Herbert440751b2017-09-11 08:58:23 -0400173 RPM_DEPENDS += openssl-devel
Paul Vinciguerra9d0ca072019-11-20 00:09:04 -0500174 RPM_DEPENDS += python36-ply # for vppapigen
Ed Kernc63c0162019-09-17 13:19:42 -0600175 RPM_DEPENDS += python3-devel python3-pip
Ole Troan6a3064f2019-05-14 13:24:10 +0200176 RPM_DEPENDS += python-virtualenv python36-jsonschema
jiangxiaoming9f1dbd22020-08-27 16:00:16 +0800177 RPM_DEPENDS += devtoolset-9 devtoolset-9-libasan-devel
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500178 RPM_DEPENDS += cmake3
Thomas F Herbertbc1c8482017-05-17 19:00:07 -0400179 RPM_DEPENDS_GROUPS = 'Development Tools'
Thomas F Herbert28ea2512017-03-29 10:40:16 -0400180endif
Dave Wallaced756b352017-07-03 13:11:38 -0400181
182# +ganglia-devel if building the ganglia plugin
183
Thomas F Herbertbc1c8482017-05-17 19:00:07 -0400184RPM_DEPENDS += chrpath libffi-devel rpm-build
Jieqiang Wang81b95c12020-07-23 15:19:25 +0000185
186RPM_DEPENDS_DEBUG = glibc-debuginfo e2fsprogs-debuginfo
187RPM_DEPENDS_DEBUG += krb5-debuginfo openssl-debuginfo
188RPM_DEPENDS_DEBUG += zlib-debuginfo nss-softokn-debuginfo
189RPM_DEPENDS_DEBUG += yum-plugin-auto-update-debug-info
Marco Varlesedb417762017-10-24 17:02:04 +0200190
Laszlo Kiralye5600852021-11-02 11:07:19 +0100191RPM_SUSE_BUILDTOOLS_DEPS = autoconf automake ccache check-devel chrpath
192RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python3-ply
193
Laszlo Kiraly987318e2022-09-02 14:08:36 +0200194RPM_SUSE_DEVEL_DEPS = glibc-devel-static libnuma-devel libelf-devel
Damjan Marion37066362023-07-28 20:06:09 +0200195RPM_SUSE_DEVEL_DEPS += libopenssl-devel lsb-release
Laszlo Kiraly3ff76762023-07-06 11:36:42 +0200196RPM_SUSE_DEVEL_DEPS += libpcap-devel llvm-devel
Laszlo Kiraly987318e2022-09-02 14:08:36 +0200197RPM_SUSE_DEVEL_DEPS += curl libstdc++-devel bison gcc-c++ zlib-devel
Laszlo Kiralye5600852021-11-02 11:07:19 +0100198
Laszlo Kiraly987318e2022-09-02 14:08:36 +0200199RPM_SUSE_PYTHON_DEPS = python3-devel python3-pip python3-rpm-macros
Laszlo Kiralye5600852021-11-02 11:07:19 +0100200
Laszlo Kiraly987318e2022-09-02 14:08:36 +0200201RPM_SUSE_PLATFORM_DEPS = shadow rpm-build
Laszlo Kiralye5600852021-11-02 11:07:19 +0100202
203ifeq ($(OS_ID),opensuse-leap)
Laszlo Kiraly987318e2022-09-02 14:08:36 +0200204 RPM_SUSE_DEVEL_DEPS += xmlto openssl-devel asciidoc git nasm
205 RPM_SUSE_PYTHON_DEPS += python3 python3-ply python3-virtualenv
206 RPM_SUSE_PLATFORM_DEPS += distribution-release
Laszlo Kiralye5600852021-11-02 11:07:19 +0100207endif
208
209RPM_SUSE_DEPENDS += $(RPM_SUSE_BUILDTOOLS_DEPS) $(RPM_SUSE_DEVEL_DEPS) $(RPM_SUSE_PYTHON_DEPS) $(RPM_SUSE_PLATFORM_DEPS)
210
Damjan Marion0df78dd2016-03-29 22:37:02 +0200211ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),)
Damjan Marioneef4d992016-02-23 22:04:50 +0100212 STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf
213endif
Damjan Marione17fdb52016-02-10 00:36:06 +0100214
Damjan Marionc5e86812016-05-02 19:40:27 +0200215ifeq ($(findstring y,$(UNATTENDED)),y)
Dave Wallace8800f732023-08-31 00:47:44 -0400216DEBIAN_FRONTEND=noninteractive
Damjan Marionc5e86812016-05-02 19:40:27 +0200217CONFIRM=-y
Saima Yunusbbc99f42022-06-10 19:34:04 -0700218FORCE=--allow-downgrades --allow-remove-essential --allow-change-held-packages
Damjan Marionc5e86812016-05-02 19:40:27 +0200219endif
220
Damjan Marion0dc3f192017-05-31 19:25:08 +0200221TARGETS = vpp
222
223ifneq ($(SAMPLE_PLUGIN),no)
224TARGETS += sample-plugin
225endif
226
Damjan Marion4a6cb832018-09-18 18:41:38 +0200227define banner
228 @echo "========================================================================"
229 @echo " $(1)"
230 @echo "========================================================================"
231 @echo " "
232endef
233
Dave Wallacee7906902019-11-14 12:19:32 -0500234.PHONY: help
Damjan Marione17fdb52016-02-10 00:36:06 +0100235help:
236 @echo "Make Targets:"
Dave Wallacee7906902019-11-14 12:19:32 -0500237 @echo " install-dep[s] - install software dependencies"
Dave Wallace2777ec72019-09-24 17:52:36 -0400238 @echo " wipe - wipe all products of debug build "
239 @echo " wipe-release - wipe all products of release build "
240 @echo " build - build debug binaries"
241 @echo " build-release - build release binaries"
242 @echo " build-coverity - build coverity artifacts"
Paul Vinciguerraea1a6512019-11-01 02:34:32 -0400243 @echo " rebuild - wipe and build debug binaries"
244 @echo " rebuild-release - wipe and build release binaries"
Dave Wallace2777ec72019-09-24 17:52:36 -0400245 @echo " run - run debug binary"
246 @echo " run-release - run release binary"
247 @echo " debug - run debug binary with debugger"
248 @echo " debug-release - run release binary with debugger"
Dave Wallacef0797d12019-11-15 17:29:15 -0500249 @echo " test - build and run tests"
Dave Wallace2777ec72019-09-24 17:52:36 -0400250 @echo " test-help - show help on test framework"
251 @echo " run-vat - run vpp-api-test tool"
252 @echo " pkg-deb - build DEB packages"
253 @echo " pkg-deb-debug - build DEB debug packages"
Dave Barach6d97e622020-03-18 10:14:40 -0400254 @echo " pkg-snap - build SNAP package"
255 @echo " snap-clean - clean up snap build environment"
Dave Wallace2777ec72019-09-24 17:52:36 -0400256 @echo " pkg-rpm - build RPM packages"
Dave Wallacee7906902019-11-14 12:19:32 -0500257 @echo " install-ext-dep[s] - install external development dependencies"
Dave Wallace2777ec72019-09-24 17:52:36 -0400258 @echo " ctags - (re)generate ctags database"
259 @echo " gtags - (re)generate gtags database"
260 @echo " cscope - (re)generate cscope database"
Damjan Marion13bcb922020-05-08 19:01:22 +0200261 @echo " compdb - (re)generate compile_commands.json"
Dave Wallace2777ec72019-09-24 17:52:36 -0400262 @echo " checkstyle - check coding style"
Dave Wallacee7906902019-11-14 12:19:32 -0500263 @echo " checkstyle-commit - check commit message format"
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200264 @echo " checkstyle-python - check python coding style using 'black' formatter"
Ole Troan5c318c72020-05-05 12:23:47 +0200265 @echo " checkstyle-api - check api for incompatible changes"
Dave Wallace2777ec72019-09-24 17:52:36 -0400266 @echo " fixstyle - fix coding style"
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200267 @echo " fixstyle-python - fix python coding style using 'black' formatter"
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200268 @echo " doxygen - DEPRECATED - use 'make docs'"
269 @echo " bootstrap-doxygen - DEPRECATED"
270 @echo " wipe-doxygen - DEPRECATED"
Dave Wallace2777ec72019-09-24 17:52:36 -0400271 @echo " checkfeaturelist - check FEATURE.yaml according to schema"
272 @echo " featurelist - dump feature list in markdown"
273 @echo " json-api-files - (re)-generate json api files"
Paul Vinciguerra9529feb2019-07-15 15:22:31 -0400274 @echo " json-api-files-debug - (re)-generate json api files for debug target"
Vladimir Lavor3ff15982021-04-08 13:08:04 +0200275 @echo " go-api-files - (re)-generate golang api files"
jdenisco3138d722018-09-24 14:59:33 -0400276 @echo " docs - Build the Sphinx documentation"
Dave Wallace2777ec72019-09-24 17:52:36 -0400277 @echo " docs-venv - Build the virtual environment for the Sphinx docs"
278 @echo " docs-clean - Remove the generated files from the Sphinx docs"
Nathan Skrzypczak1e167a42022-03-25 12:06:51 +0100279 @echo " docs-rebuild - Rebuild all of the Sphinx documentation"
Damjan Marione17fdb52016-02-10 00:36:06 +0100280 @echo ""
281 @echo "Make Arguments:"
Damjan Marionb1dab652017-06-30 11:51:41 +0200282 @echo " V=[0|1] - set build verbosity level"
283 @echo " STARTUP_CONF=<path> - startup configuration file"
284 @echo " (e.g. /etc/vpp/startup.conf)"
Paul Vinciguerraea1a6512019-11-01 02:34:32 -0400285 @echo " STARTUP_DIR=<path> - startup directory (e.g. /etc/vpp)"
Damjan Marionb1dab652017-06-30 11:51:41 +0200286 @echo " It also sets STARTUP_CONF if"
287 @echo " startup.conf file is present"
288 @echo " GDB=<path> - gdb binary to use for debugging"
289 @echo " PLATFORM=<name> - target platform. default is vpp"
Damjan Marionb1dab652017-06-30 11:51:41 +0200290 @echo " DPDK_CONFIG=<conf> - add specified dpdk config commands to"
291 @echo " autogenerated startup.conf"
292 @echo " (e.g. \"no-pci\" )"
293 @echo " SAMPLE_PLUGIN=yes - in addition build/run/debug sample plugin"
294 @echo " DISABLED_PLUGINS=<list> - comma separated list of plugins which"
295 @echo " should not be loaded"
Damjan Marione17fdb52016-02-10 00:36:06 +0100296 @echo ""
Klement Sekera277b89c2016-10-28 13:20:27 +0200297 @echo "Current Argument Values:"
Damjan Marion0dc3f192017-05-31 19:25:08 +0200298 @echo " V = $(V)"
299 @echo " STARTUP_CONF = $(STARTUP_CONF)"
300 @echo " STARTUP_DIR = $(STARTUP_DIR)"
301 @echo " GDB = $(GDB)"
302 @echo " PLATFORM = $(PLATFORM)"
303 @echo " DPDK_VERSION = $(DPDK_VERSION)"
Damjan Marionb1dab652017-06-30 11:51:41 +0200304 @echo " DPDK_CONFIG = $(DPDK_CONFIG)"
Damjan Marion0dc3f192017-05-31 19:25:08 +0200305 @echo " SAMPLE_PLUGIN = $(SAMPLE_PLUGIN)"
Damjan Marionb1dab652017-06-30 11:51:41 +0200306 @echo " DISABLED_PLUGINS = $(DISABLED_PLUGINS)"
Damjan Marione17fdb52016-02-10 00:36:06 +0100307
Damjan Marion55f99672018-03-15 19:36:41 +0100308$(BR)/.deps.ok:
Damjan Marionc21d59f2016-11-19 12:04:34 +0100309ifeq ($(findstring y,$(UNATTENDED)),y)
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000310 $(MAKE) install-dep
Damjan Marionc21d59f2016-11-19 12:04:34 +0100311endif
spencercoderecb62d22023-08-22 12:42:09 +0800312ifeq ($(filter ubuntu debian linuxmint,$(OS_ID)),$(OS_ID))
Damjan Marione17fdb52016-02-10 00:36:06 +0100313 @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \
314 if [ -n "$$MISSING" ] ; then \
315 echo "\nPlease install missing packages: \n$$MISSING\n" ; \
Damjan Marionebb27fb2016-02-25 16:26:01 +0100316 echo "by executing \"make install-dep\"\n" ; \
Damjan Marione17fdb52016-02-10 00:36:06 +0100317 exit 1 ; \
318 fi ; \
319 exit 0
Thomas F Herbert70efbfc2017-03-20 19:19:51 -0400320else ifneq ("$(wildcard /etc/redhat-release)","")
Thomas F Herbertbd8e2422017-08-03 11:04:24 -0400321 @for i in $(RPM_DEPENDS) ; do \
jiangxiaoming9f1dbd22020-08-27 16:00:16 +0800322 RPM=$$(basename -s .rpm "$${i##*/}" | cut -d- -f1,2,3,4) ; \
Thomas F Herbertbd8e2422017-08-03 11:04:24 -0400323 MISSING+=$$(rpm -q $$RPM | grep "^package") ; \
Thomas F Herbert70efbfc2017-03-20 19:19:51 -0400324 done ; \
325 if [ -n "$$MISSING" ] ; then \
326 echo "Please install missing RPMs: \n$$MISSING\n" ; \
327 echo "by executing \"make install-dep\"\n" ; \
328 exit 1 ; \
329 fi ; \
330 exit 0
Damjan Marione17fdb52016-02-10 00:36:06 +0100331endif
Damjan Marione17fdb52016-02-10 00:36:06 +0100332 @touch $@
333
Dave Wallacee7906902019-11-14 12:19:32 -0500334.PHONY: bootstrap
Damjan Marion55f99672018-03-15 19:36:41 +0100335bootstrap:
336 @echo "'make bootstrap' is not needed anymore"
Damjan Marione17fdb52016-02-10 00:36:06 +0100337
Dave Wallacee7906902019-11-14 12:19:32 -0500338.PHONY: install-dep
Damjan Marionebb27fb2016-02-25 16:26:01 +0100339install-dep:
spencercoderecb62d22023-08-22 12:42:09 +0800340ifeq ($(filter ubuntu debian linuxmint,$(OS_ID)),$(OS_ID))
Ed Warnickeeb82e7f2017-02-01 16:08:51 -0800341 @sudo -E apt-get update
Damjan Marion9b6463d2017-05-29 12:29:05 +0200342 @sudo -E apt-get $(APT_ARGS) $(CONFIRM) $(FORCE) install $(DEB_DEPENDS)
Ed Warnicke84eda9d2016-03-22 16:09:29 -0500343else ifneq ("$(wildcard /etc/redhat-release)","")
Yichen Wang840cd122018-10-30 22:52:15 -0700344ifeq ($(OS_ID),rhel)
345 @sudo -E yum-config-manager --enable rhel-server-rhscl-7-rpms
Yichen Wang00cbd572019-02-04 22:27:20 -0800346 @sudo -E yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
347 @sudo -E yum install $(CONFIRM) $(RPM_DEPENDS)
Florin Coras8eeb8512022-04-28 07:55:07 -0700348 @sudo -E debuginfo-install $(CONFIRM) glibc openssl-libs zlib
Christian Svensson184a70a2023-02-06 17:25:16 +0100349else ifeq ($(OS_ID),rocky)
350 @sudo -E dnf install $(CONFIRM) dnf-plugins-core epel-release
351 @sudo -E dnf config-manager --set-enabled \
352 $(shell dnf repolist all 2>/dev/null|grep -i crb|cut -d' ' -f1|grep -v source)
353 @sudo -E dnf groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
354 @sudo -E dnf install $(CONFIRM) $(RPM_DEPENDS)
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -0600355else ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8)
Dave Wallace858856d2020-09-21 13:07:29 -0400356 @sudo -E dnf install $(CONFIRM) dnf-plugins-core epel-release
Dave Wallace1affb312020-12-08 10:50:08 -0500357 @sudo -E dnf config-manager --set-enabled \
Tianyu Liab5a1242022-03-03 10:49:39 +0800358 $(shell dnf repolist all 2>/dev/null|grep -i powertools|cut -d' ' -f1|grep -v source)
Renato Botelho do Coutoc0253292019-11-07 06:10:34 -0600359 @sudo -E dnf groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
Dave Wallace18c17cb2021-06-03 17:37:27 -0400360 @sudo -E dnf install --skip-broken $(CONFIRM) $(RPM_DEPENDS)
Yichen Wang840cd122018-10-30 22:52:15 -0700361else ifeq ($(OS_ID),centos)
drenfong.wang6dd5e342019-01-15 08:24:26 +0000362 @sudo -E yum install $(CONFIRM) centos-release-scl-rh epel-release
Yichen Wang840cd122018-10-30 22:52:15 -0700363 @sudo -E yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
Gabriel Ganneb17402e2017-01-02 16:44:21 +0100364 @sudo -E yum install $(CONFIRM) $(RPM_DEPENDS)
Jieqiang Wang81b95c12020-07-23 15:19:25 +0000365 @sudo -E yum install $(CONFIRM) --enablerepo=base-debuginfo $(RPM_DEPENDS_DEBUG)
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500366else ifeq ($(OS_ID),fedora)
367 @sudo -E dnf groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
368 @sudo -E dnf install $(CONFIRM) $(RPM_DEPENDS)
Florin Coras8eeb8512022-04-28 07:55:07 -0700369 @sudo -E debuginfo-install $(CONFIRM) glibc openssl-libs zlib
Thomas F Herbert6eb61632018-11-27 15:57:30 -0500370endif
Laszlo Kiraly987318e2022-09-02 14:08:36 +0200371else ifeq ($(filter opensuse-leap-15.3 opensuse-leap-15.4 ,$(OS_ID)-$(OS_VERSION_ID)),$(OS_ID)-$(OS_VERSION_ID))
Laszlo Kiralye5600852021-11-02 11:07:19 +0100372 @sudo -E zypper refresh
373 @sudo -E zypper install -y $(RPM_SUSE_DEPENDS)
Damjan Marionebb27fb2016-02-25 16:26:01 +0100374else
Laszlo Kiralye5600852021-11-02 11:07:19 +0100375 $(error "This option currently works only on Ubuntu, Debian, RHEL, CentOS or openSUSE-leap systems")
Damjan Marionebb27fb2016-02-25 16:26:01 +0100376endif
Ole Troane4218be2019-05-07 10:32:40 +0200377 git config commit.template .git_commit_template.txt
Damjan Marionebb27fb2016-02-25 16:26:01 +0100378
Dave Wallacee7906902019-11-14 12:19:32 -0500379.PHONY: install-deps
380install-deps: install-dep
381
Damjan Marione17fdb52016-02-10 00:36:06 +0100382define make
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000383 @$(MAKE) -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
Damjan Marione17fdb52016-02-10 00:36:06 +0100384endef
385
Thomas F Herbert20a29c72016-10-13 18:36:50 -0400386$(BR)/scripts/.version:
387ifneq ("$(wildcard /etc/redhat-release)","")
388 $(shell $(BR)/scripts/version rpm-string > $(BR)/scripts/.version)
389else
390 $(shell $(BR)/scripts/version > $(BR)/scripts/.version)
391endif
392
Damjan Marionc06eeb02017-04-18 15:26:39 +0200393DIST_FILE = $(BR)/vpp-$(shell src/scripts/version).tar
394DIST_SUBDIR = vpp-$(shell src/scripts/version|cut -f1 -d-)
Thomas F Herbert20a29c72016-10-13 18:36:50 -0400395
Dave Wallacee7906902019-11-14 12:19:32 -0500396.PHONY: dist
Damjan Marionc06eeb02017-04-18 15:26:39 +0200397dist:
Thomas F Herbert8d487222017-07-18 15:48:03 -0400398 @if git rev-parse 2> /dev/null ; then \
399 git archive \
400 --prefix=$(DIST_SUBDIR)/ \
401 --format=tar \
402 -o $(DIST_FILE) \
403 HEAD ; \
Andrew Yourtchenkobfcd4b92021-05-17 16:16:28 +0000404 git describe --long > $(BR)/.version ; \
Thomas F Herbert8d487222017-07-18 15:48:03 -0400405 else \
406 (cd .. ; tar -cf $(DIST_FILE) $(DIST_SUBDIR) --exclude=*.tar) ; \
407 src/scripts/version > $(BR)/.version ; \
408 fi
Damjan Marionc06eeb02017-04-18 15:26:39 +0200409 @tar --append \
410 --file $(DIST_FILE) \
411 --transform='s,.*/.version,$(DIST_SUBDIR)/src/scripts/.version,' \
412 $(BR)/.version
413 @$(RM) $(BR)/.version $(DIST_FILE).xz
414 @xz -v --threads=0 $(DIST_FILE)
415 @$(RM) $(BR)/vpp-latest.tar.xz
416 @ln -rs $(DIST_FILE).xz $(BR)/vpp-latest.tar.xz
Thomas F Herbert20a29c72016-10-13 18:36:50 -0400417
Dave Wallacee7906902019-11-14 12:19:32 -0500418.PHONY: build
Damjan Marion55f99672018-03-15 19:36:41 +0100419build: $(BR)/.deps.ok
Damjan Marion9d7a7ba2018-03-14 20:58:39 +0100420 $(call make,$(PLATFORM)_debug,$(addsuffix -install,$(TARGETS)))
Damjan Marione17fdb52016-02-10 00:36:06 +0100421
Dave Wallacee7906902019-11-14 12:19:32 -0500422.PHONY: wipedist
Thomas F Herbert20a29c72016-10-13 18:36:50 -0400423wipedist:
Damjan Marionc06eeb02017-04-18 15:26:39 +0200424 @$(RM) $(BR)/*.tar.xz
Thomas F Herbert20a29c72016-10-13 18:36:50 -0400425
Dave Wallacee7906902019-11-14 12:19:32 -0500426.PHONY: wipe
Damjan Marion55f99672018-03-15 19:36:41 +0100427wipe: wipedist test-wipe $(BR)/.deps.ok
Damjan Marion0dc3f192017-05-31 19:25:08 +0200428 $(call make,$(PLATFORM)_debug,$(addsuffix -wipe,$(TARGETS)))
Tianyu Li0b652132021-06-04 17:43:01 +0800429 @find . -type f -name "*.api.json" ! -path "./src/*" -exec rm {} \;
Damjan Marione17fdb52016-02-10 00:36:06 +0100430
Dave Wallacee7906902019-11-14 12:19:32 -0500431.PHONY: rebuild
Damjan Marione17fdb52016-02-10 00:36:06 +0100432rebuild: wipe build
433
Dave Wallacee7906902019-11-14 12:19:32 -0500434.PHONY: build-release
Damjan Marion55f99672018-03-15 19:36:41 +0100435build-release: $(BR)/.deps.ok
Damjan Marion0dc3f192017-05-31 19:25:08 +0200436 $(call make,$(PLATFORM),$(addsuffix -install,$(TARGETS)))
Damjan Marione17fdb52016-02-10 00:36:06 +0100437
Dave Wallacee7906902019-11-14 12:19:32 -0500438.PHONY: wipe-release
Damjan Marion55f99672018-03-15 19:36:41 +0100439wipe-release: test-wipe $(BR)/.deps.ok
Damjan Marion0dc3f192017-05-31 19:25:08 +0200440 $(call make,$(PLATFORM),$(addsuffix -wipe,$(TARGETS)))
Damjan Marione17fdb52016-02-10 00:36:06 +0100441
Dave Wallacee7906902019-11-14 12:19:32 -0500442.PHONY: rebuild-release
Damjan Marione17fdb52016-02-10 00:36:06 +0100443rebuild-release: wipe-release build-release
444
Klement Sekerab8c72a42018-11-08 11:21:39 +0100445export TEST_DIR ?= $(WS_ROOT)/test
446
Damjan Marionf56b77a2016-10-03 19:44:57 +0200447define test
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000448 $(if $(filter-out $(2),retest),$(MAKE) -C $(BR) PLATFORM=vpp TAG=$(1) CC=$(CC) vpp-install,)
Igor Mikhailov (imichail)ee29dd22017-05-09 23:27:14 -0700449 $(eval libs:=lib lib64)
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000450 $(MAKE) -C test \
Klement Sekeraea2721f2021-05-31 16:11:49 +0200451 VPP_BUILD_DIR=$(BR)/build-$(1)-native/vpp \
452 VPP_BIN=$(BR)/install-$(1)-native/vpp/bin/vpp \
453 VPP_INSTALL_PATH=$(BR)/install-$(1)-native/ \
Klement Sekera87134932017-03-07 11:39:27 +0100454 EXTENDED_TESTS=$(EXTENDED_TESTS) \
Dave Wallace878a9f52023-08-08 15:25:21 -0400455 TEST_GCOV=$(TEST_GCOV) \
vagrant937bf302017-04-07 01:48:47 +0000456 PYTHON=$(PYTHON) \
Klement Sekerad3e671e2017-09-29 12:36:37 +0200457 OS_ID=$(OS_ID) \
Paul Vinciguerrac701e572019-12-19 16:09:43 -0500458 RND_SEED=$(RND_SEED) \
Klement Sekeraa3d933c2017-11-06 09:46:00 +0100459 CACHE_OUTPUT=$(CACHE_OUTPUT) \
Klement Sekerab23ffd72021-05-31 16:08:53 +0200460 TAG=$(1) \
Klement Sekeraea2721f2021-05-31 16:11:49 +0200461 $(2)
Damjan Marionf56b77a2016-10-03 19:44:57 +0200462endef
463
Dave Wallacee7906902019-11-14 12:19:32 -0500464.PHONY: test
Damjan Marion55f99672018-03-15 19:36:41 +0100465test:
Dave Wallaceccc17f02023-12-20 20:02:45 -0500466ifeq ($(CC),cc)
467 $(eval CC=clang)
468endif
Klement Sekeraea2721f2021-05-31 16:11:49 +0200469 $(call test,vpp,test)
Damjan Marionf56b77a2016-10-03 19:44:57 +0200470
Dave Wallacee7906902019-11-14 12:19:32 -0500471.PHONY: test-debug
Damjan Marion55f99672018-03-15 19:36:41 +0100472test-debug:
Dave Wallaceccc17f02023-12-20 20:02:45 -0500473ifeq ($(CC),cc)
474 $(eval CC=clang)
475endif
Klement Sekeraea2721f2021-05-31 16:11:49 +0200476 $(call test,vpp_debug,test)
Klement Sekeraf62ae122016-10-11 11:47:09 +0200477
Dave Wallace1c95e122023-06-21 23:14:38 -0400478.PHONY: test-cov
479test-cov:
480 $(eval CC=gcc)
481 $(eval TEST_GCOV=1)
482 $(call test,vpp_gcov,cov)
483
484.PHONY: test-cov-build
485test-cov-build:
486 $(eval CC=gcc)
487 $(eval TEST_GCOV=1)
Klement Sekeraea2721f2021-05-31 16:11:49 +0200488 $(call test,vpp_gcov,test)
Dave Barachb757d1a2019-03-22 08:50:29 -0400489
Dave Wallace1c95e122023-06-21 23:14:38 -0400490.PHONY: test-cov-prep
491test-cov-prep:
492 $(eval CC=gcc)
493 $(call test,vpp_gcov,cov-prep)
494
495.PHONY: test-cov-post
496test-cov-post:
497 $(eval CC=gcc)
498 $(call test,vpp_gcov,cov-post)
499
Dave Wallacee7906902019-11-14 12:19:32 -0500500.PHONY: test-all
Damjan Marion55f99672018-03-15 19:36:41 +0100501test-all:
Klement Sekerab23ffd72021-05-31 16:08:53 +0200502 $(eval EXTENDED_TESTS=1)
Klement Sekeraea2721f2021-05-31 16:11:49 +0200503 $(call test,vpp,test)
Klement Sekera87134932017-03-07 11:39:27 +0100504
Dave Wallacee7906902019-11-14 12:19:32 -0500505.PHONY: test-all-debug
Damjan Marion55f99672018-03-15 19:36:41 +0100506test-all-debug:
Klement Sekerab23ffd72021-05-31 16:08:53 +0200507 $(eval EXTENDED_TESTS=1)
Klement Sekeraea2721f2021-05-31 16:11:49 +0200508 $(call test,vpp_debug,test)
Klement Sekera87134932017-03-07 11:39:27 +0100509
Dave Wallace1c95e122023-06-21 23:14:38 -0400510.PHONY: test-all-cov
511test-all-cov:
512 $(eval CC=gcc)
513 $(eval TEST_GCOV=1)
514 $(eval EXTENDED_TESTS=1)
515 $(call test,vpp_gcov,test)
516
Dave Wallacee7906902019-11-14 12:19:32 -0500517.PHONY: papi-wipe
518papi-wipe: test-wipe-papi
519 $(call banner,"This command is deprecated. Please use 'test-wipe-papi'")
520
521.PHONY: test-wipe-papi
522test-wipe-papi:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000523 @$(MAKE) -C test wipe-papi
Paul Vinciguerra2648e442019-07-09 16:49:46 -0400524
Dave Wallacee7906902019-11-14 12:19:32 -0500525.PHONY: test-help
Klement Sekera277b89c2016-10-28 13:20:27 +0200526test-help:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000527 @$(MAKE) -C test help
Klement Sekeraf62ae122016-10-11 11:47:09 +0200528
Dave Wallacee7906902019-11-14 12:19:32 -0500529.PHONY: test-wipe
Klement Sekera277b89c2016-10-28 13:20:27 +0200530test-wipe:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000531 @$(MAKE) -C test wipe
Klement Sekera277b89c2016-10-28 13:20:27 +0200532
Dave Wallacee7906902019-11-14 12:19:32 -0500533.PHONY: test-shell
Damjan Marion55f99672018-03-15 19:36:41 +0100534test-shell:
Klement Sekeraea2721f2021-05-31 16:11:49 +0200535 $(call test,vpp,shell)
Klement Sekeraa86e2892017-03-09 08:01:52 +0100536
Dave Wallacee7906902019-11-14 12:19:32 -0500537.PHONY: test-shell-debug
Damjan Marion55f99672018-03-15 19:36:41 +0100538test-shell-debug:
Klement Sekeraea2721f2021-05-31 16:11:49 +0200539 $(call test,vpp_debug,shell)
Klement Sekeraa86e2892017-03-09 08:01:52 +0100540
Dave Wallace1c95e122023-06-21 23:14:38 -0400541.PHONY: test-shell-cov
542test-shell-cov:
543 $(eval CC=gcc)
544 $(eval TEST_GCOV=1)
Klement Sekeraea2721f2021-05-31 16:11:49 +0200545 $(call test,vpp_gcov,shell)
Dave Barach7d31ab22019-05-08 19:18:18 -0400546
Dave Wallacee7906902019-11-14 12:19:32 -0500547.PHONY: test-dep
Ed Kern56ccc232018-04-02 16:42:48 -0600548test-dep:
549 @make -C test test-dep
550
Dave Wallacee7906902019-11-14 12:19:32 -0500551.PHONY: test-doc
Klement Sekera277b89c2016-10-28 13:20:27 +0200552test-doc:
Dave Wallace51a037d2021-11-06 10:59:22 -0400553 @echo "make test-doc is DEPRECATED: use 'make docs'"
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200554 sleep 300
Klement Sekera277b89c2016-10-28 13:20:27 +0200555
Dave Wallacee7906902019-11-14 12:19:32 -0500556.PHONY: test-wipe-doc
Klement Sekera277b89c2016-10-28 13:20:27 +0200557test-wipe-doc:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200558 @echo "make test-wipe-doc is DEPRECATED"
559 sleep 300
Damjan Marionf56b77a2016-10-03 19:44:57 +0200560
Dave Wallacee7906902019-11-14 12:19:32 -0500561.PHONY: test-wipe-cov
Juraj Sloboda0279b292016-11-16 19:50:24 +0100562test-wipe-cov:
Dave Wallace1c95e122023-06-21 23:14:38 -0400563 $(call make,$(PLATFORM)_gcov,$(addsuffix -wipe,$(TARGETS)))
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000564 @$(MAKE) -C test wipe-cov
Juraj Sloboda0279b292016-11-16 19:50:24 +0100565
Dave Wallacef0797d12019-11-15 17:29:15 -0500566.PHONY: test-wipe-all
567test-wipe-all:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000568 @$(MAKE) -C test wipe-all
Dave Wallacef0797d12019-11-15 17:29:15 -0500569
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200570# Note: All python venv consolidated in test/Makefile, test/requirements*.txt
Dave Wallacee7906902019-11-14 12:19:32 -0500571.PHONY: test-checkstyle
Klement Sekera72715ee2017-01-17 10:37:05 +0100572test-checkstyle:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200573 $(warning test-checkstyle is deprecated. Running checkstyle-python.")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000574 @$(MAKE) -C test checkstyle-python-all
Klement Sekera72715ee2017-01-17 10:37:05 +0100575
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200576# Note: All python venv consolidated in test/Makefile, test/requirements*.txt
Klement Sekerae0b63b22021-03-24 23:24:52 +0100577.PHONY: test-checkstyle-diff
578test-checkstyle-diff:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200579 $(warning test-checkstyle-diff is deprecated. Running checkstyle-python.")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000580 @$(MAKE) -C test checkstyle-python-all
Klement Sekerae0b63b22021-03-24 23:24:52 +0100581
Dave Wallacee7906902019-11-14 12:19:32 -0500582.PHONY: test-refresh-deps
Aloys Augustin28fa8cb2019-06-21 17:04:29 +0200583test-refresh-deps:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000584 @$(MAKE) -C test refresh-deps
Aloys Augustin28fa8cb2019-06-21 17:04:29 +0200585
Dave Wallacee7906902019-11-14 12:19:32 -0500586.PHONY: retest
Damjan Marionf56b77a2016-10-03 19:44:57 +0200587retest:
Klement Sekeraea2721f2021-05-31 16:11:49 +0200588 $(call test,vpp,retest)
Damjan Marionf56b77a2016-10-03 19:44:57 +0200589
Dave Wallacee7906902019-11-14 12:19:32 -0500590.PHONY: retest-debug
Damjan Marionf56b77a2016-10-03 19:44:57 +0200591retest-debug:
Klement Sekeraea2721f2021-05-31 16:11:49 +0200592 $(call test,vpp_debug,retest)
Damjan Marionf56b77a2016-10-03 19:44:57 +0200593
Dave Wallacee7906902019-11-14 12:19:32 -0500594.PHONY: retest-all
595retest-all:
Klement Sekerab23ffd72021-05-31 16:08:53 +0200596 $(eval EXTENDED_TESTS=1)
Klement Sekeraea2721f2021-05-31 16:11:49 +0200597 $(call test,vpp,retest)
Dave Wallacee7906902019-11-14 12:19:32 -0500598
599.PHONY: retest-all-debug
600retest-all-debug:
Klement Sekerab23ffd72021-05-31 16:08:53 +0200601 $(eval EXTENDED_TESTS=1)
Klement Sekeraea2721f2021-05-31 16:11:49 +0200602 $(call test,vpp_debug,retest)
Dave Wallacee7906902019-11-14 12:19:32 -0500603
Klement Sekerae2636852021-03-16 12:52:12 +0100604.PHONY: test-start-vpp-in-gdb
605test-start-vpp-in-gdb:
Klement Sekeraea2721f2021-05-31 16:11:49 +0200606 $(call test,vpp,start-gdb)
Klement Sekerae2636852021-03-16 12:52:12 +0100607
608.PHONY: test-start-vpp-debug-in-gdb
609test-start-vpp-debug-in-gdb:
Klement Sekeraea2721f2021-05-31 16:11:49 +0200610 $(call test,vpp_debug,start-gdb)
Klement Sekerae2636852021-03-16 12:52:12 +0100611
Damjan Marione17fdb52016-02-10 00:36:06 +0100612ifeq ("$(wildcard $(STARTUP_CONF))","")
613define run
614 @echo "WARNING: STARTUP_CONF not defined or file doesn't exist."
615 @echo " Running with minimal startup config: $(MINIMAL_STARTUP_CONF)\n"
Damjan Mariona7775382016-07-07 17:56:48 +0200616 @cd $(STARTUP_DIR) && \
Damjan Marion72d2c4f2018-04-05 21:32:29 +0200617 $(SUDO) $(2) $(1)/vpp/bin/vpp $(MINIMAL_STARTUP_CONF)
Damjan Marione17fdb52016-02-10 00:36:06 +0100618endef
619else
620define run
Damjan Mariona7775382016-07-07 17:56:48 +0200621 @cd $(STARTUP_DIR) && \
Damjan Marion72d2c4f2018-04-05 21:32:29 +0200622 $(SUDO) $(2) $(1)/vpp/bin/vpp $(shell cat $(STARTUP_CONF) | sed -e 's/#.*//')
Damjan Marione17fdb52016-02-10 00:36:06 +0100623endef
624endif
625
Damjan Marione6f90232016-03-16 22:49:05 +0100626%.files: .FORCE
Damjan Marionac8f9362021-04-28 00:11:33 +0200627 @find src -name '*.[chS]' > $@
Damjan Marione6f90232016-03-16 22:49:05 +0100628
629.FORCE:
630
Dave Wallacee7906902019-11-14 12:19:32 -0500631.PHONY: run
Damjan Marione17fdb52016-02-10 00:36:06 +0100632run:
Damjan Mariona7775382016-07-07 17:56:48 +0200633 $(call run, $(BR)/install-$(PLATFORM)_debug-native)
Damjan Marione17fdb52016-02-10 00:36:06 +0100634
Dave Wallacee7906902019-11-14 12:19:32 -0500635.PHONY: run-release
Damjan Marione17fdb52016-02-10 00:36:06 +0100636run-release:
Damjan Mariona7775382016-07-07 17:56:48 +0200637 $(call run, $(BR)/install-$(PLATFORM)-native)
Damjan Marione17fdb52016-02-10 00:36:06 +0100638
Dave Wallacee7906902019-11-14 12:19:32 -0500639.PHONY: debug
Damjan Marione17fdb52016-02-10 00:36:06 +0100640debug:
Damjan Mariona7775382016-07-07 17:56:48 +0200641 $(call run, $(BR)/install-$(PLATFORM)_debug-native,$(GDB) $(GDB_ARGS) --args)
Damjan Marione17fdb52016-02-10 00:36:06 +0100642
Dave Wallacee7906902019-11-14 12:19:32 -0500643.PHONY: build-coverity
Damjan Marion005849e2018-07-19 14:39:40 +0200644build-coverity:
Dave Barach3ad77042017-01-04 17:24:32 -0500645 $(call make,$(PLATFORM)_coverity,install-packages)
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000646 @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp_coverity libmemif-install
Dave Barach3ad77042017-01-04 17:24:32 -0500647
Dave Wallacee7906902019-11-14 12:19:32 -0500648.PHONY: debug-release
Damjan Marione17fdb52016-02-10 00:36:06 +0100649debug-release:
Damjan Mariona7775382016-07-07 17:56:48 +0200650 $(call run, $(BR)/install-$(PLATFORM)-native,$(GDB) $(GDB_ARGS) --args)
Damjan Marione17fdb52016-02-10 00:36:06 +0100651
Dave Wallacee7906902019-11-14 12:19:32 -0500652.PHONY: build-vat
Damjan Marione17fdb52016-02-10 00:36:06 +0100653build-vat:
Damjan Marione6f90232016-03-16 22:49:05 +0100654 $(call make,$(PLATFORM)_debug,vpp-api-test-install)
Damjan Marione17fdb52016-02-10 00:36:06 +0100655
Dave Wallacee7906902019-11-14 12:19:32 -0500656.PHONY: run-vat
Damjan Marione17fdb52016-02-10 00:36:06 +0100657run-vat:
Damjan Marion72d2c4f2018-04-05 21:32:29 +0200658 @$(SUDO) $(BR)/install-$(PLATFORM)_debug-native/vpp/bin/vpp_api_test
Damjan Marione17fdb52016-02-10 00:36:06 +0100659
Dave Wallacee7906902019-11-14 12:19:32 -0500660.PHONY: pkg-deb
Damjan Marion6bbf83a2017-01-10 10:39:21 +0100661pkg-deb:
Damjan Marion4d2f86a2019-01-18 13:28:22 +0100662 $(call make,$(PLATFORM),vpp-package-deb)
663
Dave Barach6d97e622020-03-18 10:14:40 -0400664.PHONY: pkg-snap
665pkg-snap:
666 cd extras/snap ; \
667 ./prep ; \
668 SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G \
669 SNAPCRAFT_BUILD_ENVIRONMENT_CPU=6 \
670 snapcraft --debug
671
672.PHONY: snap-clean
673snap-clean:
674 cd extras/snap ; \
675 snapcraft clean ; \
676 rm -f *.snap *.tgz
677
Dave Wallacee7906902019-11-14 12:19:32 -0500678.PHONY: pkg-deb-debug
Damjan Marion4d2f86a2019-01-18 13:28:22 +0100679pkg-deb-debug:
680 $(call make,$(PLATFORM)_debug,vpp-package-deb)
Damjan Marione17fdb52016-02-10 00:36:06 +0100681
Dave Wallacee7906902019-11-14 12:19:32 -0500682.PHONY: pkg-rpm
Damjan Marion6bbf83a2017-01-10 10:39:21 +0100683pkg-rpm: dist
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000684 $(MAKE) -C extras/rpm
Damjan Marione6f90232016-03-16 22:49:05 +0100685
Dave Wallacee7906902019-11-14 12:19:32 -0500686.PHONY: pkg-srpm
Thomas F Herbertb60f4962017-07-19 19:17:15 -0400687pkg-srpm: dist
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000688 $(MAKE) -C extras/rpm srpm
Thomas F Herbertb60f4962017-07-19 19:17:15 -0400689
Dave Wallacee7906902019-11-14 12:19:32 -0500690.PHONY: install-ext-deps
Damjan Marion4a6cb832018-09-18 18:41:38 +0200691install-ext-deps:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000692 $(MAKE) -C build/external install-$(PKG)
Damjan Marion2ce7f982017-01-09 20:24:50 +0100693
Dave Wallacee7906902019-11-14 12:19:32 -0500694.PHONY: install-ext-dep
695install-ext-dep: install-ext-deps
696
697.PHONY: json-api-files
Paul Vinciguerra9529feb2019-07-15 15:22:31 -0400698json-api-files:
699 $(WS_ROOT)/src/tools/vppapigen/generate_json.py
700
Dave Wallacee7906902019-11-14 12:19:32 -0500701.PHONY: json-api-files-debug
Paul Vinciguerra9529feb2019-07-15 15:22:31 -0400702json-api-files-debug:
703 $(WS_ROOT)/src/tools/vppapigen/generate_json.py --debug-target
704
Vladimir Lavor3ff15982021-04-08 13:08:04 +0200705.PHONY: go-api-files
706go-api-files: json-api-files
Nathan Skrzypczakd591b822022-03-10 12:38:31 +0100707 $(WS_ROOT)/src/tools/vppapigen/generate_go.py $(ARGS)
Vladimir Lavor3ff15982021-04-08 13:08:04 +0200708
Dave Wallacee7906902019-11-14 12:19:32 -0500709.PHONY: ctags
Damjan Marione6f90232016-03-16 22:49:05 +0100710ctags: ctags.files
Jerome Tolletdf5fbf62020-12-05 11:01:14 +0100711 @ctags --totals --tag-relative=yes -L $<
Damjan Marione6f90232016-03-16 22:49:05 +0100712 @rm $<
713
Dave Wallacee7906902019-11-14 12:19:32 -0500714.PHONY: gtags
Keith Burns (alagalah)4b72a582016-07-02 17:54:36 -0700715gtags: ctags
716 @gtags --gtagslabel=ctags
717
Dave Wallacee7906902019-11-14 12:19:32 -0500718.PHONY: cscope
Damjan Marione6f90232016-03-16 22:49:05 +0100719cscope: cscope.files
720 @cscope -b -q -v
Marek Gradzki60c63c72016-04-26 08:01:31 +0200721
Damjan Marion13bcb922020-05-08 19:01:22 +0200722.PHONY: compdb
723compdb:
Damjan Marionf4ca4842020-10-23 17:20:32 +0200724 @ninja -C build-root/build-vpp_debug-native/vpp build.ninja
725 @ninja -C build-root/build-vpp_debug-native/vpp -t compdb | \
Damjan Marion88b2e362021-04-29 18:47:25 +0200726 src/scripts/compdb_cleanup.py > compile_commands.json
Damjan Marion13bcb922020-05-08 19:01:22 +0200727
Dave Wallacee7906902019-11-14 12:19:32 -0500728.PHONY: checkstyle
Ole Troanf3aebda2020-01-03 16:37:27 +0100729checkstyle: checkfeaturelist
Damjan Marion942542f2020-12-12 19:09:31 +0100730 @extras/scripts/checkstyle.sh
Damjan Marion24704852016-09-07 13:10:50 +0200731
Dave Wallacee7906902019-11-14 12:19:32 -0500732.PHONY: checkstyle-commit
733checkstyle-commit:
734 @extras/scripts/check_commit_msg.sh
735
736.PHONY: checkstyle-test
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200737checkstyle-test:
738 $(warning test-checkstyle is deprecated. Running checkstyle-python.")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000739 @$(MAKE) -C test checkstyle-python-all
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200740
741# Note: All python venv consolidated in test/Makefile, test/requirements*.txt
742.PHONY: checkstyle-python
743checkstyle-python:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000744 @$(MAKE) -C test checkstyle-python-all
Dave Wallacee7906902019-11-14 12:19:32 -0500745
746.PHONY: checkstyle-all
Dave Wallace15b13812022-06-14 12:06:55 -0400747checkstyle-all: checkstyle-commit checkstyle checkstyle-python docs-spell
Dave Wallacee7906902019-11-14 12:19:32 -0500748
749.PHONY: fixstyle
Damjan Marion24704852016-09-07 13:10:50 +0200750fixstyle:
Damjan Marion942542f2020-12-12 19:09:31 +0100751 @extras/scripts/checkstyle.sh --fix
Chris Lukeb5850972016-05-03 16:34:59 -0400752
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200753# Note: All python venv consolidated in test/Makefile, test/requirements*.txt
754.PHONY: fixstyle-python
755fixstyle-python:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000756 @$(MAKE) -C test fixstyle-python-all
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200757
Ole Troan5c318c72020-05-05 12:23:47 +0200758.PHONY: checkstyle-api
759checkstyle-api:
Ole Troanab9f5732020-12-15 10:19:25 +0100760 @extras/scripts/crcchecker.py --check-patchset
Ole Troan5c318c72020-05-05 12:23:47 +0200761
Paul Vinciguerraea1a6512019-11-01 02:34:32 -0400762# necessary because Bug 1696324 - Update to python3.6 breaks PyYAML dependencies
763# Status: CLOSED CANTFIX
764# https://bugzilla.redhat.com/show_bug.cgi?id=1696324
Dave Wallacee7906902019-11-14 12:19:32 -0500765.PHONY: centos-pyyaml
Paul Vinciguerraea1a6512019-11-01 02:34:32 -0400766centos-pyyaml:
Paul Vinciguerraea1a6512019-11-01 02:34:32 -0400767ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8)
768 @sudo -E yum install $(CONFIRM) python3-pyyaml
769endif
770
Dave Wallacee7906902019-11-14 12:19:32 -0500771.PHONY: featurelist
Paul Vinciguerraea1a6512019-11-01 02:34:32 -0400772featurelist: centos-pyyaml
Damjan Marionac8f9362021-04-28 00:11:33 +0200773 @extras/scripts/fts.py --all --markdown
Ole Troan6a3064f2019-05-14 13:24:10 +0200774
Dave Wallacee7906902019-11-14 12:19:32 -0500775.PHONY: checkfeaturelist
Paul Vinciguerraea1a6512019-11-01 02:34:32 -0400776checkfeaturelist: centos-pyyaml
Damjan Marionac8f9362021-04-28 00:11:33 +0200777 @extras/scripts/fts.py --validate --all
Ole Troan6a3064f2019-05-14 13:24:10 +0200778
Chris Luke1d1644c2016-05-13 13:41:36 -0400779#
780# Build the documentation
781#
782
Dave Wallacee7906902019-11-14 12:19:32 -0500783.PHONY: bootstrap-doxygen
Damjan Marion6bbf83a2017-01-10 10:39:21 +0100784bootstrap-doxygen:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200785 @echo "make bootstrap-doxygen is DEPRECATED"
786 sleep 300
Chris Lukeb5850972016-05-03 16:34:59 -0400787
Dave Wallacee7906902019-11-14 12:19:32 -0500788.PHONY: doxygen
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200789doxygen: docs
790 @echo "make doxygen is DEPRECATED: use 'make docs'"
791 sleep 300
Chris Lukeb5850972016-05-03 16:34:59 -0400792
Dave Wallacee7906902019-11-14 12:19:32 -0500793.PHONY: wipe-doxygen
Chris Lukeb5850972016-05-03 16:34:59 -0400794wipe-doxygen:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200795 @echo "make wipe-doxygen is DEPRECATED"
796 sleep 300
Chris Luke54ccf222016-07-25 16:38:11 -0400797
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200798.PHONY: docs-%
799docs-%:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000800 @$(MAKE) -C $(WS_ROOT)/docs $*
jdenisco3138d722018-09-24 14:59:33 -0400801
Dave Wallacee7906902019-11-14 12:19:32 -0500802.PHONY: docs
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200803docs:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000804 @$(MAKE) -C $(WS_ROOT)/docs docs
jdenisco3138d722018-09-24 14:59:33 -0400805
Dave Wallacee7906902019-11-14 12:19:32 -0500806.PHONY: pkg-verify
Dave Wallace7b8a30d2019-07-15 12:03:51 -0400807pkg-verify: install-dep $(BR)/.deps.ok install-ext-deps
Dave Wallace99e26c12022-09-09 11:34:02 -0400808 $(call banner,"Building for PLATFORM=vpp")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000809 @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
Damjan Marion686c1c82017-04-19 14:09:07 +0200810 $(call banner,"Building sample-plugin")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000811 @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install
Damjan Marion23d4e8a2018-03-26 14:09:38 +0200812 $(call banner,"Building libmemif")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000813 @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp libmemif-install
Damjan Marion2ce7f982017-01-09 20:24:50 +0100814 $(call banner,"Building $(PKG) packages")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000815 @$(MAKE) pkg-$(PKG)
Dave Wallace7b8a30d2019-07-15 12:03:51 -0400816
Dave Wallace99e26c12022-09-09 11:34:02 -0400817# Note: 'make verify' target is not used by ci-management scripts
818MAKE_VERIFY_GATE_OS ?= ubuntu-22.04
Dave Wallacee7906902019-11-14 12:19:32 -0500819.PHONY: verify
Dave Wallace7b8a30d2019-07-15 12:03:51 -0400820verify: pkg-verify
Paul Vinciguerra86a94412018-10-26 05:55:18 -0700821ifeq ($(OS_ID)-$(OS_VERSION_ID),$(MAKE_VERIFY_GATE_OS))
Paul Vinciguerra4bf84902019-07-31 00:34:05 -0400822 $(call banner,"Testing vppapigen")
823 @src/tools/vppapigen/test_vppapigen.py
Damjan Marion855e2682018-08-24 13:37:45 +0200824 $(call banner,"Running tests")
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000825 @$(MAKE) COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
Paul Vinciguerra86a94412018-10-26 05:55:18 -0700826else
827 $(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)")
Damjan Marionaade2c52017-05-22 16:56:54 +0200828endif
Mohammed Hawari4e939ce2022-09-19 16:26:25 +0200829
830.PHONY: check-dpdk-mlx
831check-dpdk-mlx:
Tom Jones0aa0d6f2024-01-18 10:48:17 +0000832 @[ $$($(MAKE) -sC build/external dpdk-show-DPDK_MLX_DEFAULT) = y ]