Support for building all libs via 'make lib'
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.
This commit is contained in:
@@ -73,7 +73,28 @@ endif
|
||||
echo "") >> $(LIB_DEP_FILE)
|
||||
@for i in $(LIBS_TO_VISIT); do \
|
||||
$(MAKE) $(VERBOSE_DIR) -f $(BASE_DIR)/mk/dep_lib.mk REP_DIR=$(REP_DIR) LIB=$$i; done
|
||||
#
|
||||
# Make 'all' depend on the target, which triggers the building of the target
|
||||
# and the traversal of the target's library dependencies. But we only do so
|
||||
# if the target does not depend on any library with unsatisfied build
|
||||
# requirements. In such a case, the target cannot be linked anyway.
|
||||
#
|
||||
@(echo ""; \
|
||||
echo "ifeq (\$$(filter \$$(DEP_$(TARGET).prg:.lib=),\$$(INVALID_DEPS)),)"; \
|
||||
echo "all: $(TARGET).prg"; \
|
||||
echo "endif") >> $(LIB_DEP_FILE)
|
||||
#
|
||||
# Normally, if the target depends on a library, which cannot be built (such
|
||||
# libraries get recorded in the 'INVALID_DEPS' variable), we skip the target
|
||||
# altogether. In some cases, however, we want to build all non-invalid
|
||||
# libraries of a target regardless of whether the final target can be created
|
||||
# or not. (i.e., for implementing the mechanism for building all libraries,
|
||||
# see 'base/src/lib/target.mk'). This use case is supported via the
|
||||
# 'FORCE_BUILD_LIBS' variable. If the 'target.mk' file assigns the value
|
||||
# 'yes' to this variable, we build all non-invalid libraries regardless of
|
||||
# the validity of the final target.
|
||||
#
|
||||
ifeq ($(FORCE_BUILD_LIBS),yes)
|
||||
@(echo ""; \
|
||||
echo "all: \$$(addsuffix .lib,\$$(filter-out \$$(INVALID_DEPS), $(LIBS)))") >> $(LIB_DEP_FILE)
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user