1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright (C) 2016 Intel Corporation. 3# All rights reserved. 4# 5 6include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk 7 8define _deplibs 9$(if $1,$(foreach d,$1,$(d) $(call _deplibs,$(DEPDIRS-$(d))))) 10endef 11 12define deplibs 13$(call _uniq,$(call _deplibs,$1)) 14endef 15 16SPDK_LIB_LIST += $(ENV_DEPLIBS) 17SPDK_DEPLIB_LIST += $(call deplibs,$(SPDK_LIB_LIST)) 18 19SPDK_LIB_FILES = $(call spdk_lib_list_to_static_libs,$(SPDK_DEPLIB_LIST)) 20SPDK_LIB_LINKER_ARGS = \ 21 -L$(SPDK_ROOT_DIR)/build/lib \ 22 -Wl,--whole-archive \ 23 -Wl,--no-as-needed \ 24 $(SPDK_DEPLIB_LIST:%=-lspdk_%) \ 25 -Wl,--no-whole-archive 26 27# This is primarily used for unit tests to ensure they link when shared library 28# build is enabled. Shared libraries can't get their mock implementation from 29# the unit test file. Note that even for unittests, we must include the mock 30# library with whole-archive, to keep its functions from getting stripped out 31# when LTO is enabled. 32SPDK_STATIC_LIB_LINKER_ARGS = \ 33 $(SPDK_LIB_FILES) \ 34 -Wl,--whole-archive \ 35 $(SPDK_ROOT_DIR)/build/lib/libspdk_ut_mock.a \ 36 -Wl,--no-whole-archive 37