Spdk/mk/spdk.lib.mk
Jim Harris 488570ebd4 Replace most BSD 3-clause license text with SPDX identifier.
Many open source projects have moved to using SPDX identifiers
to specify license information, reducing the amount of
boilerplate code in every source file.  This patch replaces
the bulk of SPDK .c, .cpp and Makefiles with the BSD-3-Clause
identifier.

Almost all of these files share the exact same license text,
and this patch only modifies the files that contain the
most common license text.  There can be slight variations
because the third clause contains company names - most say
"Intel Corporation", but there are instances for Nvidia,
Samsung, Eideticom and even "the copyright holder".

Used a bash script to automate replacement of the license text
with SPDX identifier which is checked into scripts/spdx.sh.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa88ab5e92ea471691dc298cfe41ebfb5d169780
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12904
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: <qun.wan@intel.com>
2022-06-09 07:35:12 +00:00

119 lines
2.6 KiB
Makefile

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Intel Corporation.
# All rights reserved.
#
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk
include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
ifeq ($(SPDK_MAP_FILE),)
$(error SPDK_MAP_FILE is not set for lib $(LIBNAME))
endif
ifeq ($(SO_VER),)
$(error SO major version is not set for lib $(LIBNAME))
endif
ifeq ($(SO_MINOR),)
$(error SO minor version is not set for lib $(LIBNAME))
endif
SO_SUFFIX := $(SO_VER).$(SO_MINOR)
LIB := $(call spdk_lib_list_to_static_libs,$(LIBNAME))
SHARED_LINKED_LIB := $(LIB:.a=.so)
SHARED_REALNAME_LIB := $(SHARED_LINKED_LIB:.so=.so.$(SO_SUFFIX))
PKGCONFIG = $(call pkgconfig_filename,spdk_$(LIBNAME))
PKGCONFIG_INST = $(call pkgconfig_filename,tmp/spdk_$(LIBNAME))
ifeq ($(CONFIG_SHARED),y)
DEP := $(SHARED_LINKED_LIB)
else
DEP := $(LIB)
endif
DEP += $(PKGCONFIG) ${PKGCONFIG_INST}
ifeq ($(OS),FreeBSD)
LOCAL_SYS_LIBS += -L/usr/local/lib
endif
define subdirs_rule
$(1): $(2)
@+$(Q)$(MAKE) -C $(1) S=$S$(S:%=/)$@ $(MAKECMDGOALS)
endef
$(foreach dir,$(DIRS-y),$(eval $(call subdirs_rule,$(dir),$(DEP))))
ifneq ($(DIRS-y),)
BUILD_DEP := $(DIRS-y)
else
BUILD_DEP := $(DEP)
endif
ifeq ($(SPDK_NO_LIB_DEPS),)
SPDK_DEP_LIBS = $(call spdk_lib_list_to_shared_libs,$(DEPDIRS-$(LIBNAME)))
endif
ifeq ($(CXX_SRCS),)
COMPILER=$(CC)
else
COMPILER=$(CXX)
endif
MODULES-bdev = spdk_bdev_modules
MODULES-sock = spdk_sock_modules
MODULES-accel = spdk_accel_modules
MODULES-scheduler = spdk_scheduler_modules
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
MODULES-event = spdk_env_dpdk_rpc
endif
.PHONY: all clean $(DIRS-y)
all: $(BUILD_DEP)
@:
clean: $(DIRS-y)
$(CLEAN_C) $(LIB) $(SHARED_LINKED_LIB) $(SHARED_REALNAME_LIB)
$(SHARED_LINKED_LIB): $(SHARED_REALNAME_LIB)
$(Q)echo " SYMLINK $(notdir $@)"; $(BUILD_LINKERNAME_LIB)
$(SHARED_REALNAME_LIB): $(LIB)
$(Q)echo " SO $(notdir $@)"; \
$(call spdk_build_realname_shared_lib,$(COMPILER),$^,$(SPDK_MAP_FILE),$(LOCAL_SYS_LIBS),$(SPDK_DEP_LIBS))
define pkgconfig_create
$(Q)$(SPDK_ROOT_DIR)/scripts/pc.sh $(1) $(LIBNAME) $(SO_SUFFIX) \
"$(DEPDIRS-$(LIBNAME):%=spdk_%) $(MODULES-$(LIBNAME))" \
"" > $@
endef
$(PKGCONFIG): $(LIB)
$(call pkgconfig_create,$(SPDK_ROOT_DIR)/build)
$(PKGCONFIG_INST): $(LIB)
$(call pkgconfig_create,$(CONFIG_PREFIX))
$(LIB): $(OBJS)
$(LIB_C)
install: all
$(INSTALL_LIB)
@$(call pkgconfig_install,$(PKGCONFIG_INST))
ifeq ($(CONFIG_SHARED),y)
$(INSTALL_SHARED_LIB)
endif
uninstall: $(DIRS-y)
$(UNINSTALL_LIB)
@$(call pkgconfig_uninstall,$(PKGCONFIG_INST))
ifeq ($(CONFIG_SHARED),y)
$(UNINSTALL_SHARED_LIB)
endif
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk