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