_toko_tooling_default_goal := $(.DEFAULT_GOAL)
include $(dir $(lastword $(MAKEFILE_LIST)))execution.mk
ifndef TOKO_TOOLING_ROOT
TOKO_TOOLING_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))..)
endif
HOST_TOOL_VERSIONS ?= $(TOKO_TOOLING_ROOT)/ci/tool-versions.env
RUST_TOOL_VERSIONS ?= $(TOKO_TOOLING_ROOT)/ci/tool-versions.env
IC_TOOL_PINS ?= $(TOKO_TOOLING_ROOT)/ci/ic-tools.tsv
IC_TOOLS ?=
LOCAL_TOOL_INSTALL_TARGETS ?=
LOCAL_TOOL_CHECK_TARGETS ?=
CLOC_REPORT ?= $(TOKO_TOOLING_ROOT)/scripts/dev/cloc.sh
CLOC_ROOT ?= $(CURDIR)
CLOC_MANIFEST ?=
CLOC_DEPTH ?=
export PATH := $(CURDIR)/.tools/host/bin:$(CURDIR)/.tools/rust/common/bin:$(PATH)
.PHONY: install-tools tools-check install-host-tools host-tools-check install-ic-tools ic-tools-check cloc
.PHONY: install-rust-tools rust-tools-check
install-tools tools-check tools-report install-host-tools host-tools-check install-ic-tools ic-tools-check install-rust-tools rust-tools-check cloc: | toko-execution-check
install-tools:
ifneq ($(filter install-ic-tools,$(LOCAL_TOOL_INSTALL_TARGETS)),)
bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-ic-tools.sh" --consumer "$(CURDIR)" --pins "$(IC_TOOL_PINS)" $(foreach tool,$(IC_TOOLS),--tool "$(tool)") --preflight
endif
$(_toko_recursive_prefix)bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-rust-tools.sh" --consumer "$(CURDIR)" --versions "$(RUST_TOOL_VERSIONS)" --preflight
$(_toko_recursive_prefix)$(_toko_recursive_make) --no-print-directory install-host-tools
$(_toko_recursive_prefix)$(_toko_recursive_make) --no-print-directory install-rust-tools
$(_toko_recursive_prefix)@for target in $(LOCAL_TOOL_INSTALL_TARGETS); do \
$(_toko_recursive_make) --no-print-directory "$$target" || exit "$$?"; done
tools-check:
$(_toko_recursive_prefix)$(_toko_recursive_make) --no-print-directory host-tools-check
$(_toko_recursive_prefix)$(_toko_recursive_make) --no-print-directory rust-tools-check
$(_toko_recursive_prefix)@for target in $(LOCAL_TOOL_CHECK_TARGETS); do \
$(_toko_recursive_make) --no-print-directory "$$target" || exit "$$?"; done
.PHONY: tools-report
tools-report:
$(_toko_recursive_prefix)@VALIDATION_REPOSITORY_ROOT="$(CURDIR)" bash "$(TOKO_TOOLING_ROOT)/scripts/ci/run-validation-targets.sh" \
host-tools-check rust-tools-check $(LOCAL_TOOL_CHECK_TARGETS)
install-host-tools:
bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-host-tools.sh" --consumer "$(CURDIR)" --versions "$(HOST_TOOL_VERSIONS)"
host-tools-check:
bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-host-tools.sh" --consumer "$(CURDIR)" --versions "$(HOST_TOOL_VERSIONS)" --check
install-ic-tools:
bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-ic-tools.sh" --consumer "$(CURDIR)" --pins "$(IC_TOOL_PINS)" $(foreach tool,$(IC_TOOLS),--tool "$(tool)")
ic-tools-check:
bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-ic-tools.sh" --consumer "$(CURDIR)" --pins "$(IC_TOOL_PINS)" $(foreach tool,$(IC_TOOLS),--tool "$(tool)") --check
install-rust-tools:
$(_toko_recursive_prefix)bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-rust-tools.sh" --consumer "$(CURDIR)" --versions "$(RUST_TOOL_VERSIONS)"
rust-tools-check:
$(_toko_recursive_prefix)bash "$(TOKO_TOOLING_ROOT)/scripts/dev/install-rust-tools.sh" --consumer "$(CURDIR)" --versions "$(RUST_TOOL_VERSIONS)" --check
cloc:
$(_toko_recursive_prefix)@if [ -n "$(CLOC_MANIFEST)" ]; then \
bash "$(TOKO_TOOLING_ROOT)/scripts/dev/cloc.sh" $(if $(strip $(CLOC_DEPTH)),-d "$(CLOC_DEPTH)") --manifest "$(CLOC_MANIFEST)" "$(CLOC_ROOT)"; \
else bash "$(CLOC_REPORT)" $(if $(strip $(CLOC_DEPTH)),-d "$(CLOC_DEPTH)") "$(CLOC_ROOT)"; fi
.DEFAULT_GOAL := $(_toko_tooling_default_goal)