NAT44: asymmetrical static mapping rule (VPP-1135)
[vpp.git] / Makefile
index 09a802a..ec3e92d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ CCACHE_DIR?=$(BR)/.ccache
 GDB?=gdb
 PLATFORM?=vpp
 SAMPLE_PLUGIN?=no
+MACHINE=$(shell uname -m)
 
 ,:=,
 define disable_plugins
@@ -57,27 +58,47 @@ endif
 
 # +libganglia1-dev if building the gmond plugin
 
-DEB_DEPENDS  = curl build-essential autoconf automake bison libssl-dev ccache
+DEB_DEPENDS  = curl build-essential autoconf automake bison ccache
 DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-systemd
 DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
-DEB_DEPENDS += lcov chrpath autoconf nasm indent
-DEB_DEPENDS += python-all python-dev python-virtualenv python-pip libffi6
+DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev
+DEB_DEPENDS += python-all python-dev python-virtualenv python-pip libffi6 check
+DEB_DEPENDS += libboost-all-dev libffi-dev
 ifeq ($(OS_VERSION_ID),14.04)
        DEB_DEPENDS += openjdk-8-jdk-headless
+       DEB_DEPENDS += libssl-dev
 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8)
        DEB_DEPENDS += openjdk-8-jdk-headless
+       DEB_DEPENDS += libssl-dev
        APT_ARGS = -t jessie-backports
-else
+else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-9)
+       DEB_DEPENDS += default-jdk-headless
+       DEB_DEPENDS += libssl1.0-dev
+else 
        DEB_DEPENDS += default-jdk-headless
+       DEB_DEPENDS += libssl-dev
 endif
 
 RPM_DEPENDS  = redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils
-RPM_DEPENDS += openssl-devel https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm apr-devel
-RPM_DEPENDS += python-devel
+RPM_DEPENDS += apr-devel
+RPM_DEPENDS += numactl-devel
+RPM_DEPENDS += check check-devel
+RPM_DEPENDS += boost boost-devel
+RPM_DEPENDS += subunit subunit-devel
+
 ifeq ($(OS_ID)-$(OS_VERSION_ID),fedora-25)
+       RPM_DEPENDS += openssl-devel
+       RPM_DEPENDS += python-devel
+       RPM_DEPENDS += python2-virtualenv
+       RPM_DEPENDS_GROUPS = 'C Development Tools and Libraries'
+else ifeq ($(shell if [ "$(OS_ID)" = "fedora" ]; then test $(OS_VERSION_ID) -gt 25; echo $$?; fi),0)
+       RPM_DEPENDS += compat-openssl10-devel
+       RPM_DEPENDS += python2-devel
        RPM_DEPENDS += python2-virtualenv
        RPM_DEPENDS_GROUPS = 'C Development Tools and Libraries'
 else
+       RPM_DEPENDS += openssl-devel
+       RPM_DEPENDS += python-devel
        RPM_DEPENDS += python-virtualenv
        RPM_DEPENDS_GROUPS = 'Development Tools'
 endif
@@ -85,17 +106,30 @@ endif
 # +ganglia-devel if building the ganglia plugin
 
 RPM_DEPENDS += chrpath libffi-devel rpm-build
-RPM_DEPENDS += https://kojipkgs.fedoraproject.org//packages/nasm/2.12.02/2.fc26/x86_64/nasm-2.12.02-2.fc26.x86_64.rpm
-EPEL_DEPENDS = libconfuse-devel epel-rpm-macros
-ifeq ($(filter rhel centos,$(OS_ID)),$(OS_ID))
-       EPEL_DEPENDS += lcov
+
+SUSE_NAME= $(shell grep '^NAME=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g' | cut -d' ' -f2)
+RPM_SUSE_BUILDTOOLS_DEPS = autoconf automake bison ccache check-devel chrpath
+RPM_SUSE_BUILDTOOLS_DEPS += clang indent libtool make
+
+RPM_SUSE_DEVEL_DEPS = glibc-devel-static java-1_8_0-openjdk-devel libnuma-devel
+RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel
+
+RPM_SUSE_PYTHON_DEPS = python-devel python3-devel python-pip python3-pip
+RPM_SUSE_PYTHON_DEPS += python-rpm-macros python3-rpm-macros
+
+RPM_SUSE_PLATFORM_DEPS = distribution-release shadow rpm-build
+
+ifeq ($(OS_ID),opensuse)
+ifneq ($(SUSE_NAME),Tumbleweed)
+       RPM_SUSE_DEVEL_DEPS += boost_1_61-devel gcc6
+       RPM_SUSE_PYTHON_DEPS += python-virtualenv
 else
