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