build: add ENV_LINKER_ARGS to LINK_C and LINK_CXX
This allows us to remove $(ENV_LINKER_ARGS) from all of the application Makefiles. Modify spdk.unittest.mk to explicitly set ENV_LINKER_ARGS to nothing, to avoid DPDK libraries from getting linked into unit tests. This seems better than creating separate LINK_C rules for unit tests. Provide a UNIT_TEST_LINK_ENV flag to allow select unit tests to override this behavior - it's needed for some of the env unit tests. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I647f2c848cf434023cf5a1f3a45869bbc4fc8102 Reviewed-on: https://review.gerrithub.io/434145 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
80bfabcfcf
commit
3da5847023
@ -56,7 +56,6 @@ LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
|
||||
$(COPY_MODULES_LINKER_ARGS) \
|
||||
$(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
LIBS += $(ENV_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -51,7 +51,7 @@ endif
|
||||
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
|
||||
$(COPY_MODULES_LINKER_ARGS) \
|
||||
$(SOCK_MODULES_LINKER_ARGS) \
|
||||
$(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
$(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -59,7 +59,7 @@ endif
|
||||
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
|
||||
$(COPY_MODULES_LINKER_ARGS) \
|
||||
$(SOCK_MODULES_LINKER_ARGS) \
|
||||
$(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
$(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all: $(APP)
|
||||
@:
|
||||
|
@ -50,7 +50,6 @@ LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
|
||||
$(COPY_MODULES_LINKER_ARGS) \
|
||||
$(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
LIBS += $(ENV_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -46,7 +46,7 @@ LDFLAGS += -shared -rdynamic
|
||||
SPDK_LIB_LIST += thread util bdev conf copy rpc jsonrpc json log sock trace
|
||||
|
||||
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) $(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all: $(APP)
|
||||
@:
|
||||
|
@ -42,7 +42,7 @@ SPDK_LIB_LIST = event_bdev event_copy
|
||||
SPDK_LIB_LIST += bdev copy event thread util conf trace log jsonrpc json rpc sock
|
||||
|
||||
LIBS += $(COPY_MODULES_LINKER_ARGS) $(BLOCKDEV_MODULES_LINKER_ARGS) $(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -46,7 +46,7 @@ SPDK_LIB_LIST += bdev copy event thread util conf trace \
|
||||
BLOCKDEV_MODULES_LIST := $(filter-out bdev_lvol,$(BLOCKDEV_MODULES_LIST))
|
||||
|
||||
LIBS += $(COPY_MODULES_LINKER_ARGS) $(BLOCKDEV_MODULES_LINKER_ARGS) $(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -43,7 +43,7 @@ SPDK_LIB_LIST += bdev copy event thread util conf trace \
|
||||
log jsonrpc json rpc sock
|
||||
|
||||
LIBS += $(COPY_MODULES_LINKER_ARGS) $(BLOCKDEV_MODULES_LINKER_ARGS) $(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -41,7 +41,7 @@ C_SRCS := perf.c
|
||||
|
||||
SPDK_LIB_LIST = ioat thread util log
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all: $(APP)
|
||||
@:
|
||||
|
@ -41,7 +41,7 @@ C_SRCS := verify.c
|
||||
|
||||
SPDK_LIB_LIST = ioat thread util log
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all: $(APP)
|
||||
@:
|
||||
|
@ -40,7 +40,7 @@ C_SRCS := hello_sock.c
|
||||
|
||||
SPDK_LIB_LIST += event thread util conf trace log jsonrpc json rpc sock
|
||||
|
||||
LIBS += $(SOCK_MODULES_LINKER_ARGS) $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SOCK_MODULES_LINKER_ARGS) $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -42,7 +42,7 @@ C_SRCS = $(APP:%=%.c)
|
||||
SPDK_LIB_LIST = nvme thread util log sock
|
||||
|
||||
LIBS += $(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
ifeq ($(CONFIG_RDMA),y)
|
||||
SYS_LIBS += -libverbs -lrdmacm
|
||||
|
@ -219,11 +219,11 @@ COMPILE_CXX=\
|
||||
# Link $(OBJS) and $(LIBS) into $@ (app)
|
||||
LINK_C=\
|
||||
$(Q)echo " LINK $S/$@"; \
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(SYS_LIBS)
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LINKER_ARGS) $(SYS_LIBS)
|
||||
|
||||
LINK_CXX=\
|
||||
$(Q)echo " LINK $S/$@"; \
|
||||
$(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(SYS_LIBS)
|
||||
$(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LINKER_ARGS) $(SYS_LIBS)
|
||||
|
||||
#
|
||||
# Variables to use for versioning shared libs
|
||||
|
@ -46,6 +46,10 @@ LIBS += -lcunit $(SPDK_STATIC_LIB_LINKER_ARGS)
|
||||
|
||||
APP = $(TEST_FILE:.c=)
|
||||
|
||||
ifneq ($(UNIT_TEST_LINK_ENV),1)
|
||||
ENV_LINKER_ARGS =
|
||||
endif
|
||||
|
||||
all: $(APP)
|
||||
@:
|
||||
|
||||
|
@ -51,7 +51,7 @@ endif
|
||||
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
|
||||
$(COPY_MODULES_LINKER_ARGS) \
|
||||
$(SOCK_MODULES_LINKER_ARGS) \
|
||||
$(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
$(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -41,7 +41,7 @@ C_SRCS = histogram_perf.c
|
||||
|
||||
SPDK_LIB_LIST = thread util log
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all: $(APP)
|
||||
@:
|
||||
|
@ -41,7 +41,7 @@ C_SRCS = jsoncat.c
|
||||
|
||||
SPDK_LIB_LIST = json thread util log
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all: $(APP)
|
||||
@:
|
||||
|
@ -44,7 +44,6 @@ SPDK_LIB_LIST = event conf nvme log trace rpc jsonrpc json thread util sock
|
||||
|
||||
LIBS += $(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
LIBS += $(ENV_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -47,7 +47,7 @@ LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
|
||||
$(COPY_MODULES_LINKER_ARGS) \
|
||||
$(SOCK_MODULES_LINKER_ARGS)
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS) -lcunit
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) -lcunit
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -47,7 +47,7 @@ LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
|
||||
$(COPY_MODULES_LINKER_ARGS) \
|
||||
$(SOCK_MODULES_LINKER_ARGS)
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -45,7 +45,7 @@ SPDK_LIB_LIST += bdev copy event thread util conf trace \
|
||||
log jsonrpc json rpc sock
|
||||
|
||||
LIBS += $(COPY_MODULES_LINKER_ARGS) $(BLOCKDEV_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
LIBS+= -L/usr/local/lib -lfuse3
|
||||
|
||||
all : $(APP)
|
||||
|
@ -45,7 +45,7 @@ SPDK_LIB_LIST += bdev copy event thread util conf trace \
|
||||
log jsonrpc json rpc sock
|
||||
|
||||
LIBS += $(COPY_MODULES_LINKER_ARGS) $(BLOCKDEV_MODULES_LINKER_ARGS) $(SOCK_MODULES_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
2
test/env/pci/Makefile
vendored
2
test/env/pci/Makefile
vendored
@ -35,8 +35,8 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk
|
||||
|
||||
UNIT_TEST_LINK_ENV = 1
|
||||
CFLAGS += $(ENV_CFLAGS)
|
||||
LIBS += $(ENV_LINKER_ARGS)
|
||||
TEST_FILE = pci_ut.c
|
||||
|
||||
ADDITIONAL_LIBS += $(ENV_LIBS)
|
||||
|
2
test/env/vtophys/Makefile
vendored
2
test/env/vtophys/Makefile
vendored
@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk
|
||||
|
||||
LIBS += $(ENV_LINKER_ARGS)
|
||||
UNIT_TEST_LINK_ENV = 1
|
||||
TEST_FILE = vtophys.c
|
||||
|
||||
ADDITIONAL_LIBS += $(ENV_LIBS)
|
||||
|
@ -40,7 +40,7 @@ C_SRCS := event_perf.c
|
||||
|
||||
SPDK_LIB_LIST = event trace conf thread util log rpc jsonrpc json sock
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -40,7 +40,7 @@ C_SRCS := reactor.c
|
||||
|
||||
SPDK_LIB_LIST = event trace conf thread util log rpc jsonrpc json sock
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -40,7 +40,7 @@ C_SRCS := reactor_perf.c
|
||||
|
||||
SPDK_LIB_LIST = event trace conf thread util log rpc jsonrpc json sock
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
@ -42,7 +42,7 @@ C_SRCS := rpc_client_test.c
|
||||
|
||||
SPDK_LIB_LIST = jsonrpc json rpc log util
|
||||
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
|
||||
LIBS += $(SPDK_LIB_LINKER_ARGS)
|
||||
|
||||
all : $(APP)
|
||||
@:
|
||||
|
Loading…
x
Reference in New Issue
Block a user