+MACHINE=$(shell uname -m)
+
+ISA_L_CRYPTO_LIB := n
+
+IPSEC_MB_VER ?= 0.46
+ISA_L_CRYPTO_VER := 2.18.0
+
+ifeq ($(MACHINE),$(filter $(MACHINE),x86_64))
+ AESNI ?= y
+# DPDK pre 17.08 depends on ISA-L Crypto library for GCM PMD
+ ifneq ($(firstword $(sort $(DPDK_VERSION), 17.08)), 17.08)
+ ISA_L_CRYPTO_LIB = y
+ IPSEC_MB_VER = 0.45
+ $(info Building ISA-L Crypto $(ISA_L_CRYPTO_VER) library)
+ endif
+$(info Building IPSec-MB $(IPSEC_MB_VER) library)
+else
+ AESNI ?= N
+endif
+
+AESNIMB_LIB_TARBALL := v$(IPSEC_MB_VER).tar.gz
+AESNIMB_LIB_TARBALL_URL := http://github.com/01org/intel-ipsec-mb/archive/$(AESNIMB_LIB_TARBALL)
+AESNIMB_LIB_SOURCE := $(B)/intel-ipsec-mb-$(IPSEC_MB_VER)
+
+ISA_L_CRYPTO_LIB_TARBALL := v$(ISA_L_CRYPTO_VER).tar.gz
+ISA_L_CRYPTO_LIB_TARBALL_URL := http://github.com/01org/isa-l_crypto/archive/$(ISA_L_CRYPTO_LIB_TARBALL)
+ISA_L_CRYPTO_LIB_SOURCE := $(B)/isa-l_crypto-$(ISA_L_CRYPTO_VER)
+ISA_L_CRYPTO_INSTALL_DIR := $(ISA_L_CRYPTO_LIB_SOURCE)/install
+
+ifneq (,$(findstring clang,$(CC)))
+DPDK_CC=clang
+else ifneq (,$(findstring icc,$(CC)))
+DPDK_CC=icc
+else
+DPDK_CC=gcc
+endif
+
+##############################################################################
+# Intel x86
+##############################################################################
+ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686))
+DPDK_TARGET ?= $(MACHINE)-native-linuxapp-$(DPDK_CC)
+DPDK_MACHINE ?= nhm
+DPDK_TUNE ?= core-avx2
+
+##############################################################################
+# ARM64
+##############################################################################
+else ifeq ($(MACHINE),aarch64)
+export CROSS=""
+DPDK_TARGET ?= arm64-armv8a-linuxapp-$(DPDK_CC)
+DPDK_MACHINE ?= armv8a
+DPDK_TUNE ?= generic
+
+CPU_IMP_ARM = 0x41
+CPU_IMP_CAVIUM = 0x43
+
+CPU_PART_ARM_CORTEX_A53 = 0xd03
+CPU_PART_ARM_CORTEX_A57 = 0xd07
+CPU_PART_ARM_CORTEX_A72 = 0xd08
+CPU_PART_ARM_CORTEX_A73 = 0xd09
+
+CPU_PART_CAVIUM_THUNDERX = 0x0a1
+CPU_PART_CAVIUM_THUNDERX_81XX = 0x0a2
+CPU_PART_CAVIUM_THUNDERX_83XX = 0x0a3
+
+MIDR_IMPLEMENTER=$(shell awk '/implementer/ {print $$4;exit}' /proc/cpuinfo)
+MIDR_PARTNUM=$(shell awk '/part/ {print $$4;exit}' /proc/cpuinfo)
+
+ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_ARM))
+##############################################################################
+# Arm Cortex
+##############################################################################
+CPU_PART_ARM_TUNE := $(CPU_PART_ARM_CORTEX_A53)/cortex-a53 \
+ $(CPU_PART_ARM_CORTEX_A57)/cortex-a57 \
+ $(CPU_PART_ARM_CORTEX_A72)/cortex-a72 \
+ $(CPU_PART_ARM_CORTEX_A73)/cortex-a73
+CPU_TUNE = $(notdir $(filter $(MIDR_PARTNUM)/%,$(CPU_PART_ARM_TUNE)))
+ifneq ($(CPU_TUNE),)
+DPDK_TUNE = $(CPU_TUNE)
+else
+$(warning Unknown Arm CPU)
+endif
+
+else ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_CAVIUM))
+##############################################################################
+# Cavium ThunderX
+##############################################################################
+ifneq (,$(findstring $(MIDR_PARTNUM),$(CPU_PART_CAVIUM_THUNDERX) \
+ $(CPU_PART_CAVIUM_THUNDERX_81XX) $(CPU_PART_CAVIUM_THUNDERX_83XX)))
+DPDK_TARGET = arm64-thunderx-linuxapp-$(DPDK_CC)
+DPDK_MACHINE = thunderx
+else
+$(warning Unknown Cavium CPU)
+endif
+endif
+
+##############################################################################
+# Unknown platform
+##############################################################################
+else
+$(error Unknown platform)
+endif
+
+# /proc/cpuinfo does not exist on platforms without a /proc and on some
+# platforms, notably inside containers, it has no content. In those cases
+# we assume there's 1 processor; we use 2*ncpu for the -j option.
+# NB: GNU Make 4.2 will let us use '$(file </proc/cpuinfo)' to both test
+# for file presence and content; for now this will have to do.
+JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
+ $(shell expr 2 '*' $$(grep -c ^processor /proc/cpuinfo)), 2)