mk: allow declaration of build artifacts for libs

The build system automatically announces the names of shared libraries
as build artifacts. However, in rare cases, it is required to manually
define them. In particular, the 'ld' stub library plays no role at runtime
and should not be integrated into the boot image.

This patch adds a customization hook following the same pattern as used
for target.mk files, namely the BUILD_ARTIFACTS variable. If defined,
its value is taken as the list of boot artifacts generated by the
library-description file.

Issue #4368
This commit is contained in:
Norman Feske 2022-09-02 15:17:19 +02:00
parent dd9e12601e
commit 9aab61f5a7

View File

@ -82,14 +82,19 @@ include $(BASE_DIR)/mk/base-libs.mk
include $(LIB_MK)
ifdef SHARED_LIB
LIBS += ldso_so_support
BUILD_ARTIFACTS ?= $(LIB).lib.so
endif
# record creation of shared library build artifact
append_artifact_to_progress_log:
@echo -e "\n# Build artifact $(LIB).lib.so\n" >> $(LIB_PROGRESS_LOG)
@( $(foreach A,$(BUILD_ARTIFACTS),\
echo -e "\n# Build artifact $A\n";) true \
) >> $(LIB_PROGRESS_LOG)
append_lib_to_progress_log: append_artifact_to_progress_log
endif
ifdef SHARED_LIB
LIBS += ldso_so_support
endif
#
# Hide archive dependencies of shared libraries from users of the shared