# Copyright (c) 2016 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. export WS_ROOT=$(CURDIR) export BR=$(WS_ROOT)/build-root CCACHE_DIR?=$(BR)/.ccache SHELL:=/bin/bash GDB?=gdb PLATFORM?=vpp SAMPLE_PLUGIN?=no STARTUP_DIR?=$(PWD) MACHINE=$(shell uname -m) SUDO?=sudo -E DPDK_CONFIG?=no-pci ,:=, define disable_plugins $(if $(1), \ "plugins {" \ $(patsubst %,"plugin %_plugin.so { disable }",$(subst $(,), ,$(1))) \ " }" \ ,) endef MINIMAL_STARTUP_CONF=" \ unix { \ interactive \ cli-listen /run/vpp/cli.sock \ gid $(shell id -g) \ $(if $(wildcard startup.vpp),"exec startup.vpp",) \ } \ $(if $(DPDK_CONFIG), "dpdk { $(DPDK_CONFIG) }",) \ $(call disable_plugins,$(DISABLED_PLUGINS)) \ " GDB_ARGS= -ex "handle SIGUSR1 noprint nostop" # # OS Detection # # We allow Darwin (MacOS) for docs generation; VPP build will still fail. ifneq ($(shell uname),Darwin) OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') endif ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID)) PKG=deb else ifeq ($(filter rhel centos fedora,$(OS_ID)),$(OS_ID)) PKG=rpm endif # +libganglia1-dev if building the gmond plugin DEB_DEPENDS = curl build-essential autoconf automake ccache DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-systemd dh-python DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config DEB_DEPENDS += lcov chrpath autoconf libnuma-dev DEB_DEPENDS += python3-all python3-setuptools check DEB_DEPENDS += libffi-dev python3-ply libmbedtls-dev DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml DEB_DEPENDS += python3-venv # ensurepip DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil DEB_DEPENDS += libnl-3-dev libnl-route-3-dev # python3.6 on 16.04 requires python36-dev LIBFFI=libffi6 # works on all but 20.04 and debian-testing ifeq ($(OS_VERSION_ID),18.04) DEB_DEPENDS += python-dev python-all python-pip python-virtualenv DEB_DEPENDS += libssl-dev DEB_DEPENDS += clang-9 clang-format-10 else ifeq ($(OS_VERSION_ID),20.04) DEB_DEPENDS += python3-virtualenv DEB_DEPENDS += libssl-dev DEB_DEPENDS += libelf-dev # for libbpf (af_xdp) DEB_DEPENDS += clang-format-10 LIBFFI=libffi7 else ifeq ($(OS_VERSION_ID),20.10) DEB_DEPENDS += python3-virtualenv DEB_DEPENDS += libssl-dev DEB_DEPENDS += libelf-dev # for libbpf (af_xdp) DEB_DEPENDS += clang-format-10 LIBFFI=libffi8ubuntu1 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-10) DEB_DEPENDS += python3-virtualenv virtualenv DEB_DEPENDS += libssl-dev DEB_DEPENDS += libelf-dev # for libbpf (af_xdp) else DEB_DEPENDS += libssl-dev DEB_DEPENDS += libelf-dev # for libbpf (af_xdp) LIBFFI=libffi7 endif DEB_DEPENDS += $(LIBFFI) RPM_DEPENDS = redhat-lsb glibc-static RPM_DEPENDS += apr-devel RPM_DEPENDS += numactl-devel RPM_DEPENDS += check check-devel RPM_DEPENDS += selinux-policy selinux-policy-devel RPM_DEPENDS += ninja-build RPM_DEPENDS += libuuid-devel RPM_DEPENDS += mbedtls-devel RPM_DEPENDS += ccache RPM_DEPENDS += xmlto RPM_DEPENDS += elfutils-libelf-devel RPM_DEPENDS += libnl3-devel ifeq ($(OS_ID),fedora) RPM_DEPENDS += dnf-utils RPM_DEPENDS += subunit subunit-devel RPM_DEPENDS += compat-openssl10-devel RPM_DEPENDS += python3-devel # needed for python3 -m pip install psutil RPM_DEPENDS += python3-ply # for vppapigen RPM_DEPENDS += python3-virtualen
# Copyright (c) 2017-2019 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

