b1b59fe8a6
Normally, the build system creates libraries as mere side effects of building targets. There is no way to explicitly trigger the build of libraries only. However, in some circumstances (for example for testing the thorough build of all libraries) a mechanism for explicitly building libraries would be convenient. This patch implements this feature. It consists of two changes. The new pseudo target at 'base/src/lib/target.mk' gathers all libraries that are available in all repositories specified for the build directory and makes its target depend on them. This way, by building 'lib', all libraries would be traversed. However, in the (likely) situation that those libraries include one or more invalid libraries (libraries with unsatisfied build requirements), the build system would skip the target. Hence, the second change introduces a new condition 'FORCE_BUILD_LIBS' to the build system. By setting this variable to 'yes' in the 'target.mk' file, we let the build system to traverse library dependencies for all valid libraries regardless of the presence of any invalid library.
34 lines
1.1 KiB
Makefile
34 lines
1.1 KiB
Makefile
#
|
|
# This is a dummy target description file with the sole purpose of building
|
|
# all libraries.
|
|
#
|
|
TARGET = libs
|
|
|
|
#
|
|
# Determine all 'lib/mk' sub directories residing within the repositories.
|
|
# Use 'wildcard' to handle the case when a repository does not host any
|
|
# 'lib/mk' sub directory.
|
|
#
|
|
LIB_MK_DIRS := $(wildcard $(addsuffix /lib/mk,$(REPOSITORIES)))
|
|
|
|
#
|
|
# Scan the 'lib/mk' directories of all repositories for library description
|
|
# files.
|
|
#
|
|
ALL_LIB_MK_FILES := $(notdir $(foreach DIR,$(LIB_MK_DIRS),$(shell find $(DIR) -name "*.mk")))
|
|
|
|
#
|
|
# Make the pseudo target depend on all libraries, for which an lib.mk file
|
|
# exists. Discard the '.mk' suffix and remove duplicates (via 'sort').
|
|
#
|
|
LIBS = $(sort $(ALL_LIB_MK_FILES:.mk=))
|
|
|
|
#
|
|
# Among all libraries found above, there may be several libraries with
|
|
# unsatisfied build requirements. Normally, the build system won't attempt to
|
|
# build the target (and its library dependencies) if one or more libraries
|
|
# cannot be built. By enabling 'FORCE_BUILD_LIBS', we let the build system
|
|
# visit all non-invalid libraries even in the presence of invalid libraries.
|
|
#
|
|
FORCE_BUILD_LIBS = yes
|