toolchain: report missing ports at once

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
This commit is contained in:
Martin Stein 2016-02-04 12:20:03 +01:00 committed by Christian Helmuth
parent 992a5ec1ae
commit ff10687a6c
9 changed files with 72 additions and 10 deletions

View File

@ -6,6 +6,12 @@
# userland (L4re) that comes with Fiasco.OC.
#
#
# We do this also in the first build stage to ensure that the kernel
# port, if missing, is added to the missing-ports list of this stage.
#
FOC_CONTRIB_DIR := $(call select_from_ports,foc)/src/kernel/foc
#
# Execute the rules in this file only at the second build stage when we know
# about the complete build settings, e.g., the 'CROSS_DEV_PREFIX'.
@ -26,8 +32,6 @@ $(BUILD_BASE_DIR)/include/%:
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)ln -sf $(L4_BUILD_DIR)/include/$* $@
FOC_CONTRIB_DIR := $(call select_from_ports,foc)/src/kernel/foc
#
# Create L4 build directory
#

View File

@ -9,3 +9,11 @@ SPECS += pci ps2 vesa framebuffer
# Linker options that are specific for x86
#
LD_TEXT_ADDR ?= 0x01000000
#
# We would normally have to do this only in the kernel lib. We do it in
# general nonetheless to ensure that the kernel port, if missing, is added to
# the missing-ports list of the first build stage. The kernel lib is evaluated
# only at a later build stage.
#
NOVA_SRC_DIR := $(call select_from_ports,nova)/src/kernel/nova

View File

@ -1,6 +1,7 @@
include $(call select_from_repositories,mk/spec/nova.mk)
TARGET = hypervisor
REQUIRES = x86 nova
NOVA_SRC_DIR = $(call select_from_ports,nova)/src/kernel/nova
NOVA_BUILD_DIR = $(BUILD_BASE_DIR)/kernel
STARTUP_LIB =
SRC_CC = $(sort $(notdir $(wildcard $(NOVA_SRC_DIR)/src/*.cpp)))

View File

@ -9,9 +9,15 @@
-include $(BUILD_BASE_DIR)/etc/okl4.conf
#
# If no OKL4 source directory is set, we use the standard contrib directory
# If no OKL4 source directory is set, we use the standard contrib directory.
# We do this with ifeq and := as ?= would be done lazy. Forcing the
# evaluation of $(call select_from_ports,okl4) ensures that the kernel
# port, if missing, is added to the missing-ports list of the first build
# stage.
#
OKL4_DIR ?= $(call select_from_ports,okl4)/src/kernel/okl4
ifeq ($(OKL4_DIR),)
OKL4_DIR := $(call select_from_ports,okl4)/src/kernel/okl4
endif
#
# Make sure that symlink modification times are handled correctly.

View File

@ -5,14 +5,18 @@
# symlinked to the build directory.
#
#
# We do this also in the first build stage to ensure that the kernel
# port, if missing, is added to the missing-ports list of this stage.
#
LIBSEL4_DIR := $(call select_from_ports,sel4)/src/kernel/sel4/libsel4
#
# Execute the rules in this file only at the second build stage when we know
# about the complete build settings, e.g., the 'CROSS_DEV_PREFIX'.
#
ifeq ($(called_from_lib_mk),yes)
LIBSEL4_DIR := $(call select_from_ports,sel4)/src/kernel/sel4/libsel4
#
# Make seL4 kernel API headers available to the Genode build system
#

View File

@ -16,6 +16,8 @@
# INSTALL_DIR - destination directory for installing shared libraries
#
ACCUMULATE_MISSING_PORTS = 1
#
# Include common utility functions
#
@ -132,7 +134,11 @@ ifneq ($(LIBS),)
@(echo "$(DEP_VAR_NAME) = $(foreach l,$(LIBS),$l.lib \$$(DEP_$l.lib))"; \
echo "") >> $(LIB_DEP_FILE)
endif
@(echo "$(LIB).lib: $(addsuffix .lib,$(LIBS))"; \
ifneq ($(DEP_MISSING_PORTS),)
@(echo "MISSING_PORTS += $(DEP_MISSING_PORTS)"; \
echo "") >> $(LIB_DEP_FILE)
endif
@(echo "$(LIB).lib: check_ports $(addsuffix .lib,$(LIBS))"; \
echo " @\$$(MKDIR) -p \$$(LIB_CACHE_DIR)/$(LIB)"; \
echo " \$$(VERBOSE_MK)\$$(MAKE) $(VERBOSE_DIR) -C \$$(LIB_CACHE_DIR)/$(LIB) -f \$$(BASE_DIR)/mk/lib.mk \\"; \
echo " REP_DIR=$(REP_DIR) \\"; \

View File

@ -3,6 +3,8 @@
#
all:
ACCUMULATE_MISSING_PORTS = 1
#
# Include common utility functions
#
@ -53,7 +55,11 @@ ifneq ($(LIBS),)
@(echo "DEP_$(TARGET).prg = $(foreach l,$(LIBS),$l.lib \$$(DEP_$l.lib))"; \
echo "") >> $(LIB_DEP_FILE)
endif
@(echo "$(TARGET).prg: $(addsuffix .lib,$(LIBS))"; \
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) \\"; \

View File

@ -40,6 +40,18 @@ _lookup_port_hash_file = $(wildcard $(addsuffix /ports/$1.hash,$(REPOSITORIES))
_capture_port_hash_file = $(call _capture,$(call _lookup_port_hash_file,$1),PORT_HASH_FILES)
_hash_of_port = $(shell echo | cat $(call _capture_port_hash_file,$1))
_port_dir = $(wildcard $(CONTRIB_DIR)/$1-$(call _hash_of_port,$1))
_checked_port_dir = $(call _assert,$(call _port_dir,$1),$1 is not prepared or outdated)
#
# We accumulate missing ports instead of stopping only if the environment
# explicitely states that it is aware of it. This ensures that environments
# that are not aware can't run into troubles with missing ports.
#
ifeq (ACCUMULATE_MISSING_PORTS,)
_checked_port_dir = $(call _assert,$(call _port_dir,$1),$1 is not prepared or outdated)
else
_port_missing = $(eval DEP_MISSING_PORTS += $1)
_checked_port = $(if $2,$2,$(call _port_missing,$1))
_checked_port_dir = $(call _checked_port,$1,$(call _port_dir,$1))
endif
select_from_ports = $(call _checked_port_dir,$1)

View File

@ -221,6 +221,21 @@ $(INSTALL_DIR):
.PHONY: gen_deps_and_build_targets
gen_deps_and_build_targets: $(INSTALL_DIR) $(LIB_DEP_FILE)
@(echo ""; \
echo "ifneq (\$$(MISSING_PORTS),)"; \
echo "check_ports:"; \
echo " @echo \"\""; \
echo " @echo \"Error: Ports not prepared or outdated:\""; \
echo " @echo \" \$$(sort \$$(MISSING_PORTS))\""; \
echo " @echo \"\""; \
echo " @echo \"You can prepare respectively update them as follows:\""; \
echo " @echo \" <genode_dir>/tool/ports/prepare_port \$$(sort \$$(MISSING_PORTS))\""; \
echo " @echo \"\""; \
echo " @false"; \
echo "else"; \
echo "check_ports:"; \
echo "endif"; \
echo "") >> $(LIB_DEP_FILE)
@$(VERBOSE_MK)$(MAKE) $(VERBOSE_DIR) -f $(LIB_DEP_FILE) all
.PHONY: again