exit 0
,test) .PHONY: test-debug test-debug: $(call test,vpp,vpp_debug,test) .PHONY: test-gcov test-gcov: $(call test,vpp,vpp_gcov,test) .PHONY: test-all test-all: $(eval EXTENDED_TESTS=yes) $(call test,vpp,vpp,test) .PHONY: test-all-debug test-all-debug: $(eval EXTENDED_TESTS=yes) $(call test,vpp,vpp_debug,test) .PHONY: papi-wipe papi-wipe: test-wipe-papi $(call banner,"This command is deprecated. Please use 'test-wipe-papi'") .PHONY: test-wipe-papi test-wipe-papi: @make -C test wipe-papi .PHONY: test-help test-help: @make -C test help .PHONY: test-wipe test-wipe: @make -C test wipe .PHONY: test-shell test-shell: $(call test,vpp,vpp,shell) .PHONY: test-shell-debug test-shell-debug: $(call test,vpp,vpp_debug,shell) .PHONY: test-shell-gcov test-shell-gcov: $(call test,vpp,vpp_gcov,shell) .PHONY: test-dep test-dep: @make -C test test-dep .PHONY: test-doc test-doc: @make -C test doc .PHONY: test-wipe-doc test-wipe-doc: @make -C test wipe-doc .PHONY: test-cov test-cov: $(eval EXTENDED_TESTS=yes) $(call test,vpp,vpp_gcov,cov) .PHONY: test-wipe-cov test-wipe-cov: @make -C test wipe-cov .PHONY: test-wipe-all test-wipe-all: @make -C test wipe-all .PHONY: test-checkstyle test-checkstyle: @make -C test checkstyle .PHONY: test-checkstyle-diff test-checkstyle-diff: @make -C test checkstyle-diff .PHONY: test-refresh-deps test-refresh-deps: @make -C test refresh-deps .PHONY: retest retest: $(call test,vpp,vpp,retest) .PHONY: retest-debug retest-debug: $(call test,vpp,vpp_debug,retest) .PHONY: retest-all retest-all: $(eval EXTENDED_TESTS=yes) $(call test,vpp,vpp,retest) .PHONY: retest-all-debug retest-all-debug: $(eval EXTENDED_TESTS=yes) $(call test,vpp,vpp_debug,retest) .PHONY: test-start-vpp-in-gdb test-start-vpp-in-gdb: $(call test,vpp,vpp,start-gdb) .PHONY: test-start-vpp-debug-in-gdb test-start-vpp-debug-in-gdb: $(call test,vpp,vpp_debug,start-gdb) ifeq ("$(wildcard $(STARTUP_CONF))","") define run @echo "WARNING: STARTUP_CONF not defined or file doesn't exist." @echo " Running with minimal startup config: $(MINIMAL_STARTUP_CONF)\n" @cd $(STARTUP_DIR) && \ $(SUDO) $(2) $(1)/vpp/bin/vpp $(MINIMAL_STARTUP_CONF) endef else define run @cd $(STARTUP_DIR) && \ $(SUDO) $(2) $(1)/vpp/bin/vpp $(shell cat $(STARTUP_CONF) | sed -e 's/#.*//') endef endif %.files: .FORCE @find src -name '*.[chS]' > $@ .FORCE: .PHONY: run run: $(call run, $(BR)/install-$(PLATFORM)_debug-native) .PHONY: run-release run-release: $(call run, $(BR)/install-$(PLATFORM)-native) .PHONY: debug debug: $(call run, $(BR)/install-$(PLATFORM)_debug-native,$(GDB) $(GDB_ARGS) --args) .PHONY: build-coverity build-coverity: $(call make,$(PLATFORM)_coverity,install-packages) @make -C build-root PLATFORM=vpp TAG=vpp_coverity libmemif-install .PHONY: debug-release debug-release: $(call run, $(BR)/install-$(PLATFORM)-native,$(GDB) $(GDB_ARGS) --args) .PHONY: build-vat build-vat: $(call make,$(PLATFORM)_debug,vpp-api-test-install) .PHONY: run-vat run-vat: @$(SUDO) $(BR)/install-$(PLATFORM)_debug-native/vpp/bin/vpp_api_test .PHONY: pkg-deb pkg-deb: $(call make,$(PLATFORM),vpp-package-deb) .PHONY: pkg-snap pkg-snap: cd extras/snap ; \ ./prep ; \ SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G \ SNAPCRAFT_BUILD_ENVIRONMENT_CPU=6 \ snapcraft --debug .PHONY: snap-clean snap-clean: cd extras/snap ; \ snapcraft clean ; \ rm -f *.snap *.tgz .PHONY: pkg-deb-debug pkg-deb-debug: $(call make,$(PLATFORM)_debug,vpp-package-deb) .PHONY: pkg-rpm pkg-rpm: dist make -C extras/rpm .PHONY: pkg-srpm pkg-srpm: dist make -C extras/rpm srpm .PHONY: install-ext-deps install-ext-deps: make -C build/external install-$(PKG) .PHONY: install-ext-dep install-ext-dep: install-ext-deps .PHONY: json-api-files json-api-files: $(WS_ROOT)/src/tools/vppapigen/generate_json.py .PHONY: json-api-files-debug json-api-files-debug: $(WS_ROOT)/src/tools/vppapigen/generate_json.py --debug-target .PHONY: go-api-files go-api-files: json-api-files $(WS_ROOT)/src/tools/vppapigen/generate_go.py .PHONY: ctags ctags: ctags.files @ctags --totals --tag-relative=yes -L $< @rm $< .PHONY: gtags gtags: ctags @gtags --gtagslabel=ctags .PHONY: cscope cscope: cscope.files @cscope -b -q -v .PHONY: compdb compdb: @ninja -C build-root/build-vpp_debug-native/vpp build.ninja @ninja -C build-root/build-vpp_debug-native/vpp -t compdb | \ src/scripts/compdb_cleanup.py > compile_commands.json .PHONY: checkstyle checkstyle: checkfeaturelist @extras/scripts/checkstyle.sh .PHONY: checkstyle-commit checkstyle-commit: @extras/scripts/check_commit_msg.sh .PHONY: checkstyle-test checkstyle-test: test-checkstyle .PHONY: checkstyle-all checkstyle-all: checkstyle-commit checkstyle checkstyle-test .PHONY: fixstyle fixstyle: @extras/scripts/checkstyle.sh --fix .PHONY: checkstyle-api checkstyle-api: @extras/scripts/crcchecker.py --check-patchset # necessary because Bug 1696324 - Update to python3.6 breaks PyYAML dependencies # Status: CLOSED CANTFIX # https://bugzilla.redhat.com/show_bug.cgi?id=1696324 .PHONY: centos-pyyaml centos-pyyaml: ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8) @sudo -E yum install $(CONFIRM) python3-pyyaml endif .PHONY: featurelist featurelist: centos-pyyaml @extras/scripts/fts.py --all --markdown .PHONY: checkfeaturelist checkfeaturelist: centos-pyyaml @extras/scripts/fts.py --validate --all # # Build the documentation # # Doxygen configuration and our utility scripts export DOXY_DIR ?= $(WS_ROOT)/doxygen define make-doxy @OS_ID="$(OS_ID)" make -C $(DOXY_DIR) $@ endef .PHONY: bootstrap-doxygen bootstrap-doxygen: $(call make-doxy) .PHONY: doxygen doxygen: bootstrap-doxygen $(call make-doxy) .PHONY: wipe-doxygen wipe-doxygen: $(call make-doxy) # Sphinx Documents export DOCS_DIR = $(WS_ROOT)/docs export VENV_DIR = $(WS_ROOT)/sphinx_venv export SPHINX_SCRIPTS_DIR = $(WS_ROOT)/docs/scripts .PHONY: docs-venv docs-venv: @($(SPHINX_SCRIPTS_DIR)/sphinx-make.sh venv) .PHONY: docs docs: $(DOCS_DIR) @($(SPHINX_SCRIPTS_DIR)/sphinx-make.sh html) .PHONY: docs-clean docs-clean: @rm -rf $(DOCS_DIR)/_build @rm -rf $(VENV_DIR) .PHONY: pkg-verify pkg-verify: install-dep $(BR)/.deps.ok install-ext-deps $(call banner,"Building for PLATFORM=vpp using gcc") @make -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages $(call banner,"Building sample-plugin") @make -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install $(call banner,"Building libmemif") @make -C build-root PLATFORM=vpp TAG=vpp libmemif-install $(call banner,"Building $(PKG) packages") @make pkg-$(PKG) MAKE_VERIFY_GATE_OS ?= ubuntu-18.04 .PHONY: verify verify: pkg-verify ifeq ($(OS_ID)-$(OS_VERSION_ID),$(MAKE_VERIFY_GATE_OS)) $(call banner,"Testing vppapigen") @src/tools/vppapigen/test_vppapigen.py $(call banner,"Running tests") @make COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test else $(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)") endif