2015-12-08 15:45:58 -07:00
|
|
|
# Copyright (c) 2015 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.
|
|
|
|
|
|
|
|
# Scripts require non-POSIX parts of bash
|
2024-01-18 14:51:44 +00:00
|
|
|
SHELL := $(shell which bash)
|
2015-12-08 15:45:58 -07:00
|
|
|
|
2018-09-21 12:27:45 +02:00
|
|
|
DL_CACHE_DIR = $(HOME)/Downloads
|
|
|
|
MAKE_ARGS ?= -j
|
|
|
|
BUILD_DIR ?= $(CURDIR)/_build
|
|
|
|
INSTALL_DIR ?= $(CURDIR)/_install
|
2022-03-08 15:40:49 -03:00
|
|
|
PKG_VERSION ?= $(shell git describe --abbrev=0 --match 'v[0-9]*' | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2)
|
2018-10-11 09:18:26 -07:00
|
|
|
PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. . | wc -l)
|
2023-10-18 21:18:32 +00:00
|
|
|
SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct .)
|
2024-02-07 13:17:17 +00:00
|
|
|
ifeq ($shell(uname), FreeBSD)
|
|
|
|
JOBS := $(shell nproc)
|
|
|
|
else
|
2017-06-14 11:24:41 -04:00
|
|
|
JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
|
2017-11-13 20:09:21 +01:00
|
|
|
$(shell grep -c ^processor /proc/cpuinfo), 2)
|
2024-02-07 13:17:17 +00:00
|
|
|
endif # FreeBSD
|
2015-12-08 15:45:58 -07:00
|
|
|
|
2018-09-21 12:27:45 +02:00
|
|
|
B := $(BUILD_DIR)
|
|
|
|
I := $(INSTALL_DIR)
|
2015-12-08 15:45:58 -07:00
|
|
|
|
2019-03-29 15:41:48 -04:00
|
|
|
ifneq ($(shell which cmake3),)
|
|
|
|
CMAKE?=cmake3
|
|
|
|
else
|
|
|
|
CMAKE?=cmake
|
|
|
|
endif
|
|
|
|
|
2020-10-12 15:33:11 +02:00
|
|
|
ARCH_X86_64=$(filter x86_64,$(shell uname -m))
|
2023-10-23 18:36:18 +02:00
|
|
|
AARCH64=$(filter aarch64,$(shell uname -m))
|
2020-10-12 15:33:11 +02:00
|
|
|
|
2018-09-21 12:27:45 +02:00
|
|
|
include packages.mk
|
|
|
|
include packages/ipsec-mb.mk
|
2019-04-01 16:43:29 +02:00
|
|
|
include packages/quicly.mk
|
2024-01-24 10:46:44 +00:00
|
|
|
ifneq ($(shell uname), FreeBSD)
|
2019-03-25 11:41:34 +01:00
|
|
|
include packages/rdma-core.mk
|
2022-09-19 16:26:25 +02:00
|
|
|
include packages/dpdk.mk
|
af_xdp: update af_xdp driver plugin to depend on libxdp
AF_XDP support is deprecated in libbpf since v0.7.0 [1], the libxdp library
now provides the functionality which once was in libbpf, this commit updates
af_xdp plugin to depend on libxdp, libbpf still remains a dependency even if
libxdp is present, as it need use libbpf APIs for program loading.
libxdp is distributed within xdp-tool [2], xdp-tools package also
include libbpf in it as dependency, so here installed libxdp v1.2.9 and
libbpf v0.8.0, both from xdp-tool-1.2.9 package.
More information about libxdp compatibility can be found in the libxdp
README [3].
In libbpf v0.8.0, The bpf_prog_load function was deprecated and changed to
bpf_object__open_file and bpf_object__next_program and bpf_object__load,
The bpf_get_link_xdp_id and bpf_set_link_xdp_fd functions were deprecated
and changed to bpf_xdp_attach and bpf_xdp_detach, The bpf_object__unload
function was deprecated and changed to bpf_object__close.
[1] https://github.com/libbpf/libbpf/commit/277846bc6c15
[2] https://github.com/xdp-project/xdp-tools/releases/tag/v1.2.9
[3] https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/README.org
Type: improvement
Change-Id: Ifbf6e3aa38bc6e0b77561f26311fd11c15ddb47e
Signed-off-by: Yulong Pei <yulong.pei@intel.com>
2023-01-05 02:26:32 +00:00
|
|
|
include packages/xdp-tools.mk
|
2023-10-23 18:36:18 +02:00
|
|
|
include packages/octeon-roc.mk
|
2024-01-24 10:46:44 +00:00
|
|
|
endif # FreeBSD
|
2017-01-09 20:24:50 +01:00
|
|
|
|
2015-12-08 15:45:58 -07:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@rm -rf $(B) $(I)
|
|
|
|
|
2019-03-25 11:41:34 +01:00
|
|
|
.PHONY: install
|
2024-01-24 10:46:44 +00:00
|
|
|
ifeq ($(shell uname), FreeBSD)
|
|
|
|
install: $(if $(ARCH_X86_64), ipsec-mb-install) quicly-install
|
|
|
|
else
|
2023-10-23 18:36:18 +02:00
|
|
|
install: $(if $(ARCH_X86_64), ipsec-mb-install) dpdk-install rdma-core-install quicly-install xdp-tools-install $(if $(AARCH64), octeon-roc-install)
|
2024-01-24 10:46:44 +00:00
|
|
|
endif # FreeBSD
|
2019-03-25 11:41:34 +01:00
|
|
|
|
|
|
|
.PHONY: config
|
2024-01-24 10:46:44 +00:00
|
|
|
ifeq ($(shell uname), FreeBSD)
|
|
|
|
config: $(if $(ARCH_X86_64), ipsec-mb-config) quicly-build
|
|
|
|
else
|
2022-04-05 19:26:51 +02:00
|
|
|
config: $(if $(ARCH_X86_64), ipsec-mb-config) dpdk-config rdma-core-config quicly-build
|
2024-01-24 10:46:44 +00:00
|
|
|
endif # FreeBSD
|
2019-03-25 11:41:34 +01:00
|
|
|
|
2017-01-09 20:24:50 +01:00
|
|
|
##############################################################################
|
|
|
|
# .deb packaging
|
|
|
|
##############################################################################
|
|
|
|
|
2018-09-18 18:41:38 +02:00
|
|
|
DEB_VER := $(PKG_VERSION)
|
2017-01-09 20:24:50 +01:00
|
|
|
DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
|
2018-09-18 18:41:38 +02:00
|
|
|
DEV_DEB=vpp-ext-deps_$(DEB_VER)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
|
|
|
|
INSTALLED_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-ext-deps 2> /dev/null)
|
2017-01-09 20:24:50 +01:00
|
|
|
|
|
|
|
.PHONY: build-deb install-deb check-deb
|
|
|
|
|
|
|
|
deb/debian/changelog: Makefile
|
2018-09-18 18:41:38 +02:00
|
|
|
@echo "vpp-ext-deps ($(DEB_VER)-$(PKG_SUFFIX)) unstable; urgency=low" > $@
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "" >> $@
|
2018-09-18 18:41:38 +02:00
|
|
|
@echo " * Version $(DEB_VER)" >> $@
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "" >> $@
|
2023-10-18 21:18:32 +00:00
|
|
|
@echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R --date=@${SOURCE_DATE_EPOCH})" >> $@
|
2017-01-09 20:24:50 +01:00
|
|
|
|
|
|
|
$(DEV_DEB): deb/debian/changelog
|
|
|
|
@cd deb && dpkg-buildpackage -b -uc -us
|
2019-03-29 21:22:09 +01:00
|
|
|
git clean -fdx deb
|
2017-01-09 20:24:50 +01:00
|
|
|
|
|
|
|
build-deb: $(DEV_DEB)
|
|
|
|
|
|
|
|
install-deb:
|
2018-09-18 18:41:38 +02:00
|
|
|
ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX))
|
2024-06-05 18:11:46 +00:00
|
|
|
@$(MAKE) $(DEV_DEB)
|
2017-01-09 20:24:50 +01:00
|
|
|
@sudo dpkg -i $(DEV_DEB)
|
|
|
|
else
|
|
|
|
@echo "=========================================================="
|
2018-09-18 18:41:38 +02:00
|
|
|
@echo " Up-to-date vpp-ext-deps package already installed"
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "=========================================================="
|
|
|
|
endif
|
|
|
|
|
|
|
|
check-deb:
|
2018-09-18 18:41:38 +02:00
|
|
|
ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX))
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "=========================================================="
|
2019-03-25 11:41:34 +01:00
|
|
|
@echo " Out of date vpp-ext-deps package installed."
|
|
|
|
@echo " Installed: $(INSTALLED_VER)"
|
|
|
|
@echo " Needed: $(DEB_VER)-$(PKG_SUFFIX)"
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo ""
|
2018-09-18 18:41:38 +02:00
|
|
|
@echo " Please upgrade by invoking 'make install-ext-deps'"
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo " from the top level directory."
|
|
|
|
@echo "=========================================================="
|
|
|
|
endif
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# .rpm packaging
|
|
|
|
##############################################################################
|
|
|
|
|
2018-09-18 18:41:38 +02:00
|
|
|
RPM_VER := $(PKG_VERSION)
|
2017-01-09 20:24:50 +01:00
|
|
|
RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
|
2018-09-18 18:41:38 +02:00
|
|
|
DEV_RPM=vpp-ext-deps-$(RPM_VER)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
|
2020-12-30 15:25:15 +08:00
|
|
|
INSTALLED_RPM_VER=$(shell rpm -q --queryformat '%{VERSION}-%{RELEASE}' vpp-ext-deps 2> /dev/null | grep -v "vpp-ext-deps")
|
2017-01-09 20:24:50 +01:00
|
|
|
|
|
|
|
.PHONY: build-rpm install-rpm check-rpm
|
|
|
|
|
2018-09-18 18:41:38 +02:00
|
|
|
$(DEV_RPM): Makefile rpm/vpp-ext-deps.spec
|
2017-01-09 20:24:50 +01:00
|
|
|
@rpmbuild -bb \
|
|
|
|
--define "_topdir $(CURDIR)/rpm" \
|
2018-09-18 18:41:38 +02:00
|
|
|
--define "_version $(RPM_VER)" \
|
2017-01-09 20:24:50 +01:00
|
|
|
--define "_release $(PKG_SUFFIX)" \
|
2018-09-18 18:41:38 +02:00
|
|
|
$(CURDIR)/rpm/vpp-ext-deps.spec
|
2017-01-09 20:24:50 +01:00
|
|
|
mv rpm/RPMS/$(RPM_ARCH)/*.rpm .
|
2019-03-29 21:22:09 +01:00
|
|
|
@git clean -fdx rpm
|
2017-01-09 20:24:50 +01:00
|
|
|
|
|
|
|
build-rpm: $(DEV_RPM)
|
|
|
|
|
|
|
|
install-rpm:
|
2018-09-27 14:04:43 +02:00
|
|
|
ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX))
|
2017-06-06 15:29:16 +01:00
|
|
|
@$(MAKE) $(DEV_RPM)
|
2019-07-01 19:08:33 -04:00
|
|
|
sudo rpm -e vpp-ext-deps || true
|
2018-10-25 11:49:39 +02:00
|
|
|
sudo rpm -Uih --force $(DEV_RPM)
|
2017-01-09 20:24:50 +01:00
|
|
|
else
|
|
|
|
@echo "=========================================================="
|
2019-03-25 11:41:34 +01:00
|
|
|
@echo " Up-to-date vpp-ext-deps package already installed"
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "=========================================================="
|
|
|
|
endif
|
|
|
|
|
|
|
|
check-rpm:
|
2018-09-18 18:41:38 +02:00
|
|
|
ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX))
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "=========================================================="
|
2019-03-25 11:41:34 +01:00
|
|
|
@echo " Out of date vpp-ext-deps package installed."
|
|
|
|
@echo " Installed: $(INSTALLED_RPM_VER)"
|
|
|
|
@echo " Needed: $(RPM_VER)-$(PKG_SUFFIX)"
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo ""
|
2018-09-18 18:41:38 +02:00
|
|
|
@echo " Please upgrade by invoking 'make install-ext-deps'"
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo " from the top level directory."
|
|
|
|
@echo "=========================================================="
|
|
|
|
endif
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# ebuild support
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
.PHONY: ebuild-build ebuild-install
|
|
|
|
|
|
|
|
ebuild-build:
|
2018-09-18 18:41:38 +02:00
|
|
|
ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "=========================================================="
|
2019-03-25 11:41:34 +01:00
|
|
|
@echo "Building vpp-ext-deps from source. Consider installing"
|
|
|
|
@echo "development package by invoking 'make install-ext-deps'"
|
|
|
|
@echo "from the top level directory"
|
2017-01-09 20:24:50 +01:00
|
|
|
@echo "=========================================================="
|
2024-01-18 10:48:17 +00:00
|
|
|
$(MAKE) config
|
2017-01-09 20:24:50 +01:00
|
|
|
else
|
2018-09-18 18:41:38 +02:00
|
|
|
ifneq ($(INSTALLED_VER),)
|
2024-06-05 18:11:46 +00:00
|
|
|
$(MAKE) check-deb
|
2017-01-09 20:24:50 +01:00
|
|
|
endif
|
|
|
|
ifneq ($(INSTALLED_RPM_VER),)
|
2024-01-18 10:48:17 +00:00
|
|
|
$(MAKE) check-rpm
|
2017-01-09 20:24:50 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ebuild-install:
|
2018-09-18 18:41:38 +02:00
|
|
|
ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
|
2024-01-18 10:48:17 +00:00
|
|
|
$(MAKE) install
|
2017-01-09 20:24:50 +01:00
|
|
|
endif
|