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