mk: don't link env if not needed

Some SPDK apps were linked with env even though they
didn't use it.

Top-level makefiles can now specify SPDK_NO_LINK_ENV=1.

Change-Id: I057baa5b620f20d829185025dc2e8efdcfa03fac
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3417
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
This commit is contained in:
Darek Stojaczyk 2020-07-16 10:37:42 +02:00 committed by Tomasz Zawadzki
parent 3fdfea7bac
commit 494dc66ddb
3 changed files with 6 additions and 3 deletions

View File

@ -36,8 +36,8 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP = iscsi_top
SPDK_NO_LINK_ENV = 1
CXXFLAGS += $(ENV_CXXFLAGS)
CXXFLAGS += -I$(SPDK_ROOT_DIR)/lib
CXX_SRCS := iscsi_top.cpp

View File

@ -36,6 +36,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP = spdk_trace
SPDK_NO_LINK_ENV = 1
CXX_SRCS := trace.cpp

View File

@ -254,14 +254,16 @@ COMPILE_CXX=\
$(CXX) -o $@ $(DEPFLAGS) $(CXXFLAGS) -c $< && \
mv -f $*.d.tmp $*.d && touch -c $@
ENV_LDFLAGS = $(if $(SPDK_NO_LINK_ENV),,$(ENV_LINKER_ARGS))
# Link $(OBJS) and $(LIBS) into $@ (app)
LINK_C=\
$(Q)echo " LINK $(notdir $@)"; \
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LINKER_ARGS) $(SYS_LIBS)
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LDFLAGS) $(SYS_LIBS)
LINK_CXX=\
$(Q)echo " LINK $(notdir $@)"; \
$(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LINKER_ARGS) $(SYS_LIBS)
$(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LDFLAGS) $(SYS_LIBS)
# Provide function to ease build of a shared lib
define spdk_build_realname_shared_lib