-       RPM_DEPENDS += lcov
+       RPM_SUSE_DEVEL_DEPS = libboost_headers-devel libboost_thread-devel gcc
+       RPM_SUSE_PYTHON_DEPS += python2-virtualenv
+endif
 endif
 
-RPM_SUSE_DEPENDS = autoconf automake bison ccache chrpath distribution-release gcc6 glibc-devel-static
-RPM_SUSE_DEPENDS += java-1_8_0-openjdk-devel libopenssl-devel libtool lsb-release make openssl-devel
-RPM_SUSE_DEPENDS += python-devel python-pip python-rpm-macros shadow
+RPM_SUSE_DEPENDS += $(RPM_SUSE_BUILDTOOLS_DEPS) $(RPM_SUSE_DEVEL_DEPS) $(RPM_SUSE_PYTHON_DEPS) $(RPM_SUSE_PLATFORM_DEPS)
 
 ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),)
         STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf
@@ -202,13 +236,9 @@ ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
        fi ; \
        exit 0
 else ifneq ("$(wildcard /etc/redhat-release)","")
-       @for i in $(RPM_DEPENDS) $(EPEL_DEPENDS) ; do \
+       @for i in $(RPM_DEPENDS) ; do \
            RPM=$$(basename -s .rpm "$${i##*/}" | cut -d- -f1,2,3)  ;   \
-           if [[ "$$RPM" =~ "epel-release-latest" ]] ; then            \
-               MISSING+=$$(rpm -q epel-release | grep "^package") ;    \
-           else                                                        \
-               MISSING+=$$(rpm -q $$RPM | grep "^package")        ;    \
-           fi                                                     ;    \
+           MISSING+=$$(rpm -q $$RPM | grep "^package")    ;    \
        done                                                       ;    \
        if [ -n "$$MISSING" ] ; then \
          echo "Please install missing RPMs: \n$$MISSING\n" ; \
@@ -251,12 +281,12 @@ endif
 else ifneq ("$(wildcard /etc/redhat-release)","")
        @sudo -E yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
        @sudo -E yum install $(CONFIRM) $(RPM_DEPENDS)
-       @sudo -E yum install $(CONFIRM) --enablerepo=epel $(EPEL_DEPENDS)
        @sudo -E debuginfo-install $(CONFIRM) glibc openssl-libs zlib
 else ifeq ($(filter opensuse,$(OS_ID)),$(OS_ID))
-       @sudo -E zypper -n install -y $(RPM_SUSE_DEPENDS)
+       @sudo -E zypper refresh
+       @sudo -E zypper install -y $(RPM_SUSE_DEPENDS)
 else
-       $(error "This option currently works only on Ubuntu, Debian or Centos systems")
+       $(error "This option currently works only on Ubuntu, Debian, Centos or openSUSE systems")
 endif
 
 define make
@@ -300,7 +330,7 @@ build: $(BR)/.bootstrap.ok
 wipedist:
        @$(RM) $(BR)/*.tar.xz
 
-wipe: wipedist $(BR)/.bootstrap.ok
+wipe: wipedist test-wipe $(BR)/.bootstrap.ok
        $(call make,$(PLATFORM)_debug,$(addsuffix -wipe,$(TARGETS)))
 
 rebuild: wipe build
@@ -308,7 +338,7 @@ rebuild: wipe build
 build-release: $(BR)/.bootstrap.ok
        $(call make,$(PLATFORM),$(addsuffix -install,$(TARGETS)))
 
-wipe-release: $(BR)/.bootstrap.ok
+wipe-release: test-wipe $(BR)/.bootstrap.ok
        $(call make,$(PLATFORM),$(addsuffix -wipe,$(TARGETS)))
 
 rebuild-release: wipe-release build-release
@@ -329,6 +359,8 @@ define test
          LD_LIBRARY_PATH=$(call libexpand,$(libs),$(2),) \
          EXTENDED_TESTS=$(EXTENDED_TESTS) \
          PYTHON=$(PYTHON) \
+         OS_ID=$(OS_ID) \
+         CACHE_OUTPUT=$(CACHE_OUTPUT) \
          $(3)
 endef
 
@@ -431,6 +463,9 @@ pkg-deb:
 pkg-rpm: dist
        make -C extras/rpm
 
+pkg-srpm: dist
+       make -C extras/rpm srpm
+
 dpdk-install-dev:
        make -C dpdk install-$(PKG)
 
@@ -494,7 +529,7 @@ endif
        $(call banner,"Building $(PKG) packages")
        @make pkg-$(PKG)
 ifeq ($(OS_ID)-$(OS_VERSION_ID),ubuntu-16.04)
-       @make test
+       @make COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
 endif