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