build: replace argument dispatch and retain source-bound verification
Replace argument recovery with direct build targets. Run host, target, board, coverage, Miri and selected Kani checks while retaining source identities, logs and artifacts, including failed attempts. Keep the PID proof diagnostic exception explicit and match its exact identity alongside passing contract assertions and covers. Validation: final-source verification matrix, assembled workflow tests and documentation build.
This commit is contained in:
1 parent
4953f0a974
commit
62b18d5b2e
26 files changed
+2177
-1052
No files matched your search
@@ -1,115 +1,88 @@
|
||||
override SHELL := /bin/sh
|
||||
override MAKEFLAGS += --no-print-directory
|
||||
SHELL := /bin/sh
|
||||
MAKEFLAGS += --no-print-directory
|
||||
export CARGO_BUILD_JOBS ?= 2
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
override FIRMWARE_DIR := firmware
|
||||
override DOCS_DIR := docs
|
||||
override CONFIGURATOR_DIR := firmware/tools/configurator
|
||||
override BOARD_DIRS := $(patsubst %/,%,$(wildcard firmware/boards/*/))
|
||||
|
||||
override COMPONENT_TARGETS := $(FIRMWARE_DIR) $(DOCS_DIR) firmware/boards $(BOARD_DIRS) \
|
||||
$(CONFIGURATOR_DIR)
|
||||
|
||||
override PRIMARY_GOAL := $(firstword $(MAKECMDGOALS))
|
||||
override ROUTED_GOAL := $(filter $(PRIMARY_GOAL),$(COMPONENT_TARGETS))
|
||||
|
||||
ifneq ($(ROUTED_GOAL),)
|
||||
|
||||
# The dispatcher reads the original argv so application arguments retain their
|
||||
# ordering and boundaries even when Make interprets them as goals or variables.
|
||||
override ROUTE_DEFAULT_TARGET := run
|
||||
override ROUTE_LOCAL_TARGETS := help
|
||||
ifeq ($(PRIMARY_GOAL),$(FIRMWARE_DIR))
|
||||
override ROUTE_LOCAL_TARGETS += fmt clippy test docs pre-commit check clean
|
||||
endif
|
||||
ifeq ($(PRIMARY_GOAL),$(DOCS_DIR))
|
||||
override ROUTE_DEFAULT_TARGET := check
|
||||
override ROUTE_LOCAL_TARGETS += check
|
||||
endif
|
||||
ifneq ($(filter $(PRIMARY_GOAL),$(BOARD_DIRS)),)
|
||||
override ROUTE_LOCAL_TARGETS += flash
|
||||
endif
|
||||
|
||||
.PHONY: $(PRIMARY_GOAL)
|
||||
|
||||
$(PRIMARY_GOAL):
|
||||
+@exec python3 scripts/make-argv.py route "$(PRIMARY_GOAL)" make \
|
||||
$(ROUTE_DEFAULT_TARGET) $(ROUTE_LOCAL_TARGETS)
|
||||
|
||||
# Additional command-line words are application arguments, not outer targets.
|
||||
.DEFAULT:
|
||||
@:
|
||||
|
||||
else
|
||||
|
||||
.PHONY: help nix-shell build fmt test pre-commit check clean
|
||||
.NOTPARALLEL:
|
||||
.PHONY: help nix-shell build boards docs configurator fmt test app-native-test coverage verification verification-tools miri kani verification-inventory pre-commit check clean
|
||||
|
||||
help: ## Show the command interface (the default)
|
||||
@printf '%s\n' 'Kaptan developer commands' '' \
|
||||
'Usage: make <directory> -- [arguments...]' \
|
||||
' make <directory> help' \
|
||||
'' 'The -- is the standard end of Make options; application flags follow it.' \
|
||||
'' 'Repository workflows' \
|
||||
'Usage: make <target>' '' \
|
||||
' help Show this help' \
|
||||
' nix-shell Enter the Nix development shell' \
|
||||
' build Build all firmware and documentation' \
|
||||
' boards Build and package every board' \
|
||||
' docs Test and build the mdBook project' \
|
||||
' configurator Start the local configurator web application' \
|
||||
' fmt Check Rust, shell, Python, Nix, and TOML formatting' \
|
||||
' test Run Rust and script tests' \
|
||||
' test Run shared-library, host algorithm, and script tests' \
|
||||
' app-native-test Check the app UTF conversion function with a host API stub' \
|
||||
' coverage Required final strict-core line/branch coverage gate' \
|
||||
' verification Run all gates and retain source-bound evidence' \
|
||||
' verification-tools Install the pinned Miri and Kani tools' \
|
||||
' miri Run the manifest-selected Miri checks' \
|
||||
' kani Run the manifest-selected Kani proofs' \
|
||||
' verification-inventory Show verification owners, claims and gaps' \
|
||||
' pre-commit Run fmt, firmware clippy/test/docs, and mdBook checks' \
|
||||
' check Run pre-commit plus whitespace checks' \
|
||||
' clean Remove generated build artifacts' \
|
||||
'' 'Directory targets' \
|
||||
' firmware <target> fmt, clippy, test, docs, pre-commit, check, or clean' \
|
||||
' firmware -- <cargo args...> Pass other arguments to cargo' \
|
||||
' firmware/boards -- <args...>' \
|
||||
' Build and package every board; args go to cargo build' \
|
||||
' firmware/boards/<board> -- <args...>' \
|
||||
' Build and package one board; args go to cargo build' \
|
||||
' firmware/boards/<board> flash -- <dfu-util args...>' \
|
||||
' Build, package, and flash one board over DFU' \
|
||||
' docs Test and build the mdBook project' \
|
||||
' docs -- <mdbook args...> Pass explicit arguments to mdbook' \
|
||||
' firmware/tools/configurator -- <args...>' \
|
||||
' Pass args to kaptan-configurator' \
|
||||
'' 'Examples' \
|
||||
' make firmware -- test --workspace --locked --offline' \
|
||||
' make firmware clippy' \
|
||||
' make firmware docs' \
|
||||
' make firmware/boards/kakute-f7-mini-v3' \
|
||||
' make firmware/boards/kakute-f7-mini-v3 flash' \
|
||||
' make docs -- build' \
|
||||
' make firmware/tools/configurator'
|
||||
'' 'Component workflows' \
|
||||
' make -C firmware help' \
|
||||
' make -C firmware/boards/<board> build|flash' \
|
||||
' make -C docs build|test|check|clean' \
|
||||
'' 'Native tools (run from firmware/)' \
|
||||
' make test' \
|
||||
' cargo run --locked --offline -p kaptan-configurator -- --baud 115200'
|
||||
|
||||
nix-shell: ## Enter the reproducible Nix development shell
|
||||
nix develop
|
||||
|
||||
build: ## Build all firmware boards and documentation
|
||||
+@$(MAKE) -C firmware/boards run
|
||||
+@$(MAKE) -C $(DOCS_DIR) run -- build
|
||||
build: boards ## Build all firmware boards and documentation
|
||||
+@$(MAKE) -C docs build
|
||||
|
||||
boards:
|
||||
+@$(MAKE) -C firmware/boards build
|
||||
|
||||
docs:
|
||||
+@$(MAKE) -C docs check
|
||||
|
||||
configurator:
|
||||
+@$(MAKE) -C firmware/tools/configurator run
|
||||
|
||||
fmt:
|
||||
+@$(MAKE) -C $(FIRMWARE_DIR) fmt
|
||||
+@$(MAKE) -C firmware fmt
|
||||
shfmt -d $$(rg --files -g '*.sh')
|
||||
ruff format --check $$(rg --files -g '*.py')
|
||||
ruff check firmware/scripts
|
||||
nixfmt --check $$(rg --files -g '*.nix')
|
||||
taplo format --check $$(rg --files -g '*.toml')
|
||||
|
||||
test:
|
||||
python3 -m unittest scripts/test-make-argv.py
|
||||
+@$(MAKE) -C $(FIRMWARE_DIR) test
|
||||
+@$(MAKE) -C firmware test
|
||||
+@$(MAKE) app-native-test
|
||||
|
||||
app-native-test:
|
||||
python3 ground_suite/windows/runner/test_utf8_from_utf16.py \
|
||||
--work-dir "$(or $(CARGO_TARGET_DIR),target)/native-tests/utf8"
|
||||
|
||||
coverage:
|
||||
+@$(MAKE) -C firmware coverage
|
||||
|
||||
verification verification-tools miri kani verification-inventory:
|
||||
+@$(MAKE) -C firmware $@
|
||||
|
||||
pre-commit: fmt test
|
||||
+@$(MAKE) -C $(FIRMWARE_DIR) clippy
|
||||
+@$(MAKE) -C $(FIRMWARE_DIR) docs
|
||||
+@$(MAKE) -C $(DOCS_DIR) check
|
||||
+@$(MAKE) -C firmware clippy
|
||||
+@$(MAKE) -C firmware docs
|
||||
+@$(MAKE) -C docs check
|
||||
@printf '%s\n' 'Pre-commit passed. Coverage was not run; make coverage is a required final gate.'
|
||||
|
||||
check: pre-commit ## Run pre-commit plus whitespace checks
|
||||
git diff HEAD --check
|
||||
|
||||
clean: ## Remove firmware and documentation build artifacts
|
||||
+@$(MAKE) -C $(FIRMWARE_DIR) clean
|
||||
+@$(MAKE) -C $(DOCS_DIR) run -- clean
|
||||
|
||||
endif
|
||||
+@$(MAKE) -C firmware clean
|
||||
+@$(MAKE) -C docs clean
|
||||
Reference in new issue
Block a user