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