env: Make the environment library configurable.

This allows users to swap out SPDK's third party
libraries for an implementation based on their own
framework.

Change-Id: Ia0b7384ce5e31acba5ad0d7002dec9e95b759c52
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-08-10 10:28:20 -07:00
parent a30b5532cb
commit a4747c6048
40 changed files with 165 additions and 128 deletions

7
CONFIG
View File

@ -43,9 +43,14 @@ CONFIG_COVERAGE?=n
# Build with Address Sanitizer enabled
CONFIG_ADDRESS_SANITIZER?=n
# Directory that contains the desired SPDK environment library.
# By default, this is implemented using DPDK.
CONFIG_ENV?=$(SPDK_ROOT_DIR)/lib/env
# This directory should contain 'include' and 'lib' directories for your DPDK
# installation. Alternatively you can specify this on the command line
# with 'make DPDK_DIR=/path/to/dpdk'.
# with 'make DPDK_DIR=/path/to/dpdk'. This is only a valid entry
# when using the default SPDK environment library.
CONFIG_DPDK_DIR?=/path/to/dpdk
# Header file to use for NVMe implementation specific functions.

View File

@ -37,7 +37,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP = iscsi_tgt
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
# Add iSCSI library directory to include path
# TODO: remove this once iSCSI has a public API header
@ -57,20 +57,19 @@ SPDK_LIBS = \
$(SPDK_ROOT_DIR)/lib/trace/libspdk_trace.a \
$(SPDK_ROOT_DIR)/lib/conf/libspdk_conf.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/log/rpc/libspdk_log_rpc.a \
$(SPDK_ROOT_DIR)/lib/event/libspdk_event.a \
$(SPDK_ROOT_DIR)/lib/event/rpc/libspdk_app_rpc.a \
LIBS += -Wl,--whole-archive $(SPDK_LIBS) -Wl,--no-whole-archive
LIBS += -lcrypto $(DPDK_LIB)
LIBS += -lcrypto $(ENV_LINKER_ARGS)
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
$(COPY_MODULES_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -37,7 +37,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP = nvmf_tgt
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
# Add NVMf library directory to include path
# TODO: remove this once NVMf has a public API header
@ -53,7 +53,6 @@ SPDK_LIBS = \
$(SPDK_ROOT_DIR)/lib/trace/libspdk_trace.a \
$(SPDK_ROOT_DIR)/lib/conf/libspdk_conf.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
$(SPDK_ROOT_DIR)/lib/bdev/libspdk_bdev.a \
$(SPDK_ROOT_DIR)/lib/copy/libspdk_copy.a \
$(SPDK_ROOT_DIR)/lib/rpc/libspdk_rpc.a \
@ -71,11 +70,11 @@ ifeq ($(CONFIG_RDMA),y)
LIBS += -libverbs -lrdmacm
endif
LIBS += $(DPDK_LIB)
LIBS += $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS) $(BLOCKDEV_MODULES) $(LINKER_MODULES)
$(APP) : $(OBJS) $(SPDK_LIBS) $(BLOCKDEV_MODULES) $(LINKER_MODULES) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CXXFLAGS += $(DPDK_INC)
CXXFLAGS += $(ENV_CFLAGS)
CXX_SRCS := trace.cpp
APP = spdk_trace

View File

@ -38,18 +38,17 @@ APP = perf
C_SRCS := perf.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/ioat/libspdk_ioat.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all: $(APP)
$(APP): $(OBJS) $(SPDK_LIBS)
$(APP): $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean:

View File

@ -38,18 +38,17 @@ APP = verify
C_SRCS := verify.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/ioat/libspdk_ioat.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all: $(APP)
$(APP): $(OBJS) $(SPDK_LIBS)
$(APP): $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean:

View File

@ -38,18 +38,17 @@ APP = arbitration
C_SRCS := arbitration.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -40,20 +40,19 @@ APP := fio_plugin
C_SRCS := fio_plugin.c
CFLAGS += -I. $(DPDK_INC) -I$(FIO_SOURCE_DIR)
CFLAGS += -I. $(ENV_CFLAGS) -I$(FIO_SOURCE_DIR)
LDFLAGS += -shared -rdynamic
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = hello_world
C_SRCS := hello_world.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = identify
C_SRCS := identify.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = nvme_manage
C_SRCS := nvme_manage.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,14 +38,13 @@ APP = perf
C_SRCS := perf.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
ifeq ($(OS),Linux)
LIBS += -laio
@ -54,7 +53,7 @@ endif
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = reserve
C_SRCS := reservation.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC) -I.
CFLAGS += $(ENV_CFLAGS) -I.
C_SRCS = bdev.c
LIBNAME = bdev

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC) -I$(SPDK_ROOT_DIR)/lib/bdev/
CFLAGS += $(ENV_CFLAGS) -I$(SPDK_ROOT_DIR)/lib/bdev/
C_SRCS = blockdev_malloc.c blockdev_malloc_rpc.c
LIBNAME = bdev_malloc

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC) -I$(SPDK_ROOT_DIR)/lib/bdev/
CFLAGS += $(ENV_CFLAGS) -I$(SPDK_ROOT_DIR)/lib/bdev/
C_SRCS = blockdev_nvme.c
LIBNAME = bdev_nvme

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
LIBNAME = copy
C_SRCS = copy_engine.c

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
LIBNAME = copy_ioat
C_SRCS = copy_engine_ioat.c

