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