api: clean up use of deprecated flag
[vpp.git] / Makefile
1 # Copyright (c) 2016 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 export WS_ROOT=$(CURDIR)
15 export BR=$(WS_ROOT)/build-root
16 CCACHE_DIR?=$(BR)/.ccache
17 GDB?=gdb
18 PLATFORM?=vpp
19 SAMPLE_PLUGIN?=no
20 STARTUP_DIR?=$(PWD)
21 MACHINE=$(shell uname -m)
22 SUDO?=sudo
23 DPDK_CONFIG?=no-pci
24
25 ,:=,
26 define disable_plugins
27 $(if $(1), \
28   "plugins {" \
29   $(patsubst %,"plugin %_plugin.so { disable }",$(subst $(,), ,$(1))) \
30   " }" \
31   ,)
32 endef
33
34 MINIMAL_STARTUP_CONF="                                                  \
35 unix {                                                                  \
36         interactive                                                     \
37         cli-listen /run/vpp/cli.sock                                    \
38         gid $(shell id -g)                                              \
39         $(if $(wildcard startup.vpp),"exec startup.vpp",)               \
40 }                                                                       \
41 $(if $(DPDK_CONFIG), "dpdk { $(DPDK_CONFIG) }",)                        \
42 $(call disable_plugins,$(DISABLED_PLUGINS))                             \
43 "
44
45 GDB_ARGS= -ex "handle SIGUSR1 noprint nostop"
46
47 #
48 # OS Detection
49 #
50 # We allow Darwin (MacOS) for docs generation; VPP build will still fail.
51 ifneq ($(shell uname),Darwin)
52 OS_ID        = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
53 OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
54 endif
55
56 ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
57 PKG=deb
58 else ifeq ($(filter rhel centos fedora opensuse opensuse-leap opensuse-tumbleweed,$(OS_ID)),$(OS_ID))
59 PKG=rpm
60 endif
61
62 # +libganglia1-dev if building the gmond plugin
63
64 DEB_DEPENDS  = curl build-essential autoconf automake ccache
65 DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-systemd
66 DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
67 DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev
68 DEB_DEPENDS += python3-all python3-setuptools check
69 DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev
70 DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
71 DEB_DEPENDS += python3-venv  # ensurepip
72 DEB_DEPENDS += python3-dev   # needed for python3 -m pip install psutil
73 # python3.6 on 16.04 requires python36-dev
74
75 LIBFFI=libffi6 # works on all but 20.04
76
77 ifeq ($(OS_VERSION_ID),18.04)
78         DEB_DEPENDS += python-dev python-all python-pip python-virtualenv
79         DEB_DEPENDS += libssl-dev
80         DEB_DEPENDS += clang-9
81 else ifeq ($(OS_VERSION_ID),20.04)
82         DEB_DEPENDS += python3-virtualenv
83         DEB_DEPENDS += libssl-dev
84         DEB_DEPENDS += libelf-dev # for libbpf (af_xdp)
85         LIBFFI=libffi7
86 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8)
87         DEB_DEPENDS += libssl-dev
88         DEB_DEPENDS += python-dev python-all python-pip python-virtualenv
89         APT_ARGS = -t jessie-backports
90 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-9)
91         DEB_DEPENDS += libssl1.0-dev
92         DEB_DEPENDS += python-all python-pip
93         DEB_DEPENDS += python-dev python-all python-pip python-virtualenv
94 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-10)
95         DEB_DEPENDS += libelf-dev # for libbpf (af_xdp)
96 else
97         DEB_DEPENDS += libssl-dev
98 endif
99
100 DEB_DEPENDS += $(LIBFFI)
101
102 RPM_DEPENDS  = redhat-lsb glibc-static
103 RPM_DEPENDS += apr-devel
104 RPM_DEPENDS += numactl-devel
105 RPM_DEPENDS += check check-devel
106 RPM_DEPENDS += boost boost-devel
107 RPM_DEPENDS += selinux-policy selinux-policy-devel
108 RPM_DEPENDS += ninja-build
109 RPM_DEPENDS += libuuid-devel
110 RPM_DEPENDS += mbedtls-devel
111 RPM_DEPENDS += ccache
112 RPM_DEPENDS += xmlto
113 RPM_DEPENDS += elfutils-libelf-devel
114
115 ifeq ($(OS_ID),fedora)
116         RPM_DEPENDS += dnf-utils
117         RPM_DEPENDS += subunit subunit-devel
118         RPM_DEPENDS += compat-openssl10-devel
119         RPM_DEPENDS += python3-devel  # needed for python3 -m pip install psutil
120         RPM_DEPENDS += python3-ply  # for vppapigen
121         RPM_DEPENDS += python3-virtualenv python3-jsonschema
122         RPM_DEPENDS += cmake
123         RPM_DEPENDS_GROUPS = 'C Development Tools and Libraries'
124 else ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8)
125         RPM_DEPENDS += yum-utils
126         RPM_DEPENDS += compat-openssl10
127         RPM_DEPENDS += python2-devel python36-devel python3-ply
128         RPM_DEPENDS += python3-virtualenv python3-jsonschema
129         RPM_DEPENDS += cmake
130         RPM_DEPENDS_GROUPS = 'Development Tools'
131 else
132         RPM_DEPENDS += yum-utils
133         RPM_DEPENDS += openssl-devel
134         RPM_DEPENDS += python36-ply  # for vppapigen
135         RPM_DEPENDS += python3-devel python3-pip
136         RPM_DEPENDS += python-virtualenv python36-jsonschema
137         RPM_DEPENDS += devtoolset-9 devtoolset-9-libasan-devel
138         RPM_DEPENDS += cmake3
139         RPM_DEPENDS_GROUPS = 'Development Tools'
140 endif
141
142 # +ganglia-devel if building the ganglia plugin
143
144 RPM_DEPENDS += chrpath libffi-devel rpm-build
145
146 RPM_DEPENDS_DEBUG  = glibc-debuginfo e2fsprogs-debuginfo
147 RPM_DEPENDS_DEBUG += krb5-debuginfo openssl-debuginfo
148 RPM_DEPENDS_DEBUG += zlib-debuginfo nss-softokn-debuginfo
149 RPM_DEPENDS_DEBUG += yum-plugin-auto-update-debug-info
150 # lowercase- replace spaces with dashes.
151 SUSE_NAME= $(shell grep '^NAME=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g' | sed -e 's/ /-/' | awk '{print tolower($$0)}')
152 SUSE_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g' | cut -d' ' -f2)
153 RPM_SUSE_BUILDTOOLS_DEPS = autoconf automake ccache check-devel chrpath
154 RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python3-ply
155
156 RPM_SUSE_DEVEL_DEPS = glibc-devel-static libnuma-devel
157 RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel mbedtls-devel libuuid-devel
158
159 RPM_SUSE_PYTHON_DEPS = python-devel python3-devel python-pip python3-pip
160 RPM_SUSE_PYTHON_DEPS += python-rpm-macros python3-rpm-macros
161
162 RPM_SUSE_PLATFORM_DEPS = distribution-release shadow rpm-build
163
164 ifeq ($(OS_ID),opensuse)
165 ifeq ($(SUSE_NAME),tumbleweed)
166         RPM_SUSE_DEVEL_DEPS = libboost_headers1_68_0-devel-1.68.0  libboost_thread1_68_0-devel-1.68.0 gcc
167         RPM_SUSE_PYTHON_DEPS += python3-ply python2-virtualenv
168 endif
169 ifeq ($(SUSE_ID),15.0)
170         RPM_SUSE_DEVEL_DEPS += libboost_headers-devel libboost_thread-devel gcc
171         RPM_SUSE_PYTHON_DEPS += python3-ply python2-virtualenv
172 else
173         RPM_SUSE_DEVEL_DEPS += libboost_headers1_68_0-devel-1.68.0 gcc6
174         RPM_SUSE_PYTHON_DEPS += python-virtualenv
175 endif
176 endif
177
178 ifeq ($(OS_ID),opensuse-leap)
179 ifeq ($(SUSE_ID),15.0)
180         RPM_SUSE_DEVEL_DEPS += libboost_headers-devel libboost_thread-devel gcc git curl
181         RPM_SUSE_PYTHON_DEPS += python3-ply python2-virtualenv
182 endif
183 endif
184
185 RPM_SUSE_DEPENDS += $(RPM_SUSE_BUILDTOOLS_DEPS) $(RPM_SUSE_DEVEL_DEPS) $(RPM_SUSE_PYTHON_DEPS) $(RPM_SUSE_PLATFORM_DEPS)
186
187 ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),)
188         STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf
189 endif
190
191 ifeq ($(findstring y,$(UNATTENDED)),y)
192 CONFIRM=-y
193 FORCE=--force-yes
194 endif
195
196 TARGETS = vpp
197
198 ifneq ($(SAMPLE_PLUGIN),no)
199 TARGETS += sample-plugin
200 endif
201
202 define banner
203         @echo "========================================================================"
204         @echo " $(1)"
205         @echo "========================================================================"
206         @echo " "
207 endef
208
209 .PHONY: help
210 help:
211         @echo "Make Targets:"
212         @echo " install-dep[s]       - install software dependencies"
213         @echo " wipe                 - wipe all products of debug build "
214         @echo " wipe-release         - wipe all products of release build "
215         @echo " build                - build debug binaries"
216         @echo " build-release        - build release binaries"
217         @echo " build-coverity       - build coverity artifacts"
218         @echo " rebuild              - wipe and build debug binaries"
219         @echo " rebuild-release      - wipe and build release binaries"
220         @echo " run                  - run debug binary"
221         @echo " run-release          - run release binary"
222         @echo " debug                - run debug binary with debugger"
223         @echo " debug-release        - run release binary with debugger"
224         @echo " test                 - build and run tests"
225         @echo " test-help            - show help on test framework"
226         @echo " run-vat              - run vpp-api-test tool"
227         @echo " pkg-deb              - build DEB packages"
228         @echo " pkg-deb-debug        - build DEB debug packages"
229         @echo " pkg-snap             - build SNAP package"
230         @echo " snap-clean           - clean up snap build environment"
231         @echo " vom-pkg-deb          - build vom DEB packages"
232         @echo " vom-pkg-deb-debug    - build vom DEB debug packages"
233         @echo " pkg-rpm              - build RPM packages"
234         @echo " install-ext-dep[s]   - install external development dependencies"
235         @echo " ctags                - (re)generate ctags database"
236         @echo " gtags                - (re)generate gtags database"
237         @echo " cscope               - (re)generate cscope database"
238         @echo " compdb               - (re)generate compile_commands.json"
239         @echo " checkstyle           - check coding style"
240         @echo " checkstyle-commit    - check commit message format"
241         @echo " checkstyle-test      - check test framework coding style"
242         @echo " checkstyle-api       - check api for incompatible changes"
243         @echo " fixstyle             - fix coding style"
244         @echo " doxygen              - (re)generate documentation"
245         @echo " bootstrap-doxygen    - setup Doxygen dependencies"
246         @echo " wipe-doxygen         - wipe all generated documentation"
247         @echo " checkfeaturelist     - check FEATURE.yaml according to schema"
248         @echo " featurelist          - dump feature list in markdown"
249         @echo " json-api-files       - (re)-generate json api files"
250         @echo " json-api-files-debug - (re)-generate json api files for debug target"
251         @echo " docs                 - Build the Sphinx documentation"
252         @echo " docs-venv            - Build the virtual environment for the Sphinx docs"
253         @echo " docs-clean           - Remove the generated files from the Sphinx docs"
254         @echo ""
255         @echo "Make Arguments:"
256         @echo " V=[0|1]                  - set build verbosity level"
257         @echo " STARTUP_CONF=<path>      - startup configuration file"
258         @echo "                            (e.g. /etc/vpp/startup.conf)"
259         @echo " STARTUP_DIR=<path>       - startup directory (e.g. /etc/vpp)"
260         @echo "                            It also sets STARTUP_CONF if"
261         @echo "                            startup.conf file is present"
262         @echo " GDB=<path>               - gdb binary to use for debugging"
263         @echo " PLATFORM=<name>          - target platform. default is vpp"
264         @echo " TEST=<filter>            - apply filter to test set, see test-help"
265         @echo " DPDK_CONFIG=<conf>       - add specified dpdk config commands to"
266         @echo "                            autogenerated startup.conf"
267         @echo "                            (e.g. \"no-pci\" )"
268         @echo " SAMPLE_PLUGIN=yes        - in addition build/run/debug sample plugin"
269         @echo " DISABLED_PLUGINS=<list>  - comma separated list of plugins which"
270         @echo "                            should not be loaded"
271         @echo ""
272         @echo "Current Argument Values:"
273         @echo " V                 = $(V)"
274         @echo " STARTUP_CONF      = $(STARTUP_CONF)"
275         @echo " STARTUP_DIR       = $(STARTUP_DIR)"
276         @echo " GDB               = $(GDB)"
277         @echo " PLATFORM          = $(PLATFORM)"
278         @echo " DPDK_VERSION      = $(DPDK_VERSION)"
279         @echo " DPDK_CONFIG       = $(DPDK_CONFIG)"
280         @echo " SAMPLE_PLUGIN     = $(SAMPLE_PLUGIN)"
281         @echo " DISABLED_PLUGINS  = $(DISABLED_PLUGINS)"
282
283 $(BR)/.deps.ok:
284 ifeq ($(findstring y,$(UNATTENDED)),y)
285         make install-dep
286 endif
287 ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
288         @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \
289         if [ -n "$$MISSING" ] ; then \
290           echo "\nPlease install missing packages: \n$$MISSING\n" ; \
291           echo "by executing \"make install-dep\"\n" ; \
292           exit 1 ; \
293         fi ; \
294         exit 0
295 else ifneq ("$(wildcard /etc/redhat-release)","")
296         @for i in $(RPM_DEPENDS) ; do \
297             RPM=$$(basename -s .rpm "$${i##*/}" | cut -d- -f1,2,3,4)  ; \
298             MISSING+=$$(rpm -q $$RPM | grep "^package")    ;    \
299         done                                                       ;    \
300         if [ -n "$$MISSING" ] ; then \
301           echo "Please install missing RPMs: \n$$MISSING\n" ; \
302           echo "by executing \"make install-dep\"\n" ; \
303           exit 1 ; \
304         fi ; \
305         exit 0
306 endif
307         @touch $@
308
309 .PHONY: bootstrap
310 bootstrap:
311         @echo "'make bootstrap' is not needed anymore"
312
313 .PHONY: install-dep
314 install-dep:
315 ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
316 ifeq ($(OS_VERSION_ID),14.04)
317         @sudo -E apt-get $(CONFIRM) $(FORCE) install software-properties-common
318 endif
319 ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8)
320         @grep -q jessie-backports /etc/apt/sources.list /etc/apt/sources.list.d/* 2> /dev/null \
321            || ( echo "Please install jessie-backports" ; exit 1 )
322 endif
323         @sudo -E apt-get update
324         @sudo -E apt-get $(APT_ARGS) $(CONFIRM) $(FORCE) install $(DEB_DEPENDS)
325 else ifneq ("$(wildcard /etc/redhat-release)","")
326 ifeq ($(OS_ID),rhel)
327         @sudo -E yum-config-manager --enable rhel-server-rhscl-7-rpms
328         @sudo -E yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
329         @sudo -E yum install $(CONFIRM) $(RPM_DEPENDS)
330         @sudo -E debuginfo-install $(CONFIRM) glibc openssl-libs mbedtls-devel zlib
331 else ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8)
332         @sudo -E dnf install $(CONFIRM) epel-release
333         @sudo -E dnf config-manager --set-enabled PowerTools
334         @sudo -E dnf groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
335         @sudo -E dnf install $(CONFIRM) $(RPM_DEPENDS)
336 else ifeq ($(OS_ID),centos)
337         @sudo -E yum install $(CONFIRM) centos-release-scl-rh epel-release
338         @sudo -E yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
339         @sudo -E yum install $(CONFIRM) $(RPM_DEPENDS)
340         @sudo -E yum install $(CONFIRM) --enablerepo=base-debuginfo $(RPM_DEPENDS_DEBUG)
341 else ifeq ($(OS_ID),fedora)
342         @sudo -E dnf groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
343         @sudo -E dnf install $(CONFIRM) $(RPM_DEPENDS)
344         @sudo -E debuginfo-install $(CONFIRM) glibc openssl-libs mbedtls-devel zlib
345 endif
346 else ifeq ($(filter opensuse-tumbleweed,$(OS_ID)),$(OS_ID))
347         @sudo -E zypper refresh
348         @sudo -E zypper install -y $(RPM_SUSE_DEPENDS)
349 else ifeq ($(filter opensuse-leap,$(OS_ID)),$(OS_ID))
350         @sudo -E zypper refresh
351         @sudo -E zypper install  -y $(RPM_SUSE_DEPENDS)
352 else ifeq ($(filter opensuse,$(OS_ID)),$(OS_ID))
353         @sudo -E zypper refresh
354         @sudo -E zypper install -y $(RPM_SUSE_DEPENDS)
355 else
356         $(error "This option currently works only on Ubuntu, Debian, RHEL, CentOS or openSUSE systems")
357 endif
358         git config commit.template .git_commit_template.txt
359
360 .PHONY: install-deps
361 install-deps: install-dep
362
363 define make
364         @make -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
365 endef
366
367 $(BR)/scripts/.version:
368 ifneq ("$(wildcard /etc/redhat-release)","")
369         $(shell $(BR)/scripts/version rpm-string > $(BR)/scripts/.version)
370 else
371         $(shell $(BR)/scripts/version > $(BR)/scripts/.version)
372 endif
373
374 DIST_FILE = $(BR)/vpp-$(shell src/scripts/version).tar
375 DIST_SUBDIR = vpp-$(shell src/scripts/version|cut -f1 -d-)
376
377 .PHONY: dist
378 dist:
379         @if git rev-parse 2> /dev/null ; then \
380             git archive \
381               --prefix=$(DIST_SUBDIR)/ \
382               --format=tar \
383               -o $(DIST_FILE) \
384             HEAD ; \
385             git describe > $(BR)/.version ; \
386         else \
387             (cd .. ; tar -cf $(DIST_FILE) $(DIST_SUBDIR) --exclude=*.tar) ; \
388             src/scripts/version > $(BR)/.version ; \
389         fi
390         @tar --append \
391           --file $(DIST_FILE) \
392           --transform='s,.*/.version,$(DIST_SUBDIR)/src/scripts/.version,' \
393           $(BR)/.version
394         @$(RM) $(BR)/.version $(DIST_FILE).xz
395         @xz -v --threads=0 $(DIST_FILE)
396         @$(RM) $(BR)/vpp-latest.tar.xz
397         @ln -rs $(DIST_FILE).xz $(BR)/vpp-latest.tar.xz
398
399 .PHONY: build
400 build: $(BR)/.deps.ok
401         $(call make,$(PLATFORM)_debug,$(addsuffix -install,$(TARGETS)))
402
403 .PHONY: wipedist
404 wipedist:
405         @$(RM) $(BR)/*.tar.xz
406
407 .PHONY: wipe
408 wipe: wipedist test-wipe $(BR)/.deps.ok
409         $(call make,$(PLATFORM)_debug,$(addsuffix -wipe,$(TARGETS)))
410         @find . -type f -name "*.api.json" ! -path "./test/*" -exec rm {} \;
411
412 .PHONY: rebuild
413 rebuild: wipe build
414
415 .PHONY: build-release
416 build-release: $(BR)/.deps.ok
417         $(call make,$(PLATFORM),$(addsuffix -install,$(TARGETS)))
418
419 .PHONY: wipe-release
420 wipe-release: test-wipe $(BR)/.deps.ok
421         $(call make,$(PLATFORM),$(addsuffix -wipe,$(TARGETS)))
422
423 .PHONY: rebuild-release
424 rebuild-release: wipe-release build-release
425
426 libexpand = $(subst $(subst ,, ),:,$(foreach lib,$(1),$(BR)/install-$(2)-native/vpp/$(lib)/$(3)))
427
428 export TEST_DIR ?= $(WS_ROOT)/test
429 export RND_SEED ?= $(shell python3 -c 'import time; print(time.time())')
430
431 define test
432         $(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=$(1) TAG=$(2) vpp-install,)
433         $(eval libs:=lib lib64)
434         make -C test \
435           VPP_BUILD_DIR=$(BR)/build-$(2)-native \
436           VPP_BIN=$(BR)/install-$(2)-native/vpp/bin/vpp \
437           VPP_PLUGIN_PATH=$(call libexpand,$(libs),$(2),vpp_plugins) \
438           VPP_TEST_PLUGIN_PATH=$(call libexpand,$(libs),$(2),vpp_api_test_plugins) \
439           VPP_INSTALL_PATH=$(BR)/install-$(2)-native/ \
440           LD_LIBRARY_PATH=$(call libexpand,$(libs),$(2),) \
441           EXTENDED_TESTS=$(EXTENDED_TESTS) \
442           PYTHON=$(PYTHON) \
443           OS_ID=$(OS_ID) \
444           RND_SEED=$(RND_SEED) \
445           CACHE_OUTPUT=$(CACHE_OUTPUT) \
446           $(3)
447 endef
448
449 .PHONY: test
450 test:
451         $(call test,vpp,vpp,test)
452
453 .PHONY: test-debug
454 test-debug:
455         $(call test,vpp,vpp_debug,test)
456
457 .PHONY: test-gcov
458 test-gcov:
459         $(call test,vpp,vpp_gcov,test)
460
461 .PHONY: test-all
462 test-all:
463         $(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=vpp TAG=vpp vom-install,)
464         $(eval EXTENDED_TESTS=yes)
465         $(call test,vpp,vpp,test)
466
467 .PHONY: test-all-debug
468 test-all-debug:
469         $(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=vpp TAG=vpp_debug vom-install,)
470         $(eval EXTENDED_TESTS=yes)
471         $(call test,vpp,vpp_debug,test)
472
473 .PHONY: papi-wipe
474 papi-wipe: test-wipe-papi
475         $(call banner,"This command is deprecated. Please use 'test-wipe-papi'")
476
477 .PHONY: test-wipe-papi
478 test-wipe-papi:
479         @make -C test wipe-papi
480
481 .PHONY: test-help
482 test-help:
483         @make -C test help
484
485 .PHONY: test-wipe
486 test-wipe:
487         @make -C test wipe
488
489 .PHONY: test-shell
490 test-shell:
491         $(call test,vpp,vpp,shell)
492
493 .PHONY: test-shell-debug
494 test-shell-debug:
495         $(call test,vpp,vpp_debug,shell)
496
497 .PHONY: test-shell-gcov
498 test-shell-gcov:
499         $(call test,vpp,vpp_gcov,shell)
500
501 .PHONY: test-dep
502 test-dep:
503         @make -C test test-dep
504
505 .PHONY: test-doc
506 test-doc:
507         @make -C test doc
508
509 .PHONY: test-wipe-doc
510 test-wipe-doc:
511         @make -C test wipe-doc
512
513 .PHONY: test-cov
514 test-cov:
515         @make -C $(BR) PLATFORM=vpp TAG=vpp_gcov vom-install
516         $(eval EXTENDED_TESTS=yes)
517         $(call test,vpp,vpp_gcov,cov)
518
519 .PHONY: test-wipe-cov
520 test-wipe-cov:
521         @make -C test wipe-cov
522
523 .PHONY: test-wipe-all
524 test-wipe-all:
525         @make -C test wipe-all
526
527 .PHONY: test-checkstyle
528 test-checkstyle:
529         @make -C test checkstyle
530
531 .PHONY: test-refresh-deps
532 test-refresh-deps:
533         @make -C test refresh-deps
534
535 .PHONY: retest
536 retest:
537         $(call test,vpp,vpp,retest)
538
539 .PHONY: retest-debug
540 retest-debug:
541         $(call test,vpp,vpp_debug,retest)
542
543 .PHONY: retest-all
544 retest-all:
545         $(eval EXTENDED_TESTS=yes)
546         $(call test,vpp,vpp,retest)
547
548 .PHONY: retest-all-debug
549 retest-all-debug:
550         $(eval EXTENDED_TESTS=yes)
551         $(call test,vpp,vpp_debug,retest)
552
553 ifeq ("$(wildcard $(STARTUP_CONF))","")
554 define run
555         @echo "WARNING: STARTUP_CONF not defined or file doesn't exist."
556         @echo "         Running with minimal startup config: $(MINIMAL_STARTUP_CONF)\n"
557         @cd $(STARTUP_DIR) && \
558           $(SUDO) $(2) $(1)/vpp/bin/vpp $(MINIMAL_STARTUP_CONF)
559 endef
560 else
561 define run
562         @cd $(STARTUP_DIR) && \
563           $(SUDO) $(2) $(1)/vpp/bin/vpp $(shell cat $(STARTUP_CONF) | sed -e 's/#.*//')
564 endef
565 endif
566
567 %.files: .FORCE
568         @find . \( -name '*\.[chyS]' -o -name '*\.java' -o -name '*\.lex' \) -and \
569                 \( -not -path './build-root*' -o -path \
570                 './build-root/build-vpp_debug-native/dpdk*' \) > $@
571
572 .FORCE:
573
574 .PHONY: run
575 run:
576         $(call run, $(BR)/install-$(PLATFORM)_debug-native)
577
578 .PHONY: run-release
579 run-release:
580         $(call run, $(BR)/install-$(PLATFORM)-native)
581
582 .PHONY: debug
583 debug:
584         $(call run, $(BR)/install-$(PLATFORM)_debug-native,$(GDB) $(GDB_ARGS) --args)
585
586 .PHONY: build-coverity
587 build-coverity:
588         $(call make,$(PLATFORM)_coverity,install-packages)
589
590 .PHONY: debug-release
591 debug-release:
592         $(call run, $(BR)/install-$(PLATFORM)-native,$(GDB) $(GDB_ARGS) --args)
593
594 .PHONY: build-vat
595 build-vat:
596         $(call make,$(PLATFORM)_debug,vpp-api-test-install)
597
598 .PHONY: run-vat
599 run-vat:
600         @$(SUDO) $(BR)/install-$(PLATFORM)_debug-native/vpp/bin/vpp_api_test
601
602 .PHONY: pkg-deb
603 pkg-deb:
604         $(call make,$(PLATFORM),vpp-package-deb)
605
606 .PHONY: pkg-snap
607 pkg-snap:
608         cd extras/snap ;                        \
609         ./prep ;                                \
610         SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G   \
611         SNAPCRAFT_BUILD_ENVIRONMENT_CPU=6       \
612         snapcraft --debug
613
614 .PHONY: snap-clean
615 snap-clean:
616         cd extras/snap ;                        \
617         snapcraft clean ;                       \
618         rm -f *.snap *.tgz
619
620 .PHONY: vom-pkg-deb
621 vom-pkg-deb: pkg-deb
622         $(call make,$(PLATFORM),vom-package-deb)
623
624 .PHONY: pkg-deb-debug
625 pkg-deb-debug:
626         $(call make,$(PLATFORM)_debug,vpp-package-deb)
627
628 .PHONY: vom-pkg-deb-debug
629 vom-pkg-deb-debug: pkg-deb-debug
630         $(call make,$(PLATFORM)_debug,vom-package-deb)
631
632 .PHONY: pkg-rpm
633 pkg-rpm: dist
634         make -C extras/rpm
635
636 .PHONY: pkg-srpm
637 pkg-srpm: dist
638         make -C extras/rpm srpm
639
640 .PHONY: dpdk-install-dev
641 dpdk-install-dev:
642         $(call banner,"This command is deprecated. Please use 'make install-ext-deps'")
643         make -C build/external install-$(PKG)
644
645 .PHONY: install-ext-deps
646 install-ext-deps:
647         make -C build/external install-$(PKG)
648
649 .PHONY: install-ext-dep
650 install-ext-dep: install-ext-deps
651
652 .PHONY: json-api-files
653 json-api-files:
654         $(WS_ROOT)/src/tools/vppapigen/generate_json.py
655
656 .PHONY: json-api-files-debug
657 json-api-files-debug:
658         $(WS_ROOT)/src/tools/vppapigen/generate_json.py --debug-target
659
660 .PHONY: ctags
661 ctags: ctags.files
662         @ctags --totals --tag-relative -L $<
663         @rm $<
664
665 .PHONY: gtags
666 gtags: ctags
667         @gtags --gtagslabel=ctags
668
669 .PHONY: cscope
670 cscope: cscope.files
671         @cscope -b -q -v
672
673 .PHONY: compdb
674 compdb:
675         @ninja -C build-root/build-vpp_debug-native/vpp -t compdb > compile_commands.json
676
677 .PHONY: checkstyle
678 checkstyle: checkfeaturelist
679         @build-root/scripts/checkstyle.sh
680
681 .PHONY: checkstyle-commit
682 checkstyle-commit:
683         @extras/scripts/check_commit_msg.sh
684
685 .PHONY: checkstyle-test
686 checkstyle-test: test-checkstyle
687
688 .PHONY: checkstyle-all
689 checkstyle-all: checkstyle-commit checkstyle checkstyle-test
690
691 .PHONY: fixstyle
692 fixstyle:
693         @build-root/scripts/checkstyle.sh --fix
694
695 .PHONY: checkstyle-api
696 checkstyle-api:
697         @extras/scripts/crcchecker.py --check-patch
698
699 # necessary because Bug 1696324 - Update to python3.6 breaks PyYAML dependencies
700 # Status:       CLOSED CANTFIX
701 # https://bugzilla.redhat.com/show_bug.cgi?id=1696324
702 .PHONY: centos-pyyaml
703 centos-pyyaml:
704 ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-7)
705         @python3 -m pip install pyyaml
706 endif
707 ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8)
708         @sudo -E yum install $(CONFIRM) python3-pyyaml
709 endif
710
711 .PHONY: featurelist
712 featurelist: centos-pyyaml
713         @build-root/scripts/fts.py --all --markdown
714
715 .PHONY: checkfeaturelist
716 checkfeaturelist: centos-pyyaml
717         @build-root/scripts/fts.py --validate --all
718
719 #
720 # Build the documentation
721 #
722
723 # Doxygen configuration and our utility scripts
724 export DOXY_DIR ?= $(WS_ROOT)/doxygen
725
726 define make-doxy
727         @OS_ID="$(OS_ID)" make -C $(DOXY_DIR) $@
728 endef
729
730 .PHONY: bootstrap-doxygen
731 bootstrap-doxygen:
732         $(call make-doxy)
733
734 .PHONY: doxygen
735 doxygen: bootstrap-doxygen
736         $(call make-doxy)
737
738 .PHONY: wipe-doxygen
739 wipe-doxygen:
740         $(call make-doxy)
741
742 # Sphinx Documents
743 export DOCS_DIR = $(WS_ROOT)/docs
744 export VENV_DIR = $(WS_ROOT)/sphinx_venv
745 export SPHINX_SCRIPTS_DIR = $(WS_ROOT)/docs/scripts
746
747 .PHONY: docs-venv
748 docs-venv:
749         @($(SPHINX_SCRIPTS_DIR)/sphinx-make.sh venv)
750
751 .PHONY: docs
752 docs: $(DOCS_DIR)
753         @($(SPHINX_SCRIPTS_DIR)/sphinx-make.sh html)
754
755 .PHONY: docs-clean
756 docs-clean:
757         @rm -rf $(DOCS_DIR)/_build
758         @rm -rf $(VENV_DIR)
759
760 .PHONY: pkg-verify
761 pkg-verify: install-dep $(BR)/.deps.ok install-ext-deps
762         $(call banner,"Building for PLATFORM=vpp using gcc")
763         @make -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
764         $(call banner,"Building sample-plugin")
765         @make -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install
766         $(call banner,"Building libmemif")
767         @make -C build-root PLATFORM=vpp TAG=vpp libmemif-install
768         $(call banner,"Building VOM")
769         @make -C build-root PLATFORM=vpp TAG=vpp vom-install
770         $(call banner,"Building $(PKG) packages")
771         @make pkg-$(PKG)
772 ifeq ($(OS_ID),ubuntu)
773         $(call banner,"Building VOM $(PKG) package")
774         @make vom-pkg-deb
775 endif
776
777 MAKE_VERIFY_GATE_OS ?= ubuntu-18.04
778 .PHONY: verify
779 verify: pkg-verify
780 ifeq ($(OS_ID)-$(OS_VERSION_ID),$(MAKE_VERIFY_GATE_OS))
781         $(call banner,"Testing vppapigen")
782         @src/tools/vppapigen/test_vppapigen.py
783         $(call banner,"Running tests")
784         @make COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
785 else
786         $(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)")
787 endif