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