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_DEPLIB_LIST += $(call deplibs,$(SPDK_LIB_LIST)) 17 18SPDK_LIB_FILES = $(call spdk_lib_list_to_static_libs,$(SPDK_DEPLIB_LIST)) 19SPDK_LIB_LINKER_ARGS = \ 20 -L$(SPDK_ROOT_DIR)/build/lib \ 21 -Wl,--whole-archive \ 22 -Wl,--no-as-needed \ 23 $(SPDK_DEPLIB_LIST:%=-lspdk_%) \ 24 -Wl,--no-whole-archive 25 26# This is primarily used for unit tests to ensure they link when shared library 27# build is enabled. Shared libraries can't get their mock implementation from 28# the unit test file. Note that even for unittests, we must include the mock 29# library with whole-archive, to keep its functions from getting stripped out 30# when LTO is enabled. 31SPDK_STATIC_LIB_LINKER_ARGS = \ 32 $(SPDK_LIB_LIST:%=$(SPDK_ROOT_DIR)/build/lib/libspdk_%.a) \ 33 -Wl,--whole-archive \ 34 $(SPDK_ROOT_DIR)/build/lib/libspdk_ut_mock.a \ 35 -Wl,--no-whole-archive 36