1 # Copyright (c) 2015 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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 # Scripts require non-POSIX parts of bash
17 DL_CACHE_DIR = $(HOME)/Downloads
20 BUILD_DIR ?= $(CURDIR)/_build
21 INSTALL_DIR ?= $(CURDIR)/_install
22 PKG_VERSION ?= $(shell git describe --abbrev=0 | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2)
23 PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. . | wc -l)
24 JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
25 $(shell grep -c ^processor /proc/cpuinfo), 2)
30 ifneq ($(shell which cmake3),)
37 include packages/nasm.mk
38 include packages/ipsec-mb.mk
39 include packages/quicly.mk
40 include packages/dpdk.mk
41 include packages/rdma-core.mk
48 install: dpdk-install rdma-core-install quicly-install
51 config: dpdk-config rdma-core-config
53 ##############################################################################
55 ##############################################################################
57 DEB_VER := $(PKG_VERSION)
58 DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
59 DEV_DEB=vpp-ext-deps_$(DEB_VER)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
60 INSTALLED_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-ext-deps 2> /dev/null)
62 .PHONY: build-deb install-deb check-deb
64 deb/debian/changelog: Makefile
65 @echo "vpp-ext-deps ($(DEB_VER)-$(PKG_SUFFIX)) unstable; urgency=low" > $@
67 @echo " * Version $(DEB_VER)" >> $@
69 @echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R)" >> $@
71 $(DEV_DEB): deb/debian/changelog
72 @cd deb && dpkg-buildpackage -b -uc -us
78 ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX))
80 @sudo dpkg -i $(DEV_DEB)
82 @echo "=========================================================="
83 @echo " Up-to-date vpp-ext-deps package already installed"
84 @echo "=========================================================="
88 ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX))
89 @echo "=========================================================="
90 @echo " Out of date vpp-ext-deps package installed."
91 @echo " Installed: $(INSTALLED_VER)"
92 @echo " Needed: $(DEB_VER)-$(PKG_SUFFIX)"
94 @echo " Please upgrade by invoking 'make install-ext-deps'"
95 @echo " from the top level directory."
96 @echo "=========================================================="
99 ##############################################################################
101 ##############################################################################
103 RPM_VER := $(PKG_VERSION)
104 RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
105 DEV_RPM=vpp-ext-deps-$(RPM_VER)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
106 INSTALLED_RPM_VER=$(shell rpm -q --queryformat '%{VERSION}-%{RELEASE}' vpp-ext-deps 2> /dev/null | grep -v "not inst")
108 .PHONY: build-rpm install-rpm check-rpm
110 $(DEV_RPM): Makefile rpm/vpp-ext-deps.spec
112 --define "_topdir $(CURDIR)/rpm" \
113 --define "_version $(RPM_VER)" \
114 --define "_release $(PKG_SUFFIX)" \
115 $(CURDIR)/rpm/vpp-ext-deps.spec
116 mv rpm/RPMS/$(RPM_ARCH)/*.rpm .
119 build-rpm: $(DEV_RPM)
122 ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX))
124 sudo rpm -e vpp-ext-deps
125 sudo rpm -Uih --force $(DEV_RPM)
127 @echo "=========================================================="
128 @echo " Up-to-date vpp-ext-deps package already installed"
129 @echo "=========================================================="
133 ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX))
134 @echo "=========================================================="
135 @echo " Out of date vpp-ext-deps package installed."
136 @echo " Installed: $(INSTALLED_RPM_VER)"
137 @echo " Needed: $(RPM_VER)-$(PKG_SUFFIX)"
139 @echo " Please upgrade by invoking 'make install-ext-deps'"
140 @echo " from the top level directory."
141 @echo "=========================================================="
144 ##############################################################################
146 ##############################################################################
148 .PHONY: ebuild-build ebuild-install
151 ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
152 @echo "=========================================================="
153 @echo "Building vpp-ext-deps from source. Consider installing"
154 @echo "development package by invoking 'make install-ext-deps'"
155 @echo "from the top level directory"
156 @echo "=========================================================="
159 ifneq ($(INSTALLED_VER),)
162 ifneq ($(INSTALLED_RPM_VER),)
168 ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)