mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 22:23:16 +00:00
ff10687a6c
Previously, ports that were needed for a scenario and that were not prepared or outdated, triggered one assertion each during the second build stage. The commit slots a mechanism in ahead that gathers all these ports during the first build stage and reports them in form of a list before the second build stage is entered. This list can be used directly as argument for tool/ports/prepare_port to prepare respectively update the ports. If, however, this mechanism is not available, for example because a target is build without the first build stage, the old assertion still prevents the target from running into troubles with a missing port. Fixes #1872
99 lines
3.2 KiB
Makefile
99 lines
3.2 KiB
Makefile
#
|
|
# Prevent execution of any rule contained in $(TARGET_MK) as default rule
|
|
#
|
|
all:
|
|
|
|
ACCUMULATE_MISSING_PORTS = 1
|
|
|
|
#
|
|
# Include common utility functions
|
|
#
|
|
include $(BASE_DIR)/mk/util.inc
|
|
|
|
#
|
|
# Include target build instructions to aquire library dependecies
|
|
#
|
|
PRG_DIR := $(dir $(TARGET_MK))
|
|
include $(TARGET_MK)
|
|
|
|
#
|
|
# Include lib-import description files
|
|
#
|
|
include $(foreach LIB,$(LIBS),$(call select_from_repositories,lib/import/import-$(LIB).mk))
|
|
|
|
#
|
|
# Add globally defined library supplements
|
|
#
|
|
include $(SPEC_FILES)
|
|
LIBS += $(PRG_LIBS)
|
|
|
|
#
|
|
# Determine location of $(TARGET_MK) within 'src/', remove trailing slash
|
|
#
|
|
PRG_REL_DIR := $(subst $(REP_DIR)/src/,,$(PRG_DIR))
|
|
PRG_REL_DIR := $(PRG_REL_DIR:/=)
|
|
|
|
#
|
|
# Prevent generation of program rule if requirements are unsatisfied
|
|
#
|
|
UNSATISFIED_REQUIREMENTS = $(filter-out $(SPECS),$(REQUIRES))
|
|
ifneq ($(UNSATISFIED_REQUIREMENTS),)
|
|
all:
|
|
@$(ECHO) "Skip target $(PRG_REL_DIR) because it requires $(DARK_COL)$(UNSATISFIED_REQUIREMENTS)$(DEFAULT_COL)"
|
|
else
|
|
all: gen_prg_rule
|
|
endif
|
|
|
|
include $(LIB_PROGRESS_LOG)
|
|
LIBS_TO_VISIT = $(filter-out $(LIBS_READY),$(LIBS))
|
|
|
|
#
|
|
# Generate program rule
|
|
#
|
|
gen_prg_rule:
|
|
ifneq ($(LIBS),)
|
|
@(echo "DEP_$(TARGET).prg = $(foreach l,$(LIBS),$l.lib \$$(DEP_$l.lib))"; \
|
|
echo "") >> $(LIB_DEP_FILE)
|
|
endif
|
|
ifneq ($(DEP_MISSING_PORTS),)
|
|
@(echo "MISSING_PORTS += $(DEP_MISSING_PORTS)"; \
|
|
echo "") >> $(LIB_DEP_FILE)
|
|
endif
|
|
@(echo "$(TARGET).prg: check_ports $(addsuffix .lib,$(LIBS))"; \
|
|
echo " @\$$(MKDIR) -p $(PRG_REL_DIR)"; \
|
|
echo " \$$(VERBOSE_MK)\$$(MAKE) $(VERBOSE_DIR) -C $(PRG_REL_DIR) -f \$$(BASE_DIR)/mk/prg.mk \\"; \
|
|
echo " REP_DIR=$(REP_DIR) \\"; \
|
|
echo " PRG_REL_DIR=$(PRG_REL_DIR) \\"; \
|
|
echo " BUILD_BASE_DIR=$(BUILD_BASE_DIR) \\"; \
|
|
echo " DEPS=\"\$$(DEP_$(TARGET).prg)\" \\"; \
|
|
echo " SHELL=$(SHELL) \\"; \
|
|
echo " INSTALL_DIR=\"\$$(INSTALL_DIR)\""; \
|
|
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
|