libvfio-user: compile shared library based on CONFIG_SHARED flag
Fix #2556. Change-Id: I843dace8408d09bdb9222a37731a95732736bb78 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13041 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
237ae71034
commit
619da10386
@ -38,7 +38,7 @@ ifeq ($(CONFIG_VFIO_USER), y)
|
||||
C_SRCS += vfio_user.c
|
||||
CFLAGS += -I$(VFIO_USER_INCLUDE_DIR)
|
||||
LDFLAGS += -L$(VFIO_USER_LIBRARY_DIR)
|
||||
LOCAL_SYS_LIBS += -Wl,-Bstatic -lvfio-user -Wl,-Bdynamic -ljson-c
|
||||
LOCAL_SYS_LIBS += -lvfio-user -ljson-c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FC),y)
|
||||
|
@ -24,10 +24,6 @@ LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
CLEAN_FILES = $(APP)
|
||||
|
||||
ifeq ($(findstring vfio_user,$(SPDK_LIB_FILES)),vfio_user)
|
||||
VFIO_USER_LIB_FILE=$(VFIO_USER_LIBRARY_DIR)/libvfio-user.a
|
||||
endif
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
||||
@ -39,7 +35,7 @@ uninstall: empty_rule
|
||||
empty_rule:
|
||||
@:
|
||||
|
||||
$(APP) : $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS) $(VFIO_USER_LIB_FILE)
|
||||
$(APP) : $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
|
||||
$(LINK_C)
|
||||
|
||||
clean :
|
||||
|
@ -169,15 +169,20 @@ VFIO_USER_BUILD_TYPE=debug
|
||||
else
|
||||
VFIO_USER_BUILD_TYPE=release
|
||||
endif
|
||||
ifeq ($(CONFIG_SHARED), y)
|
||||
VFIO_USER_BUILD_SHARED=shared
|
||||
else
|
||||
VFIO_USER_BUILD_SHARED=static
|
||||
endif
|
||||
VFIO_USER_LIB_PREFIX=/usr/local/lib
|
||||
VFIO_USER_BUILD_DIR=$(SPDK_ROOT_DIR)/build/libvfio-user/build-$(VFIO_USER_BUILD_TYPE)
|
||||
VFIO_USER_INSTALL_DIR=$(SPDK_ROOT_DIR)/build/libvfio-user/
|
||||
VFIO_USER_INSTALL_DIR=$(SPDK_ROOT_DIR)/build/libvfio-user
|
||||
VFIO_USER_INCLUDE_DIR=$(VFIO_USER_INSTALL_DIR)/usr/local/include
|
||||
VFIO_USER_LIBRARY_DIR=$(VFIO_USER_INSTALL_DIR)/$(VFIO_USER_LIB_PREFIX)
|
||||
VFIO_USER_LIBRARY_DIR=$(VFIO_USER_INSTALL_DIR)$(VFIO_USER_LIB_PREFIX)
|
||||
|
||||
CFLAGS += -I$(VFIO_USER_INCLUDE_DIR)
|
||||
LDFLAGS += -L$(VFIO_USER_LIBRARY_DIR)
|
||||
SYS_LIBS += -Wl,-Bstatic -lvfio-user -Wl,-Bdynamic -ljson-c
|
||||
SYS_LIBS += -lvfio-user -ljson-c
|
||||
endif
|
||||
|
||||
#Attach only if FreeBSD and RDMA is specified with configure
|
||||
|
@ -165,7 +165,7 @@ export SPDK_TEST_NVMF_NICS
|
||||
# always test with SPDK shared objects.
|
||||
export SPDK_LIB_DIR="$rootdir/build/lib"
|
||||
export DPDK_LIB_DIR="${SPDK_RUN_EXTERNAL_DPDK:-$rootdir/dpdk/build}/lib"
|
||||
export VFIO_LIB_DIR="$rootdir/libvfio-user/build/release/lib"
|
||||
export VFIO_LIB_DIR="$rootdir/build/libvfio-user/usr/local/lib"
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SPDK_LIB_DIR:$DPDK_LIB_DIR:$VFIO_LIB_DIR
|
||||
|
||||
# Tell setup.sh to wait for block devices upon each reset
|
||||
|
@ -12,7 +12,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
# target instead of allowing CC=scan-build like everyone else.
|
||||
SUB_CC = $(patsubst %ccc-analyzer,$(DEFAULT_CC),$(CC))
|
||||
|
||||
VFIO_USER_CFG_OPTS = --buildtype $(VFIO_USER_BUILD_TYPE) -Ddefault_library=static -Dlibdir=$(VFIO_USER_LIB_PREFIX)
|
||||
VFIO_USER_CFG_OPTS = --buildtype $(VFIO_USER_BUILD_TYPE) -Ddefault_library=$(VFIO_USER_BUILD_SHARED) -Dlibdir=$(VFIO_USER_LIB_PREFIX)
|
||||
|
||||
all: scan-build
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user