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)
23 PKG_SUFFIX ?= $(shell git log --oneline $$(git describe --abbrev=0).. . | wc -l)
24 JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
25 $(shell grep -c ^processor /proc/cpuinfo), 2)
31 include packages/nasm.mk
32 include packages/ipsec-mb.mk
33 include packages/dpdk.mk
39 ##############################################################################
41 ##############################################################################
43 DEB_VER := $(PKG_VERSION)
44 DEB_ARCH=$(shell dpkg --print-architecture 2> /dev/null)
45 DEV_DEB=vpp-ext-deps_$(DEB_VER)-$(PKG_SUFFIX)_$(DEB_ARCH).deb
46 INSTALLED_VER=$(shell dpkg-query --showformat='$${Version}' --show vpp-ext-deps 2> /dev/null)
48 .PHONY: build-deb install-deb check-deb
50 deb/debian/changelog: Makefile
51 @echo "vpp-ext-deps ($(DEB_VER)-$(PKG_SUFFIX)) unstable; urgency=low" > $@
53 @echo " * Version $(DEB_VER)" >> $@
55 @echo " -- VPP Dev <vpp-dev@lists.fd.io> $(shell date -R)" >> $@
57 $(DEV_DEB): deb/debian/changelog
58 @cd deb && dpkg-buildpackage -b -uc -us
64 ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX))
65 @echo "=========================================================="
66 @echo " Out of date vpp-ext-deps package installed."
67 @echo " Installed: $(INSTALLED_VER)"
68 @echo " Needed: $(DEB_VER)-$(PKG_SUFFIX)"
69 @echo "=========================================================="
71 @sudo dpkg -i $(DEV_DEB)
73 @echo "=========================================================="
74 @echo " Up-to-date vpp-ext-deps package already installed"
75 @echo "=========================================================="
79 ifneq ($(INSTALLED_VER),$(DEB_VER)-$(PKG_SUFFIX))
80 @echo "=========================================================="
81 @echo " Outdated DPDK package detected:"
82 @echo " Installed: vpp-ext-deps $(INSTALLED_VER)"
83 @echo " Current: vpp-ext-deps $(DEB_VER)-$(PKG_SUFFIX)"
85 @echo " Please upgrade by invoking 'make install-ext-deps'"
86 @echo " from the top level directory."
87 @echo "=========================================================="
90 ##############################################################################
92 ##############################################################################
94 RPM_VER := $(PKG_VERSION)
95 RPM_ARCH=$(shell rpm --eval "%{_arch}" 2> /dev/null)
96 DEV_RPM=vpp-ext-deps-$(RPM_VER)-$(PKG_SUFFIX).$(RPM_ARCH).rpm
97 INSTALLED_RPM_VER=$(shell rpm -q --queryformat '%{VERSION}-%{RELEASE}' vpp-ext-deps 2> /dev/null | grep -v "not inst")
99 .PHONY: build-rpm install-rpm check-rpm
101 $(DEV_RPM): Makefile rpm/vpp-ext-deps.spec
103 --define "_topdir $(CURDIR)/rpm" \
104 --define "_version $(RPM_VER)" \
105 --define "_release $(PKG_SUFFIX)" \
106 $(CURDIR)/rpm/vpp-ext-deps.spec
107 mv rpm/RPMS/$(RPM_ARCH)/*.rpm .
110 build-rpm: $(DEV_RPM)
113 ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX))
115 sudo rpm -Uih $(DEV_RPM)
117 @echo "=========================================================="
118 @echo " Up-to-date DPDK package already installed"
119 @echo "=========================================================="
123 ifneq ($(INSTALLED_RPM_VER),$(RPM_VER)-$(PKG_SUFFIX))
124 @echo "=========================================================="
125 @echo " Outdated DPDK package detected:"
126 @echo " Installed: vpp-ext-deps $(INSTALLED_RPM_VER)"
127 @echo " Current: vpp-ext-deps $(RPM_VER)-$(PKG_SUFFIX)"
129 @echo " Please upgrade by invoking 'make install-ext-deps'"
130 @echo " from the top level directory."
131 @echo "=========================================================="
134 ##############################################################################
136 ##############################################################################
138 .PHONY: ebuild-build ebuild-install
141 ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
142 @echo "=========================================================="
143 @echo "Building DPDK from source. Consider installing development"
144 @echo "package by invoking 'make install-ext-deps' from the"
145 @echo "top level directory"
146 @echo "=========================================================="
149 ifneq ($(INSTALLED_VER),)
152 ifneq ($(INSTALLED_RPM_VER),)
158 ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)