summaryrefslogtreecommitdiffstats
path: root/src/spdk/mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/spdk/mk
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/spdk/mk')
-rw-r--r--src/spdk/mk/nvme.libtest.mk49
-rw-r--r--src/spdk/mk/spdk.app.mk70
-rw-r--r--src/spdk/mk/spdk.app_cxx.mk69
-rw-r--r--src/spdk/mk/spdk.app_vars.mk51
-rw-r--r--src/spdk/mk/spdk.common.mk385
-rw-r--r--src/spdk/mk/spdk.deps.mk36
-rw-r--r--src/spdk/mk/spdk.fio.mk63
-rw-r--r--src/spdk/mk/spdk.lib.mk113
-rw-r--r--src/spdk/mk/spdk.lib_deps.mk174
-rw-r--r--src/spdk/mk/spdk.mock.unittest.mk39
-rw-r--r--src/spdk/mk/spdk.modules.mk119
-rw-r--r--src/spdk/mk/spdk.nvmecli.mk108
-rw-r--r--src/spdk/mk/spdk.subdirs.mk50
-rw-r--r--src/spdk/mk/spdk.unittest.mk82
-rw-r--r--src/spdk/mk/spdk_blank.map6
15 files changed, 1414 insertions, 0 deletions
diff --git a/src/spdk/mk/nvme.libtest.mk b/src/spdk/mk/nvme.libtest.mk
new file mode 100644
index 000000000..e7dc24c70
--- /dev/null
+++ b/src/spdk/mk/nvme.libtest.mk
@@ -0,0 +1,49 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+NVME_DIR := $(SPDK_ROOT_DIR)/lib/nvme
+
+include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
+include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
+
+C_SRCS := $(APP:%=%.c)
+
+# Unable to combine the FIO plugin and the VPP socket abstraction (license incompatibility)
+SPDK_LIB_LIST = $(filter-out sock_vpp,$(SOCK_MODULES_LIST))
+SPDK_LIB_LIST += nvme thread util log sock vmd jsonrpc json rpc
+
+ifeq ($(CONFIG_RDMA),y)
+SPDK_LIB_LIST += rdma
+endif
+
+include $(SPDK_ROOT_DIR)/mk/spdk.app.mk
diff --git a/src/spdk/mk/spdk.app.mk b/src/spdk/mk/spdk.app.mk
new file mode 100644
index 000000000..f6fb17a1f
--- /dev/null
+++ b/src/spdk/mk/spdk.app.mk
@@ -0,0 +1,70 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include $(SPDK_ROOT_DIR)/mk/spdk.app_vars.mk
+
+# Applications in app/ go into build/bin/.
+# Applications in examples/ go into build/examples/.
+# Use findstring to identify if the current directory is in the app
+# or examples directory. If it is, change the APP location.
+APP_NAME := $(notdir $(APP))
+ifneq (,$(findstring $(SPDK_ROOT_DIR)/app,$(CURDIR)))
+ APP := $(APP_NAME:%=$(SPDK_ROOT_DIR)/build/bin/%)
+else
+ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR)))
+ APP := $(APP_NAME:%=$(SPDK_ROOT_DIR)/build/examples/%)
+endif
+endif
+
+LIBS += $(SPDK_LIB_LINKER_ARGS)
+
+CLEAN_FILES = $(APP)
+
+all : $(APP)
+ @:
+
+install: empty_rule
+
+uninstall: empty_rule
+
+# To avoid overwriting warning
+empty_rule:
+ @:
+
+$(APP) : $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
+ $(LINK_C)
+
+clean :
+ $(CLEAN_C) $(CLEAN_FILES)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
diff --git a/src/spdk/mk/spdk.app_cxx.mk b/src/spdk/mk/spdk.app_cxx.mk
new file mode 100644
index 000000000..d035a18e1
--- /dev/null
+++ b/src/spdk/mk/spdk.app_cxx.mk
@@ -0,0 +1,69 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+include $(SPDK_ROOT_DIR)/mk/spdk.app_vars.mk
+
+# Applications in app/ go into build/bin/.
+# Applications in examples/ go into build/examples/.
+# Use findstring to identify if the current directory is in the app
+# directory. If it is, change the APP location to build.
+APP_NAME := $(notdir $(APP))
+ifneq (,$(findstring $(SPDK_ROOT_DIR)/app,$(CURDIR)))
+ APP := $(APP_NAME:%=$(SPDK_ROOT_DIR)/build/bin/%)
+else
+ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR)))
+ APP := $(APP_NAME:%=$(SPDK_ROOT_DIR)/build/examples/%)
+endif
+endif
+
+LIBS += $(SPDK_LIB_LINKER_ARGS)
+
+CLEAN_FILES = $(APP)
+
+all : $(APP)
+ @:
+
+install: empty_rule
+
+uninstall: empty_rule
+
+# To avoid overwriting warning
+empty_rule:
+ @:
+
+$(APP) : $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
+ $(LINK_CXX)
+
+clean :
+ $(CLEAN_C) $(CLEAN_FILES)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
diff --git a/src/spdk/mk/spdk.app_vars.mk b/src/spdk/mk/spdk.app_vars.mk
new file mode 100644
index 000000000..fb1b3b1e3
--- /dev/null
+++ b/src/spdk/mk/spdk.app_vars.mk
@@ -0,0 +1,51 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SPDK_LIB_FILES = $(call spdk_lib_list_to_static_libs,$(SPDK_LIB_LIST))
+SPDK_LIB_LINKER_ARGS = \
+ -L$(SPDK_ROOT_DIR)/build/lib \
+ -Wl,--whole-archive \
+ -Wl,--no-as-needed \
+ $(SPDK_LIB_LIST:%=-lspdk_%) \
+ -Wl,--no-whole-archive
+
+# This is primarily used for unit tests to ensure they link when shared library
+# build is enabled. Shared libraries can't get their mock implementation from
+# the unit test file. Note that even for unittests, we must include the mock
+# library with whole-archive, to keep its functions from getting stripped out
+# when LTO is enabled.
+SPDK_STATIC_LIB_LINKER_ARGS = \
+ $(SPDK_LIB_LIST:%=$(SPDK_ROOT_DIR)/build/lib/libspdk_%.a) \
+ -Wl,--whole-archive \
+ $(SPDK_ROOT_DIR)/build/lib/libspdk_ut_mock.a \
+ -Wl,--no-whole-archive
diff --git a/src/spdk/mk/spdk.common.mk b/src/spdk/mk/spdk.common.mk
new file mode 100644
index 000000000..e53e6ff76
--- /dev/null
+++ b/src/spdk/mk/spdk.common.mk
@@ -0,0 +1,385 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# Copyright (c) 2017, IBM Corporation.
+# Copyright (c) 2019, Mellanox Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ifeq ($(wildcard $(SPDK_ROOT_DIR)/mk/config.mk),)
+$(error mk/config.mk: file not found. Please run configure before make)
+endif
+
+include $(SPDK_ROOT_DIR)/mk/config.mk
+-include $(SPDK_ROOT_DIR)/mk/cc.flags.mk
+-include $(SPDK_ROOT_DIR)/mk/cc.mk
+
+ifneq ($(V),1)
+Q ?= @
+endif
+S ?= $(notdir $(CURDIR))
+
+DESTDIR?=
+
+ifneq ($(prefix),)
+CONFIG_PREFIX=$(prefix)
+endif
+
+bindir?=$(CONFIG_PREFIX)/bin
+libdir?=$(CONFIG_PREFIX)/lib
+includedir?=$(CONFIG_PREFIX)/include
+
+ifeq ($(MAKECMDGOALS),)
+MAKECMDGOALS=$(.DEFAULT_GOAL)
+endif
+
+TARGET_TRIPLET := $(shell $(CC) -dumpmachine)
+TARGET_TRIPLET_WORDS := $(subst -, ,$(TARGET_TRIPLET))
+
+ifneq ($(filter linux%,$(TARGET_TRIPLET_WORDS)),)
+OS = Linux
+endif
+ifneq ($(filter freebsd%,$(TARGET_TRIPLET_WORDS)),)
+OS = FreeBSD
+endif
+
+TARGET_ARCHITECTURE ?= $(CONFIG_ARCH)
+TARGET_MACHINE := $(firstword $(TARGET_TRIPLET_WORDS))
+
+COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -fno-strict-aliasing -I$(SPDK_ROOT_DIR)/include
+
+ifneq ($(filter powerpc%,$(TARGET_MACHINE)),)
+COMMON_CFLAGS += -mcpu=$(TARGET_ARCHITECTURE)
+else ifeq ($(TARGET_MACHINE),aarch64)
+ifeq ($(TARGET_ARCHITECTURE),native)
+COMMON_CFLAGS += -march=armv8-a+crc
+else
+COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE)
+endif
+COMMON_CFLAGS += -DPAGE_SIZE=$(shell getconf PAGESIZE)
+else
+COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE)
+endif
+
+ifeq ($(CONFIG_WERROR), y)
+COMMON_CFLAGS += -Werror
+endif
+
+ifeq ($(CONFIG_LTO),y)
+COMMON_CFLAGS += -flto
+LDFLAGS += -flto
+endif
+
+ifeq ($(CONFIG_PGO_CAPTURE),y)
+COMMON_CFLAGS += -fprofile-generate=$(SPDK_ROOT_DIR)/build/pgo
+LDFLAGS += -fprofile-generate=$(SPDK_ROOT_DIR)/build/pgo
+endif
+
+ifeq ($(CONFIG_PGO_USE),y)
+COMMON_CFLAGS += -fprofile-use=$(SPDK_ROOT_DIR)/build/pgo
+LDFLAGS += -fprofile-use=$(SPDK_ROOT_DIR)/build/pgo
+endif
+
+COMMON_CFLAGS += -Wformat -Wformat-security
+
+COMMON_CFLAGS += -D_GNU_SOURCE
+
+# Always build PIC code so that objects can be used in shared libs and position-independent executables
+COMMON_CFLAGS += -fPIC
+
+# Enable stack buffer overflow checking
+COMMON_CFLAGS += -fstack-protector
+
+# Prevent accidental multiple definitions of global variables
+COMMON_CFLAGS += -fno-common
+
+# Enable full RELRO - no lazy relocation (resolve everything at load time).
+# This allows the GOT to be made read-only early in the loading process.
+LDFLAGS += -Wl,-z,relro,-z,now
+
+# Make the stack non-executable.
+# This is the default in most environments, but it doesn't hurt to set it explicitly.
+LDFLAGS += -Wl,-z,noexecstack
+
+# Specify the linker to use
+ifneq ($(LD_TYPE),)
+LDFLAGS += -fuse-ld=$(LD_TYPE)
+endif
+
+ifeq ($(OS),FreeBSD)
+SYS_LIBS += -L/usr/local/lib
+COMMON_CFLAGS += -I/usr/local/include
+endif
+
+# Attach only if PMDK lib specified with configure
+ifneq ($(CONFIG_PMDK_DIR),)
+LIBS += -L$(CONFIG_PMDK_DIR)/src/nondebug
+COMMON_CFLAGS += -I$(CONFIG_PMDK_DIR)/src/include
+endif
+
+ifneq ($(CONFIG_VPP_DIR),)
+LIBS += -L$(CONFIG_VPP_DIR)/lib64
+COMMON_CFLAGS += -I$(CONFIG_VPP_DIR)/include
+endif
+
+ifeq ($(CONFIG_RDMA),y)
+SYS_LIBS += -libverbs -lrdmacm
+endif
+
+ifeq ($(CONFIG_URING),y)
+SYS_LIBS += -luring
+ifneq ($(strip $(CONFIG_URING_PATH)),)
+CFLAGS += -I$(CONFIG_URING_PATH)
+LDFLAGS += -L$(CONFIG_URING_PATH)
+endif
+endif
+
+IPSEC_MB_DIR=$(SPDK_ROOT_DIR)/intel-ipsec-mb
+
+ISAL_DIR=$(SPDK_ROOT_DIR)/isa-l
+ifeq ($(CONFIG_ISAL), y)
+SYS_LIBS += -L$(ISAL_DIR)/.libs -lisal
+COMMON_CFLAGS += -I$(ISAL_DIR)/..
+endif
+
+#Attach only if FreeBSD and RDMA is specified with configure
+ifeq ($(OS),FreeBSD)
+ifeq ($(CONFIG_RDMA),y)
+# Mellanox - MLX4 HBA Userspace Library
+ifneq ("$(wildcard /usr/lib/libmlx4.*)","")
+SYS_LIBS += -lmlx4
+endif
+# Mellanox - MLX5 HBA Userspace Library
+ifneq ("$(wildcard /usr/lib/libmlx5.*)","")
+SYS_LIBS += -lmlx5
+endif
+# Chelsio HBA Userspace Library
+ifneq ("$(wildcard /usr/lib/libcxgb4.*)","")
+SYS_LIBS += -lcxgb4
+endif
+endif
+endif
+
+ifeq ($(CONFIG_DEBUG), y)
+COMMON_CFLAGS += -DDEBUG -O0 -fno-omit-frame-pointer
+else
+COMMON_CFLAGS += -DNDEBUG -O2
+# Enable _FORTIFY_SOURCE checks - these only work when optimizations are enabled.
+COMMON_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+endif
+
+ifeq ($(CONFIG_COVERAGE), y)
+COMMON_CFLAGS += -fprofile-arcs -ftest-coverage
+LDFLAGS += -fprofile-arcs -ftest-coverage
+ifeq ($(OS),FreeBSD)
+LDFLAGS += --coverage
+endif
+endif
+
+include $(CONFIG_ENV)/env.mk
+
+ifeq ($(CONFIG_ASAN),y)
+COMMON_CFLAGS += -fsanitize=address
+LDFLAGS += -fsanitize=address
+endif
+
+ifeq ($(CONFIG_UBSAN),y)
+COMMON_CFLAGS += -fsanitize=undefined
+LDFLAGS += -fsanitize=undefined
+endif
+
+ifeq ($(CONFIG_TSAN),y)
+COMMON_CFLAGS += -fsanitize=thread
+LDFLAGS += -fsanitize=thread
+endif
+
+SPDK_GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
+ifneq (, $(SPDK_GIT_COMMIT))
+COMMON_CFLAGS += -DSPDK_GIT_COMMIT=$(SPDK_GIT_COMMIT)
+endif
+
+COMMON_CFLAGS += -pthread
+LDFLAGS += -pthread
+
+CFLAGS += $(COMMON_CFLAGS) -Wno-pointer-sign -Wstrict-prototypes -Wold-style-definition -std=gnu99
+CXXFLAGS += $(COMMON_CFLAGS)
+
+SYS_LIBS += -lrt
+SYS_LIBS += -luuid
+SYS_LIBS += -lcrypto
+
+ifneq ($(CONFIG_NVME_CUSE)$(CONFIG_FUSE),nn)
+SYS_LIBS += -lfuse3
+endif
+
+MAKEFLAGS += --no-print-directory
+
+C_SRCS += $(C_SRCS-y)
+CXX_SRCS += $(CXX_SRCS-y)
+
+OBJS = $(C_SRCS:.c=.o) $(CXX_SRCS:.cpp=.o)
+
+DEPFLAGS = -MMD -MP -MF $*.d.tmp
+
+# Compile first input $< (.c) into $@ (.o)
+COMPILE_C=\
+ $(Q)echo " CC $S/$@"; \
+ $(CC) -o $@ $(DEPFLAGS) $(CFLAGS) -c $< && \
+ mv -f $*.d.tmp $*.d && touch -c $@
+
+COMPILE_CXX=\
+ $(Q)echo " CXX $S/$@"; \
+ $(CXX) -o $@ $(DEPFLAGS) $(CXXFLAGS) -c $< && \
+ mv -f $*.d.tmp $*.d && touch -c $@
+
+# Link $(OBJS) and $(LIBS) into $@ (app)
+LINK_C=\
+ $(Q)echo " LINK $(notdir $@)"; \
+ $(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LINKER_ARGS) $(SYS_LIBS)
+
+LINK_CXX=\
+ $(Q)echo " LINK $(notdir $@)"; \
+ $(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LINKER_ARGS) $(SYS_LIBS)
+
+# Provide function to ease build of a shared lib
+define spdk_build_realname_shared_lib
+ $(CC) -o $@ -shared $(CPPFLAGS) $(LDFLAGS) \
+ -Wl,--soname,$(notdir $@) \
+ -Wl,--whole-archive $(1) -Wl,--no-whole-archive \
+ -Wl,--version-script=$(2) \
+ $(3)
+endef
+
+BUILD_LINKERNAME_LIB=\
+ ln -sf $(notdir $<) $@
+
+# Archive $(OBJS) into $@ (.a)
+LIB_C=\
+ $(Q)echo " LIB $(notdir $@)"; \
+ rm -f $@; \
+ $(CCAR) crDs $@ $(OBJS)
+
+# Clean up generated files listed as arguments plus a default list
+CLEAN_C=\
+ $(Q)rm -f *.a *.o *.d *.d.tmp *.gcno *.gcda
+
+# Install a library
+INSTALL_LIB=\
+ $(Q)echo " INSTALL $(DESTDIR)$(libdir)/$(notdir $(LIB))"; \
+ install -d -m 755 "$(DESTDIR)$(libdir)"; \
+ install -m 644 "$(LIB)" "$(DESTDIR)$(libdir)/"
+
+# Uninstall a library
+UNINSTALL_LIB=\
+ $(Q)echo " UNINSTALL $(DESTDIR)$(libdir)/$(notdir $(LIB))";\
+ rm -f "$(DESTDIR)$(libdir)/$(notdir $(LIB))"; \
+ if [ -d "$(DESTDIR)$(libdir)" ] && [ $$(ls -A "$(DESTDIR)$(libdir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(libdir)"; fi
+
+ifeq ($(OS),FreeBSD)
+INSTALL_REL_SYMLINK := install -l rs
+else
+INSTALL_REL_SYMLINK := ln -sf -r
+endif
+
+define spdk_install_lib_symlink
+ $(INSTALL_REL_SYMLINK) $(DESTDIR)$(libdir)/$(1) $(DESTDIR)$(libdir)/$(2)
+endef
+
+INSTALL_SHARED_LIB=\
+ $(Q)echo " INSTALL $(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \
+ install -d -m 755 "$(DESTDIR)$(libdir)"; \
+ if file --mime-type $(SHARED_REALNAME_LIB) | grep -q 'application/x-sharedlib'; then \
+ perm_mode=755; \
+ else \
+ perm_mode=644; \
+ fi; \
+ install -m $$perm_mode "$(SHARED_REALNAME_LIB)" "$(DESTDIR)$(libdir)/"; \
+ $(call spdk_install_lib_symlink,$(notdir $(SHARED_REALNAME_LIB)),$(notdir $(SHARED_LINKED_LIB)));
+
+# Uninstall an shared library
+UNINSTALL_SHARED_LIB=\
+ $(Q)echo " UNINSTALL $(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \
+ rm -f "$(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \
+ rm -f "$(DESTDIR)$(libdir)/$(notdir $(SHARED_REALNAME_LIB))"; \
+ if [ -d "$(DESTDIR)$(libdir)" ] && [ $$(ls -A "$(DESTDIR)$(libdir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(libdir)"; fi
+
+
+# Install an app binary
+INSTALL_APP=\
+ $(Q)echo " INSTALL $(DESTDIR)$(bindir)/$(notdir $<)"; \
+ install -d -m 755 "$(DESTDIR)$(bindir)"; \
+ install -m 755 "$<" "$(DESTDIR)$(bindir)/"
+
+# Uninstall an app binary
+UNINSTALL_APP=\
+ $(Q)echo " UNINSTALL $(DESTDIR)$(bindir)/$(notdir $(APP))"; \
+ rm -f "$(DESTDIR)$(bindir)/$(notdir $(APP))"; \
+ if [ -d "$(DESTDIR)$(bindir)" ] && [ $$(ls -A "$(DESTDIR)$(bindir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(bindir)"; fi
+
+INSTALL_EXAMPLE=\
+ $(Q)echo " INSTALL $(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \
+ install -d -m 755 "$(DESTDIR)$(bindir)"; \
+ install -m 755 "$<" "$(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"
+
+# Uninstall an example binary
+UNINSTALL_EXAMPLE=\
+ $(Q)echo " UNINSTALL $(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \
+ rm -f "$(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \
+ if [ -d "$(DESTDIR)$(bindir)" ] && [ $$(ls -A "$(DESTDIR)$(bindir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(bindir)"; fi
+
+# Install a header
+INSTALL_HEADER=\
+ $(Q)echo " INSTALL $@"; \
+ install -d -m 755 "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))"; \
+ install -m 644 "$(patsubst $(DESTDIR)$(includedir)/%,%,$@)" "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))";
+
+# Uninstall a header
+UNINSTALL_HEADER=\
+ $(Q)echo " UNINSTALL $@"; \
+ rm -rf "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))$(notdir $@)"; \
+ if [ -d "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))" ] \
+ && [ $$(ls -A "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))" | wc -l) -eq 0 ]; \
+ then rm -rf "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))"; fi
+
+%.o: %.c %.d $(MAKEFILE_LIST)
+ $(COMPILE_C)
+
+%.o: %.cpp %.d $(MAKEFILE_LIST)
+ $(COMPILE_CXX)
+
+%.d: ;
+
+define spdk_lib_list_to_static_libs
+$(1:%=$(SPDK_ROOT_DIR)/build/lib/libspdk_%.a)
+endef
+
+define spdk_lib_list_to_shared_libs
+$(1:%=$(SPDK_ROOT_DIR)/build/lib/libspdk_%.so)
+endef
diff --git a/src/spdk/mk/spdk.deps.mk b/src/spdk/mk/spdk.deps.mk
new file mode 100644
index 000000000..aef9792fa
--- /dev/null
+++ b/src/spdk/mk/spdk.deps.mk
@@ -0,0 +1,36 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.PRECIOUS: $(OBJS)
+
+-include $(OBJS:.o=.d)
diff --git a/src/spdk/mk/spdk.fio.mk b/src/spdk/mk/spdk.fio.mk
new file mode 100644
index 000000000..6aff4a0a7
--- /dev/null
+++ b/src/spdk/mk/spdk.fio.mk
@@ -0,0 +1,63 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include $(SPDK_ROOT_DIR)/mk/spdk.app_vars.mk
+
+# Plugins go into build/example/
+FIO_PLUGIN := $(SPDK_ROOT_DIR)/build/fio/$(notdir $(FIO_PLUGIN))
+
+LIBS += $(SPDK_LIB_LINKER_ARGS)
+
+CFLAGS += -I$(CONFIG_FIO_SOURCE_DIR)
+LDFLAGS += -shared -rdynamic -Wl,-z,nodelete
+
+CLEAN_FILES = $(FIO_PLUGIN)
+
+all : $(FIO_PLUGIN)
+ @:
+
+install: empty_rule
+
+uninstall: empty_rule
+
+# To avoid overwriting warning
+empty_rule:
+ @:
+
+$(FIO_PLUGIN) : $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
+ $(LINK_C)
+
+clean :
+ $(CLEAN_C) $(CLEAN_FILES)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
diff --git a/src/spdk/mk/spdk.lib.mk b/src/spdk/mk/spdk.lib.mk
new file mode 100644
index 000000000..926c82bcc
--- /dev/null
+++ b/src/spdk/mk/spdk.lib.mk
@@ -0,0 +1,113 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
+include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk
+
+
+ifeq ($(SPDK_MAP_FILE),)
+$(error SPDK_MAP_FILE is not set for lib $(LIBNAME))
+endif
+
+ifeq ($(SO_VER),)
+$(error SO major version is not set for lib $(LIBNAME))
+endif
+
+ifeq ($(SO_MINOR),)
+$(error SO minor version is not set for lib $(LIBNAME))
+endif
+
+
+SO_SUFFIX := $(SO_VER).$(SO_MINOR)
+LIB := $(call spdk_lib_list_to_static_libs,$(LIBNAME))
+SHARED_LINKED_LIB := $(LIB:.a=.so)
+SHARED_REALNAME_LIB := $(SHARED_LINKED_LIB:.so=.so.$(SO_SUFFIX))
+
+ifeq ($(CONFIG_SHARED),y)
+DEP := $(SHARED_LINKED_LIB)
+else
+DEP := $(LIB)
+endif
+
+ifeq ($(OS),FreeBSD)
+LOCAL_SYS_LIBS += -L/usr/local/lib -lrt
+else
+LOCAL_SYS_LIBS += -lrt
+endif
+
+define subdirs_rule
+$(1): $(2)
+ @+$(Q)$(MAKE) -C $(1) S=$S$(S:%=/)$@ $(MAKECMDGOALS)
+endef
+
+$(foreach dir,$(DIRS-y),$(eval $(call subdirs_rule,$(dir),$(DEP))))
+
+ifneq ($(DIRS-y),)
+BUILD_DEP := $(DIRS-y)
+else
+BUILD_DEP := $(DEP)
+endif
+
+SPDK_DEP_LIBS = $(call spdk_lib_list_to_shared_libs,$(DEPDIRS-$(LIBNAME)))
+
+.PHONY: all clean $(DIRS-y)
+
+all: $(BUILD_DEP)
+ @:
+
+clean: $(DIRS-y)
+ $(CLEAN_C) $(LIB) $(SHARED_LINKED_LIB) $(SHARED_REALNAME_LIB)
+
+$(SHARED_LINKED_LIB): $(SHARED_REALNAME_LIB)
+ $(Q)echo " SYMLINK $(notdir $@)"; $(BUILD_LINKERNAME_LIB)
+
+$(SHARED_REALNAME_LIB): $(LIB)
+ $(Q)echo " SO $(notdir $@)"; \
+ $(call spdk_build_realname_shared_lib,$^,$(SPDK_MAP_FILE),$(LOCAL_SYS_LIBS) $(SPDK_DEP_LIBS))
+
+$(LIB): $(OBJS)
+ $(LIB_C)
+
+install: all
+ $(INSTALL_LIB)
+ifeq ($(CONFIG_SHARED),y)
+ $(INSTALL_SHARED_LIB)
+endif
+
+uninstall: $(DIRS-y)
+ $(UNINSTALL_LIB)
+ifeq ($(CONFIG_SHARED),y)
+ $(UNINSTALL_SHARED_LIB)
+endif
+
+include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
diff --git a/src/spdk/mk/spdk.lib_deps.mk b/src/spdk/mk/spdk.lib_deps.mk
new file mode 100644
index 000000000..be57bb220
--- /dev/null
+++ b/src/spdk/mk/spdk.lib_deps.mk
@@ -0,0 +1,174 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# A quick note on organization:
+#
+# Each grouping is independent from itself. it depends only on libraries
+# in the grouping above it. All dependencies are listed alphabetically within
+# groups. The only exception to this is the JSON_LIBS grouping which is a special
+# case since they almost always occur together.
+
+JSON_LIBS := json jsonrpc rpc
+
+DEPDIRS-env_ocf :=
+DEPDIRS-log :=
+DEPDIRS-rte_vhost :=
+
+DEPDIRS-ioat := log
+DEPDIRS-idxd := log util
+DEPDIRS-sock := log $(JSON_LIBS)
+DEPDIRS-util := log
+DEPDIRS-vmd := log
+
+DEPDIRS-conf := log util
+DEPDIRS-json := log util
+DEPDIRS-rdma := log util
+DEPDIRS-reduce := log util
+DEPDIRS-thread := log util
+
+DEPDIRS-nvme := log sock util
+ifeq ($(CONFIG_RDMA),y)
+DEPDIRS-nvme += rdma
+endif
+
+DEPDIRS-blob := log util thread
+DEPDIRS-accel := log util thread json
+DEPDIRS-jsonrpc := log util json
+DEPDIRS-virtio := log util json thread
+
+DEPDIRS-lvol := log util blob
+DEPDIRS-rpc := log util json jsonrpc
+
+DEPDIRS-log_rpc := log $(JSON_LIBS)
+DEPDIRS-net := log util $(JSON_LIBS)
+DEPDIRS-notify := log util $(JSON_LIBS)
+DEPDIRS-trace := log util $(JSON_LIBS)
+
+DEPDIRS-bdev := log util conf thread $(JSON_LIBS) notify trace
+DEPDIRS-blobfs := log conf thread blob trace
+DEPDIRS-event := log util conf thread $(JSON_LIBS) trace
+
+DEPDIRS-ftl := log util thread trace bdev
+DEPDIRS-nbd := log util thread $(JSON_LIBS) bdev
+DEPDIRS-nvmf := log sock util nvme thread $(JSON_LIBS) trace bdev
+ifeq ($(CONFIG_RDMA),y)
+DEPDIRS-nvmf += rdma
+endif
+DEPDIRS-scsi := log util thread $(JSON_LIBS) trace bdev
+
+DEPDIRS-iscsi := log sock util conf thread $(JSON_LIBS) trace event scsi
+DEPDIRS-vhost = log util conf thread $(JSON_LIBS) bdev scsi
+ifeq ($(CONFIG_VHOST_INTERNAL_LIB),y)
+DEPDIRS-vhost += rte_vhost
+endif
+
+# ------------------------------------------------------------------------
+# Start module/ directory - This section extends the organizational pattern from
+# above. However, it introduces several more groupings which may not strictly follow
+# the ordering pattern above. These are used for convenience and to help quickly
+# determine the unique dependencies of a given module. It is also grouped by directory.
+
+BDEV_DEPS = log util $(JSON_LIBS) bdev
+BDEV_DEPS_CONF = $(BDEV_DEPS) conf
+BDEV_DEPS_THREAD = $(BDEV_DEPS) thread
+BDEV_DEPS_CONF_THREAD = $(BDEV_DEPS) conf thread
+
+# module/blob
+DEPDIRS-blob_bdev := log thread bdev
+
+# module/blobfs
+DEPDIRS-blobfs_bdev := $(BDEV_DEPS_THREAD) blob_bdev blobfs
+
+# module/accel
+DEPDIRS-accel_ioat := log ioat conf thread $(JSON_LIBS) accel util
+DEPDIRS-accel_idxd := log idxd thread $(JSON_LIBS) accel
+
+# module/env_dpdk
+DEPDIRS-env_dpdk_rpc := log $(JSON_LIBS)
+
+# module/sock
+DEPDIRS-sock_posix := log sock util
+DEPDIRS-sock_uring := log sock util
+DEPDIRS-sock_vpp := log sock util thread
+
+# module/bdev
+DEPDIRS-bdev_gpt := bdev conf json log thread util
+
+DEPDIRS-bdev_lvol := $(BDEV_DEPS) lvol blob blob_bdev
+DEPDIRS-bdev_rpc := $(BDEV_DEPS)
+
+DEPDIRS-bdev_error := $(BDEV_DEPS_CONF)
+DEPDIRS-bdev_malloc := $(BDEV_DEPS_CONF) accel
+DEPDIRS-bdev_split := $(BDEV_DEPS_CONF)
+
+DEPDIRS-bdev_compress := $(BDEV_DEPS_THREAD) reduce
+DEPDIRS-bdev_delay := $(BDEV_DEPS_THREAD)
+DEPDIRS-bdev_zone_block := $(BDEV_DEPS_THREAD)
+ifeq ($(OS),Linux)
+DEPDIRS-bdev_ftl := $(BDEV_DEPS_THREAD) ftl
+endif
+
+DEPDIRS-bdev_aio := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_crypto := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_iscsi := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_null := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_nvme = $(BDEV_DEPS_CONF_THREAD) nvme
+DEPDIRS-bdev_ocf := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_passthru := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_pmem := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_raid := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_rbd := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_uring := $(BDEV_DEPS_CONF_THREAD)
+DEPDIRS-bdev_virtio := $(BDEV_DEPS_CONF_THREAD) virtio
+
+# module/event
+# module/event/app
+DEPDIRS-app_rpc := log util thread event $(JSON_LIBS)
+
+# module/event/subsystems
+# These depdirs include subsystem interdependencies which
+# are not related to symbols, but are defined directly in
+# the SPDK event subsystem code.
+DEPDIRS-event_accel := accel event
+DEPDIRS-event_net := sock net event
+DEPDIRS-event_vmd := vmd conf $(JSON_LIBS) event log thread
+
+DEPDIRS-event_bdev := bdev event event_accel event_vmd event_sock
+
+DEPDIRS-event_nbd := event nbd event_bdev
+DEPDIRS-event_nvmf := $(BDEV_DEPS_CONF_THREAD) event nvme nvmf event_bdev event_sock
+DEPDIRS-event_scsi := event scsi event_bdev
+
+DEPDIRS-event_iscsi := event iscsi event_scsi event_sock
+DEPDIRS-event_vhost := event vhost event_scsi
+DEPDIRS-event_sock := event sock
diff --git a/src/spdk/mk/spdk.mock.unittest.mk b/src/spdk/mk/spdk.mock.unittest.mk
new file mode 100644
index 000000000..90b28cf4d
--- /dev/null
+++ b/src/spdk/mk/spdk.mock.unittest.mk
@@ -0,0 +1,39 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+LDFLAGS += \
+ -Wl,--wrap,calloc \
+ -Wl,--wrap,pthread_mutexattr_init \
+ -Wl,--wrap,pthread_mutex_init \
+ -Wl,--wrap,recvmsg \
+ -Wl,--wrap,sendmsg \
+ -Wl,--wrap,writev
diff --git a/src/spdk/mk/spdk.modules.mk b/src/spdk/mk/spdk.modules.mk
new file mode 100644
index 000000000..2714defc1
--- /dev/null
+++ b/src/spdk/mk/spdk.modules.mk
@@ -0,0 +1,119 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+BLOCKDEV_MODULES_LIST = bdev_malloc bdev_null bdev_nvme bdev_passthru bdev_lvol
+BLOCKDEV_MODULES_LIST += bdev_raid bdev_error bdev_gpt bdev_split bdev_delay
+BLOCKDEV_MODULES_LIST += bdev_zone_block
+BLOCKDEV_MODULES_LIST += blobfs blob_bdev blob lvol vmd nvme
+
+ifeq ($(CONFIG_CRYPTO),y)
+BLOCKDEV_MODULES_LIST += bdev_crypto
+endif
+
+ifeq ($(CONFIG_OCF),y)
+BLOCKDEV_MODULES_LIST += bdev_ocf
+BLOCKDEV_MODULES_LIST += ocfenv
+endif
+
+ifeq ($(CONFIG_REDUCE),y)
+BLOCKDEV_MODULES_LIST += bdev_compress reduce
+SYS_LIBS += -lpmem
+endif
+
+ifeq ($(CONFIG_RDMA),y)
+BLOCKDEV_MODULES_LIST += rdma
+SYS_LIBS += -libverbs -lrdmacm
+ifeq ($(CONFIG_RDMA_PROV),mlx5_dv)
+SYS_LIBS += -lmlx5
+endif
+endif
+
+ifeq ($(OS),Linux)
+BLOCKDEV_MODULES_LIST += bdev_ftl ftl
+BLOCKDEV_MODULES_LIST += bdev_aio
+SYS_LIBS += -laio
+ifeq ($(CONFIG_VIRTIO),y)
+BLOCKDEV_MODULES_LIST += bdev_virtio virtio
+endif
+ifeq ($(CONFIG_ISCSI_INITIATOR),y)
+BLOCKDEV_MODULES_LIST += bdev_iscsi
+# Fedora installs libiscsi to /usr/lib64/iscsi for some reason.
+SYS_LIBS += -L/usr/lib64/iscsi -liscsi
+endif
+endif
+
+ifeq ($(CONFIG_URING),y)
+BLOCKDEV_MODULES_LIST += bdev_uring
+SYS_LIBS += -luring
+ifneq ($(strip $(CONFIG_URING_PATH)),)
+CFLAGS += -I$(CONFIG_URING_PATH)
+LDFLAGS += -L$(CONFIG_URING_PATH)
+endif
+endif
+
+ifeq ($(CONFIG_RBD),y)
+BLOCKDEV_MODULES_LIST += bdev_rbd
+SYS_LIBS += -lrados -lrbd
+endif
+
+ifeq ($(CONFIG_PMDK),y)
+BLOCKDEV_MODULES_LIST += bdev_pmem
+SYS_LIBS += -lpmemblk -lpmem
+endif
+
+SOCK_MODULES_LIST = sock_posix
+
+ifeq ($(OS), Linux)
+ifeq ($(CONFIG_URING),y)
+SOCK_MODULES_LIST += sock_uring
+endif
+endif
+
+ifeq ($(CONFIG_VPP),y)
+SYS_LIBS += -Wl,--whole-archive
+ifneq ($(CONFIG_VPP_DIR),)
+SYS_LIBS += -L$(CONFIG_VPP_DIR)/lib
+endif
+SYS_LIBS += -lvppinfra -lsvm -lvlibmemoryclient
+SYS_LIBS += -Wl,--no-whole-archive
+SOCK_MODULES_LIST += sock_vpp
+endif
+
+ACCEL_MODULES_LIST = accel_ioat ioat
+ifeq ($(CONFIG_IDXD),y)
+ACCEL_MODULES_LIST += accel_idxd idxd
+endif
+
+EVENT_BDEV_SUBSYSTEM = event_bdev event_accel event_vmd event_sock
+
+ALL_MODULES_LIST = $(BLOCKDEV_MODULES_LIST) $(ACCEL_MODULES_LIST) $(SOCK_MODULES_LIST)
diff --git a/src/spdk/mk/spdk.nvmecli.mk b/src/spdk/mk/spdk.nvmecli.mk
new file mode 100644
index 000000000..eb04a71a3
--- /dev/null
+++ b/src/spdk/mk/spdk.nvmecli.mk
@@ -0,0 +1,108 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SPDK_ROOT_DIR ?= $(abspath $(CURDIR)/..)
+SPDK_LIB_DIR ?= $(SPDK_ROOT_DIR)/build/lib
+
+include $(SPDK_ROOT_DIR)/mk/config.mk
+
+DPDK_LIB_DIR ?= $(CONFIG_DPDK_DIR)/lib
+DPDK_LIB_LIST = -lrte_eal -lrte_mempool -lrte_ring -lrte_pci -lrte_bus_pci -lrte_mbuf
+
+ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_kvargs.*))
+DPDK_LIB_LIST += -lrte_kvargs
+endif
+
+ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_power.*))
+DPDK_LIB_LIST += -lrte_power
+endif
+
+ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_telemetry.*))
+DPDK_LIB_LIST += -lrte_telemetry
+endif
+
+NVMECLI_SPDK_LIBS = -lspdk_log -lspdk_sock -lspdk_nvme -lspdk_env_dpdk -lspdk_util -lspdk_jsonrpc -lspdk_json -lspdk_rpc
+
+ifeq ($(CONFIG_RDMA),y)
+NVMECLI_SPDK_LIBS += -lspdk_rdma
+endif
+
+ifeq ($(CONFIG_OCF),y)
+NVMECLI_SPDK_LIBS += -lspdk_ocfenv
+endif
+
+ifeq ($(CONFIG_VHOST),y)
+ifneq ($(CONFIG_VHOST_INTERNAL_LIB),y)
+DPDK_LIB_LIST += -lrte_vhost -lrte_net -lrte_cryptodev -lrte_hash
+else
+NVMECLI_SPDK_LIBS += -lrte_vhost
+endif
+endif
+
+override CFLAGS += -I$(SPDK_ROOT_DIR)/include
+override LDFLAGS += \
+ -Wl,--whole-archive \
+ -L$(SPDK_LIB_DIR) $(NVMECLI_SPDK_LIBS) \
+ -L$(DPDK_LIB_DIR) $(DPDK_LIB_LIST) \
+ -Wl,--no-whole-archive \
+ -ldl -pthread -lrt -lrdmacm -lnuma -libverbs
+
+ifeq ($(CONFIG_ISAL), y)
+ISAL_DIR=$(SPDK_ROOT_DIR)/isa-l
+override LDFLAGS += -L$(ISAL_DIR)/.libs -lisal
+override CFLAGS += -I$(ISAL_DIR)/..
+endif
+
+ifeq ($(CONFIG_ASAN),y)
+override CFLAGS += -fsanitize=address
+override LDFLAGS += -fsanitize=address
+endif
+
+ifeq ($(CONFIG_UBSAN),y)
+override CFLAGS += -fsanitize=undefined
+override LDFLAGS += -fsanitize=undefined
+endif
+
+ifeq ($(CONFIG_TSAN),y)
+override CFLAGS += -fsanitize=thread
+override LDFLAGS += -fsanitize=thread
+endif
+
+ifeq ($(CONFIG_COVERAGE), y)
+override CFLAGS += -fprofile-arcs -ftest-coverage
+override LDFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+ifeq ($(CONFIG_ISCSI_INITIATOR),y)
+override LDFLAGS += -L/usr/lib64/iscsi -liscsi
+endif
diff --git a/src/spdk/mk/spdk.subdirs.mk b/src/spdk/mk/spdk.subdirs.mk
new file mode 100644
index 000000000..2f7c09d81
--- /dev/null
+++ b/src/spdk/mk/spdk.subdirs.mk
@@ -0,0 +1,50 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
+define depdirs_rule
+$(DEPDIRS-$(1)):
+
+$(1): | $(DEPDIRS-$(1))
+
+endef
+
+$(DIRS-y) :
+ $(Q)$(MAKE) -C $@ S=$S$(S:%=/)$@ $(MAKECMDGOALS)
+
+$(foreach dir,$(ALL_DEPDIRS),$(eval $(call depdirs_rule,$(dir))))
+
+install: all $(DIRS-y)
+
+uninstall: $(DIRS-y)
diff --git a/src/spdk/mk/spdk.unittest.mk b/src/spdk/mk/spdk.unittest.mk
new file mode 100644
index 000000000..01d2bc3ec
--- /dev/null
+++ b/src/spdk/mk/spdk.unittest.mk
@@ -0,0 +1,82 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
+include $(SPDK_ROOT_DIR)/mk/spdk.app_vars.mk
+include $(SPDK_ROOT_DIR)/mk/spdk.mock.unittest.mk
+
+# We don't want to run scan-build against the unit tests
+# because it can't understand our mock function macros and
+# throws false positives because of them.
+
+# Scan-build inserts a phony compiler by overriding the value
+# of CC, so we store the original CC under DEFAULT_CC and
+# re-assign it here.
+override CC=$(DEFAULT_CC)
+
+C_SRCS = $(TEST_FILE)
+
+CFLAGS += -I$(SPDK_ROOT_DIR)/lib
+CFLAGS += -I$(SPDK_ROOT_DIR)/module
+CFLAGS += -I$(SPDK_ROOT_DIR)/test
+CFLAGS += -ffunction-sections
+LDFLAGS += -Wl,--gc-sections
+
+SPDK_LIB_LIST += thread util log
+
+LIBS += -lcunit $(SPDK_STATIC_LIB_LINKER_ARGS)
+
+APP = $(TEST_FILE:.c=)
+
+ifneq ($(UNIT_TEST_LINK_ENV),1)
+ENV_LINKER_ARGS =
+else
+# Rewrite the env linker args to be static.
+ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk)
+endif
+
+install: all
+
+all: $(APP)
+ @:
+
+$(APP) : $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
+ $(LINK_C)
+
+clean:
+ $(CLEAN_C) $(APP)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
+
+uninstall:
+ @:
diff --git a/src/spdk/mk/spdk_blank.map b/src/spdk/mk/spdk_blank.map
new file mode 100644
index 000000000..753ea5716
--- /dev/null
+++ b/src/spdk/mk/spdk_blank.map
@@ -0,0 +1,6 @@
+{
+ # This file is a placeholder map file
+ # for all libraries that don't currently
+ # export any symbols.
+ local: *;
+};