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