73
lib/env/env.mk vendored Normal file
View File

@ -0,0 +1,73 @@
#
# 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.
#
# This makefile snippet must define the following flags:
# ENV_CFLAGS
# ENV_CXXFLAGS
# ENV_LIBS
# ENV_LINKER_ARGS
DPDK_DIR ?= $(CONFIG_DPDK_DIR)
ifeq ($(DPDK_DIR), )
ifeq ($(OS),FreeBSD)
export DPDK_ABS_DIR = /usr/local/share/dpdk/x86_64-native-freebsdapp-clang
else
export DPDK_ABS_DIR = /usr/local/share/dpdk/x86_64-native-linuxapp-gcc
endif
else
export DPDK_ABS_DIR = $(abspath $(DPDK_DIR))
endif
DPDK_INC = -I$(DPDK_ABS_DIR)/include
DPDK_LIB = $(DPDK_ABS_DIR)/lib/librte_eal.a $(DPDK_ABS_DIR)/lib/librte_mempool.a \
$(DPDK_ABS_DIR)/lib/librte_ring.a $(DPDK_ABS_DIR)/lib/librte_timer.a
# librte_malloc was removed after DPDK 2.1. Link this library conditionally based on its
# existence to maintain backward compatibility.
ifneq ($(wildcard $(DPDK_ABS_DIR)/lib/librte_malloc.*),)
DPDK_LIB += $(DPDK_ABS_DIR)/lib/librte_malloc.a
endif
ifeq ($(OS),Linux)
DPDK_LIB += -ldl
endif
ifeq ($(OS),FreeBSD)
DPDK_LIB += -lexecinfo
endif
ENV_CFLAGS = $(DPDK_INC)
ENV_CXXFLAGS = $(ENV_CFLAGS)
ENV_LIBS = $(SPDK_ROOT_DIR)/lib/env/libspdk_env.a $(DPDK_LIB)
ENV_LINKER_ARGS = -Wl,--start-group -Wl,--whole-archive $(SPDK_ROOT_DIR)/lib/env/libspdk_env.a $(DPDK_LIB) -Wl,--end-group -Wl,--no-whole-archive

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
LIBNAME = event
C_SRCS = app.c dpdk_init.c reactor.c subsystem.c

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC) -include $(CONFIG_IOAT_IMPL)
CFLAGS += $(ENV_CFLAGS) -include $(CONFIG_IOAT_IMPL)
C_SRCS = ioat.c
LIBNAME = ioat

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC) -I$(SPDK_ROOT_DIR)/lib
CFLAGS += $(ENV_CFLAGS) -I$(SPDK_ROOT_DIR)/lib
C_SRCS = acceptor.c conn.c crc32c.c \
init_grp.c iscsi.c md5.c param.c portal_grp.c \
tgt_node.c iscsi_subsystem.c \

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC) -include $(CONFIG_NVME_IMPL)
CFLAGS += $(ENV_CFLAGS) -include $(CONFIG_NVME_IMPL)
C_SRCS = nvme_ctrlr_cmd.c nvme_ctrlr.c nvme_ns_cmd.c nvme_ns.c nvme_qpair.c nvme.c nvme_intel.c
LIBNAME = nvme

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
LIBNAME = nvmf
C_SRCS = subsystem.c nvmf.c \

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
C_SRCS = rpc.c
LIBNAME = rpc

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
C_SRCS = dev.c lun.c lun_db.c port.c scsi.c scsi_bdev.c scsi_rpc.c task.c
LIBNAME = scsi

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
C_SRCS = trace.c
LIBNAME = trace

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
C_SRCS = bit_array.c fd.c io_channel.c string.c pci.c
LIBNAME = util

View File

