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