2017-03-28 16:41:41 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
|
|
|
#
|
|
|
|
# \brief Tool for determining the dependencies of depot content
|
|
|
|
# \author Norman Feske
|
|
|
|
# \date 2017-03-17
|
|
|
|
#
|
|
|
|
|
|
|
|
define HELP_MESSAGE
|
|
|
|
|
|
|
|
Show the dependencies of depot content
|
|
|
|
|
|
|
|
usage:
|
|
|
|
|
|
|
|
$(firstword $(MAKEFILE_LIST)) <archive-path>...
|
|
|
|
|
|
|
|
This tool operates solely on the depot content. It prints the
|
|
|
|
result only if all dependencies are present within the depot.
|
|
|
|
Otherwise, the missing archives are given as an error message.
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..)
|
|
|
|
|
2022-05-17 12:17:01 +00:00
|
|
|
DEPOT_TOOL_DIR ?= $(GENODE_DIR)/tool/depot
|
|
|
|
|
|
|
|
include $(DEPOT_TOOL_DIR)/mk/front_end.inc
|
|
|
|
include $(DEPOT_TOOL_DIR)/mk/categorize_args.inc
|
2017-03-28 16:41:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Collect dependencies for all specified arguments
|
|
|
|
#
|
|
|
|
|
|
|
|
api_file = $(addsuffix /api,$(addprefix $(DEPOT_DIR)/,$1))
|
|
|
|
|
|
|
|
used_apis_file = $(addsuffix /used_apis,$(addprefix $(DEPOT_DIR)/,$1))
|
|
|
|
|
|
|
|
_pkg_archives_of_type = $(call grep_archive_type,$1,\
|
|
|
|
$(call file_content,\
|
|
|
|
$(addsuffix /archives,$(addprefix $(DEPOT_DIR)/,$2))))
|
|
|
|
|
|
|
|
pkg_src_archives = $(call _pkg_archives_of_type,src,$1)
|
|
|
|
pkg_raw_archives = $(call _pkg_archives_of_type,raw,$1)
|
|
|
|
pkg_pkg_archives = $(call _pkg_archives_of_type,pkg,$1)
|
|
|
|
|
2022-05-17 12:17:01 +00:00
|
|
|
include $(DEPOT_TOOL_DIR)/mk/dependencies.inc
|
2017-03-28 16:41:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
2017-12-13 11:12:08 +00:00
|
|
|
# Validate and print gathered information
|
2017-03-28 16:41:41 +00:00
|
|
|
#
|
|
|
|
|
2017-12-13 11:12:08 +00:00
|
|
|
# select function for determining the archive version depending on archive type
|
|
|
|
_archive_version(bin) = bin_archive_version
|
2023-11-23 14:02:43 +00:00
|
|
|
_archive_version(dbg) = bin_archive_version
|
2017-12-13 11:12:08 +00:00
|
|
|
_archive_version(src) = archive_version
|
|
|
|
_archive_version(api) = archive_version
|
|
|
|
_archive_version(raw) = archive_version
|
|
|
|
_archive_version(pkg) = archive_version
|
|
|
|
|
|
|
|
_version_defined = ${call ${_archive_version(${call archive_type,$1})},$1}
|
|
|
|
|
2023-11-23 14:02:43 +00:00
|
|
|
NEEDED_ARCHIVES := $(foreach TYPE,pkg src raw api bin dbg,${ARCHIVES(${TYPE})})
|
2017-12-13 11:12:08 +00:00
|
|
|
|
|
|
|
# check for completeness of archive-path arguments
|
|
|
|
NO_VERSION_ARCHIVES := $(sort $(foreach A,$(NEEDED_ARCHIVES),\
|
|
|
|
$(if $(call _version_defined,$A),,$A)))
|
|
|
|
|
|
|
|
# check for existence of archive paths in depot
|
2017-03-28 16:41:41 +00:00
|
|
|
MISSING_ARCHIVES := $(sort $(foreach A,$(NEEDED_ARCHIVES),\
|
|
|
|
$(if $(wildcard $(addprefix $(DEPOT_DIR)/,$A)),,$A)))
|
|
|
|
checked_completeness:
|
2017-12-13 11:12:08 +00:00
|
|
|
ifneq ($(NO_VERSION_ARCHIVES),)
|
|
|
|
@echo "Error: version not specified:"; \
|
|
|
|
for i in $(NO_VERSION_ARCHIVES); do echo " $$i"; done; false
|
|
|
|
endif
|
2017-03-28 16:41:41 +00:00
|
|
|
ifneq ($(MISSING_ARCHIVES),)
|
|
|
|
@echo "Error: incomplete or missing archives:"; \
|
|
|
|
for i in $(MISSING_ARCHIVES); do echo " $$i"; done; false
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(MAKECMDGOALS): checked_completeness
|
|
|
|
@for i in $(NEEDED_ARCHIVES); do echo $$i; done
|
|
|
|
|