@ -93,8 +93,7 @@ LDFLAGS += --coverage
endif
endif
CFLAGS += $(COMMON_CFLAGS) -Wno-pointer-sign -Wstrict-prototypes -Wold-style-definition -std=gnu99
CXXFLAGS += $(COMMON_CFLAGS) -std=c++0x
include $(CONFIG_ENV)/env.mk
ifeq ($(CONFIG_ADDRESS_SANITIZER),y)
COMMON_CFLAGS += -fsanitize=address
@ -104,6 +103,9 @@ endif
COMMON_CFLAGS += -pthread
LDFLAGS += -pthread
CFLAGS += $(COMMON_CFLAGS) -Wno-pointer-sign -Wstrict-prototypes -Wold-style-definition -std=gnu99
CXXFLAGS += $(COMMON_CFLAGS) -std=c++0x
SYS_LIBS += -lrt
MAKEFLAGS += --no-print-directory
@ -151,26 +153,3 @@ CLEAN_C=\
$(COMPILE_CXX)
%.d: ;
DPDK_DIR ?= $(CONFIG_DPDK_DIR)
export DPDK_DIR_ABS = $(abspath $(DPDK_DIR))
DPDK_INC_DIR ?= $(DPDK_DIR_ABS)/include
DPDK_LIB_DIR ?= $(DPDK_DIR_ABS)/lib
DPDK_INC = -I$(DPDK_INC_DIR)
DPDK_LIB = -L$(DPDK_LIB_DIR) -Wl,--start-group -Wl,--whole-archive \
-lrte_eal -lrte_mempool -lrte_ring -lrte_timer \
-Wl,--end-group -Wl,--no-whole-archive -Wl,-rpath=$(DPDK_LIB_DIR)
# librte_malloc was removed after DPDK 2.1. Link this library conditionally based on its
# existence to maintain backward compatibility.
ifneq ($(wildcard $(DPDK_DIR_ABS)/lib/librte_malloc.*),)
DPDK_LIB += -lrte_malloc
endif
# DPDK requires dl library for dlopen/dlclose on Linux.
ifeq ($(OS),Linux)
DPDK_LIB += -ldl
endif
ifeq ($(OS),FreeBSD)
DPDK_LIB += -lexecinfo
endif

View File

@ -39,7 +39,7 @@ APP = bdevio
C_SRCS := bdevio.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/bdev/libspdk_bdev.a \
$(SPDK_ROOT_DIR)/lib/copy/libspdk_copy.a \
@ -48,19 +48,18 @@ SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/bdev/libspdk_bdev.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/conf/libspdk_conf.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
$(SPDK_ROOT_DIR)/lib/rpc/libspdk_rpc.a \
$(SPDK_ROOT_DIR)/lib/jsonrpc/libspdk_jsonrpc.a \
$(SPDK_ROOT_DIR)/lib/json/libspdk_json.a
$(SPDK_ROOT_DIR)/lib/json/libspdk_json.a \
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
$(COPY_MODULES_LINKER_ARGS)
LIBS += $(SPDK_LIBS) $(DPDK_LIB) -lcunit
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS) -lcunit
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS) $(BLOCKDEV_MODULES) $(LINKER_MODULES)
$(APP) : $(OBJS) $(SPDK_LIBS) $(BLOCKDEV_MODULES) $(LINKER_MODULES) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -39,7 +39,7 @@ APP = bdevperf
C_SRCS := bdevperf.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/bdev/libspdk_bdev.a \
$(SPDK_ROOT_DIR)/lib/copy/libspdk_copy.a \
@ -48,19 +48,18 @@ SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/bdev/libspdk_bdev.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/conf/libspdk_conf.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
$(SPDK_ROOT_DIR)/lib/rpc/libspdk_rpc.a \
$(SPDK_ROOT_DIR)/lib/jsonrpc/libspdk_jsonrpc.a \
$(SPDK_ROOT_DIR)/lib/json/libspdk_json.a
$(SPDK_ROOT_DIR)/lib/json/libspdk_json.a \
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
$(COPY_MODULES_LINKER_ARGS)
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS) $(BLOCKDEV_MODULES) $(COPY_MODULES)
$(APP) : $(OBJS) $(SPDK_LIBS) $(BLOCKDEV_MODULES) $(COPY_MODULES) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,15 +38,13 @@ APP = vtophys
C_SRCS = vtophys.c
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all: $(APP)
$(APP): $(OBJS) $(SPDK_LIBS)
$(APP): $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean:

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
APP = event
C_SRCS := event.c
@ -44,11 +44,11 @@ SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/event/libspdk_event.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
APP = reactor
C_SRCS := reactor.c
@ -44,11 +44,11 @@ SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/event/libspdk_event.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = aer
C_SRCS := aer.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = nvme_dp
C_SRCS := nvme_dp.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,14 +38,13 @@ APP = overhead
C_SRCS := overhead.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
ifeq ($(OS),Linux)
LIBS += -laio
@ -54,7 +53,7 @@ endif
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = reset
C_SRCS := reset.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -38,18 +38,17 @@ APP = sgl
C_SRCS := nvme_sgl.c
CFLAGS += -I. $(DPDK_INC)
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/nvme/libspdk_nvme.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/env/libspdk_env.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS) $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(ENV_LIBS)
$(LINK_C)
clean :

View File

@ -33,14 +33,14 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..)
CFLAGS += $(DPDK_INC)
CFLAGS += $(ENV_CFLAGS)
SPDK_LIBS += $(SPDK_ROOT_DIR)/lib/log/libspdk_log.a \
$(SPDK_ROOT_DIR)/lib/conf/libspdk_conf.a \
$(SPDK_ROOT_DIR)/lib/util/libspdk_util.a \
$(SPDK_ROOT_DIR)/lib/trace/libspdk_trace.a \
$(SPDK_ROOT_DIR)/lib/event/libspdk_event.a \
LIBS += $(SPDK_LIBS) $(DPDK_LIB)
LIBS += $(SPDK_LIBS)
TEST_FILE = nvmf_ut.c