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