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