Files
kaptan/firmware/Makefile
T
Onur Özkan 84807dde4e fix(diagnostics): bound formatting and release ingress before callbacks
Bound UTF-8 formatting and release diagnostic ingress before invoking
callbacks. Check error-ID collisions at Rust/C++ release final link.

Validation: diagnostic tests, strict Clippy, Miri and final-link cases.
2026-11-07 18:12:11 +03:00

81 lines
2.2 KiB
Makefile

override SHELL := /bin/sh
override MAKEFLAGS += --no-print-directory
export CARGO_BUILD_JOBS ?= 2
.DEFAULT_GOAL := help
.DELETE_ON_ERROR:
override CARGO := cargo
override PYTHON := python3
override CARGO_FLAGS := --locked --offline
override BOARDS := geprc-f722-v2 kakute-f7-mini-v3
override BOARD_PACKAGES := $(addprefix kaptan-,$(BOARDS))
override BOARD_PACKAGE_ARGS := $(addprefix -p ,$(BOARD_PACKAGES))
override HOST_EXCLUDES := $(addprefix --exclude ,$(BOARD_PACKAGES))
override PRIMARY_GOAL := $(firstword $(MAKECMDGOALS))
run:
@exec python3 ../scripts/make-argv.py exec run $(CARGO)
ifeq ($(PRIMARY_GOAL),run)
.PHONY: run
# Application arguments may also look like Make goals. The run recipe recovers
# their exact boundaries from the original invocation.
.DEFAULT:
@:
else
.PHONY: help run fmt clippy test native-test docs pre-commit check clean
help:
@printf '%s\n' 'Usage: make firmware -- <cargo arguments...>' '' \
'Example: make firmware -- test --workspace --locked --offline' '' \
'Workspace targets:' \
' fmt Check Rust formatting' \
' clippy Run host and embedded Clippy checks' \
' test Run Rust and firmware script tests' \
' native-test Check cross-crate error IDs at Rust/C++ release final link' \
' docs Build Rust API documentation with warnings denied' \
' pre-commit Run fmt, clippy, test, and docs' \
' check Alias for pre-commit' \
' clean Remove Cargo build artifacts'
fmt:
$(CARGO) fmt --all --check
clippy:
$(CARGO) clippy --workspace --all-targets $(HOST_EXCLUDES) \
$(CARGO_FLAGS) -- -D warnings
$(CARGO) clippy -p platform-stm32f7 --all-targets \
$(CARGO_FLAGS) -- -D warnings
$(CARGO) clippy $(BOARD_PACKAGE_ARGS) --target thumbv7em-none-eabihf \
$(CARGO_FLAGS) -- -D warnings
test:
$(CARGO) test --workspace $(CARGO_FLAGS)
$(PYTHON) -m unittest \
scripts/test-analyze-fw.py scripts/test-summarize-test-coverage.py
+@$(MAKE) native-test
native-test:
python3 libs/kaptan-err-reportable-macros/tests/final_link.py \
--work-dir "$(or $(CARGO_TARGET_DIR),target)/native-tests/final-link"
docs:
RUSTDOCFLAGS='-D warnings' $(CARGO) doc --workspace --no-deps \
$(HOST_EXCLUDES) $(CARGO_FLAGS)
pre-commit: fmt clippy test docs
check: pre-commit
clean:
$(CARGO) clean
endif