.PHONY: help all clean test test-doc test-documentation-contracts test-wireframe-testing test-ui test-feature-gate test-pool-no-metrics unsafe-boundary bless-ui test-workflow-contracts test-loom doctest-benchmark
.PHONY: lint-python-docs
.PHONY: bench-codec bench-runtime-ownership bench build dev-build dev-test release lint fmt check-fmt markdownlint nixie typecheck
.PHONY: spelling
.PHONY: test-msrv package-crates publish-check test-release-scripts
.PHONY: install-lading publish-crates
.PHONY: lint-doc lint-clippy lint-whitaker
.PHONY: install-whitaker
.PHONY: install-kani check-kani-version install-verus run-verus test-verification kani \
kani-full verus formal-pr formal-nightly formal
CRATE ?= wireframe
CARGO ?= cargo
BUILD_JOBS ?=
DEV_FAST_CONFIG := tools/dev-fast/config.toml
DEV_FAST := --config $(DEV_FAST_CONFIG)
CARGO_BUILD_TARGET_OS ?=
BUILD_HOST_OS ?= $(shell uname -s)
DEV_EFFECTIVE_TARGET_OS = $(or $(CARGO_BUILD_TARGET_OS),$(if $(filter-out host-tuple,$(CARGO_BUILD_TARGET)),$(if $(findstring -unknown-linux-,$(CARGO_BUILD_TARGET)),Linux),$(BUILD_HOST_OS)))
DEV_LINUX_LINK_ARG := $(if $(filter Linux,$(BUILD_HOST_OS)),$(if $(filter Linux,$(DEV_EFFECTIVE_TARGET_OS)),-Clink-arg=-fuse-ld=mold))
DEV_THREADS_FLAG ?= -Zthreads=8
DEV_STANDARD_FLAGS = $(DEV_THREADS_FLAG) $(DEV_LINUX_LINK_ARG)
DEV_WARNING_FLAGS = $(strip $(RUSTFLAGS) -D warnings $(DEV_STANDARD_FLAGS))
DEV_BUILD_FLAGS = $(strip $(RUSTFLAGS) $(DEV_STANDARD_FLAGS))
RELEASE_BUILD_ENV = RUSTFLAGS="$${RUSTFLAGS-}"
DEV_BUILD_ENV = RUSTFLAGS="$(DEV_BUILD_FLAGS)"
BUILD_DOCUMENTATION_EXAMPLES = RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) \
build --example echo --example client_echo_login --all-features $(BUILD_JOBS)
CLIPPY_FLAGS ?= --workspace --all-targets --all-features -- -D warnings
DOC_FLAGS ?= --workspace --all-features --no-deps
RUSTDOC_FLAGS ?= --cfg docsrs -D warnings
MDLINT ?= $(shell command -v markdownlint-cli2 2>/dev/null || printf '%s' "$$HOME/.bun/bin/markdownlint-cli2")
MDTABLEFIX ?= mdtablefix
MDTABLEFIX_SELECT = --git --include-untracked
MDTABLEFIX_RULES = --wrap --renumber --breaks --ellipsis --fences
WHITAKER ?= whitaker
WHITAKER_INSTALLER ?= whitaker-installer
WHITAKER_INSTALLER_VERSION ?= 0.2.11
CARGO_DYLINT_VERSION ?= 6.3.0
DYLINT_LINK_VERSION ?= 6.3.0
WHITAKER_SUITE_REV ?= 487ad61b047ca7e93eba0cd1d5b1a5de3a8b29a6
WHITAKER_FLAGS ?= --all -- --workspace --all-targets --all-features
NIXIE_VERSION ?= 1.1.0
UV ?= uv
UV_ENV = UV_CACHE_DIR=.uv-cache UV_TOOL_DIR=.uv-tools
LADING ?= $(UV_ENV) $(UV) run --python 3.14 --project tools/lading --locked lading
LADING_INSTALLED ?= $(UV_ENV) $(UV) run --python 3.14 --project tools/lading --no-sync lading
PUBLISHED_CRATES ?= wireframe wireframe_testing
RELEASE_RUSTFLAGS ?= $(empty) $(empty)
EXPECTED_DIGESTS ?=
CV005_CONTRACTS_REF ?= f84a7def5646a6fc7ba77c1f486906f66a0fed96
CV005_CONTRACTS = $(UV_ENV) $(UV) tool run --python 3.13 \
--from 'git+https://github.com/leynos/shared-actions@$(CV005_CONTRACTS_REF)\#subdirectory=packages/cv005-contracts' \
cv005-contracts
NIXIE = $(UV_ENV) $(UV) tool run --python 3.14 \
--from nixie-cli@$(NIXIE_VERSION) nixie
TYPOS_CONFIG_BUILDER_VERSION ?= v0.1.3
TYPOS_CONFIG_BUILDER = $(UV_ENV) $(UV) tool run --python 3.14 --from \
"git+https://github.com/leynos/typos-config-builder.git@$(TYPOS_CONFIG_BUILDER_VERSION)" \
typos-config-builder
PYTHON_NO_BYTECODE_ENV := PYTHONDONTWRITEBYTECODE=1
PROVER_TOOLS_REF_FILE ?= tools/rust-prover-tools/REF
PROVER_TOOLS_REF ?= $(shell awk '/^ref:/ { print $$2 }' $(PROVER_TOOLS_REF_FILE))
PROVER_TOOLS_SOURCE ?= git+https://github.com/leynos/rust-prover-tools.git@$(PROVER_TOOLS_REF)
PROVER_TOOLS ?= uv tool run --python 3.14 --from "$(PROVER_TOOLS_SOURCE)" prover-tools
KANI_INSTALL_FLAGS ?= $(if $(and $(filter Linux,$(shell uname -s)),$(filter x86_64,$(shell uname -m))),,--compile)
VERUS_PROOF_FILE ?= verus/wireframe_proofs.rs
VERIFICATION_CRATE ?= wireframe-verification
LOOM_CRATE ?= wireframe-loom
LOOM_MAX_PREEMPTIONS ?= 3
FORMAL_STUB ?= ./scripts/formal-stub.sh
FORMAL_STRICT ?=
export FORMAL_STRICT
build: target/debug/lib$(CRATE).rlib
dev-build:
$(DEV_BUILD_ENV) $(CARGO) $(DEV_FAST) build $(BUILD_JOBS) --lib
dev-test: test
release: target/release/lib$(CRATE).rlib
all: release
clean:
$(CARGO) clean
test-bdd:
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) test --test bdd --all-features $(BUILD_JOBS)
test:
$(CARGO) fetch --locked --target "$${CARGO_BUILD_TARGET:-host-tuple}"
$(BUILD_DOCUMENTATION_EXAMPLES)
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) test --workspace --all-targets --all-features $(BUILD_JOBS)
test-wireframe-testing:
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) test -p wireframe_testing --all-targets --all-features $(BUILD_JOBS)
test-workflow-contracts:
$(CV005_CONTRACTS) check --repository .
$(PYTHON_NO_BYTECODE_ENV) uv run --with 'pytest>=8' --with 'pyyaml>=6' --with 'hypothesis>=6' pytest tests/workflow_contracts -q
test-loom:
LOOM_MAX_PREEMPTIONS=$(LOOM_MAX_PREEMPTIONS) RUSTFLAGS="--cfg loom" $(CARGO) test -p $(LOOM_CRATE) $(BUILD_JOBS)
CARGO_ENCODED_RUSTFLAGS="--cfg=loom" $(CARGO) test -p wireframe_testing --test loom_api_surface --features runtime-benchmarks $(BUILD_JOBS)
test-doc:
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) test --workspace --doc --all-features $(BUILD_JOBS)
test-documentation-contracts:
$(BUILD_DOCUMENTATION_EXAMPLES)
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) test --test documentation_examples --test documentation_examples_tests --all-features $(BUILD_JOBS)
test-ui:
$(CARGO) test --test compile_error
CARGO_ENCODED_RUSTFLAGS="--cfg=loom" $(CARGO) test -p wireframe_testing --test loom_api_surface --features runtime-benchmarks
test-feature-gate:
./scripts/check-feature-gate.sh
test-msrv:
./scripts/check-msrv.sh
package-crates:
RUSTFLAGS="$(RELEASE_RUSTFLAGS)" $(CARGO) package --locked $(addprefix -p ,$(PUBLISHED_CRATES))
install-lading:
$(UV_ENV) $(UV) sync --python 3.14 --project tools/lading --locked
publish-crates:
$(if $(strip $(EXPECTED_DIGESTS)),,$(error publish-crates needs EXPECTED_DIGESTS, the candidate's archive digests))
RUSTFLAGS="$(RELEASE_RUSTFLAGS)" $(LADING_INSTALLED) publish --workspace-root . --live --forbid-dirty --skip-preflight --expect-digests "$(EXPECTED_DIGESTS)"
test-release-scripts:
$(PYTHON_NO_BYTECODE_ENV) PYTHONPATH=scripts/release:scripts/release/tests \
$(UV) run --no-project --python 3.14 --with 'pytest>=8' --with 'hypothesis>=6' \
pytest -q -p no:cacheprovider --doctest-modules scripts/release
publish-check:
RUSTFLAGS="$(RELEASE_RUSTFLAGS)" $(LADING) publish --workspace-root .$(if $(strip $(EXPECTED_DIGESTS)), --expect-digests "$(EXPECTED_DIGESTS)")
test-pool-no-metrics:
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) check --lib --no-default-features --features pool,serializer-bincode $(BUILD_JOBS)
unsafe-boundary:
./scripts/check-unsafe-boundary.sh
bless-ui:
TRYBUILD=overwrite $(CARGO) test --test compile_error
CARGO_ENCODED_RUSTFLAGS="--cfg=loom" TRYBUILD=overwrite $(CARGO) test -p wireframe_testing --test loom_api_surface --features runtime-benchmarks
doctest-benchmark:
./scripts/doctest-benchmark.sh
bench-codec:
RUSTFLAGS="-D warnings" $(CARGO) bench --bench codec_performance --bench codec_performance_alloc --bench pipeline_performance --bench pipeline_performance_alloc --features test-support,benchmark-counters $(BUILD_JOBS)
bench-runtime-ownership:
RUSTFLAGS="-D warnings" $(CARGO) bench --bench runtime_ownership_baselines --bench runtime_ownership_baselines_alloc --features test-support,pool $(BUILD_JOBS)
bench: bench-codec bench-runtime-ownership
typecheck:
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) check --workspace --all-targets --all-features $(BUILD_JOBS)
target/%/lib$(CRATE).rlib:
$(if $(findstring release,$(@)),$(RELEASE_BUILD_ENV),$(DEV_BUILD_ENV)) $(CARGO) $(if $(findstring release,$(@)),,$(DEV_FAST)) build $(BUILD_JOBS) \
$(if $(findstring release,$(@)),--release) \
--lib
@ install -Dm644 \
target/$(if $(findstring release,$(@)),release,debug)/lib$(CRATE).rlib \
$@
.NOTPARALLEL: lint
lint: lint-doc lint-clippy lint-whitaker lint-python-docs yamllint actionlint
lint-python-docs:
$(PYTHON_NO_BYTECODE_ENV) uv run --no-project --python 3.14 --with 'interrogate>=1.7,<2' interrogate --fail-under 100 tests/workflow_contracts scripts/release
lint-doc:
RUSTFLAGS="$(DEV_WARNING_FLAGS)" RUSTDOCFLAGS="$(RUSTDOC_FLAGS)" $(CARGO) $(DEV_FAST) doc $(DOC_FLAGS)
lint-clippy:
RUSTFLAGS="$(DEV_WARNING_FLAGS)" $(CARGO) $(DEV_FAST) clippy $(CLIPPY_FLAGS)
lint-whitaker:
RUSTFLAGS="-D warnings" $(WHITAKER) $(WHITAKER_FLAGS)
install-whitaker:
$(CARGO) install --locked --version $(CARGO_DYLINT_VERSION) cargo-dylint
$(CARGO) install --locked --version $(DYLINT_LINK_VERSION) dylint-link
$(CARGO) install --locked --version $(WHITAKER_INSTALLER_VERSION) $(WHITAKER_INSTALLER)
$(WHITAKER_INSTALLER) --suite-version $(WHITAKER_SUITE_REV)
fmt:
$(CARGO) fmt --all
$(MDTABLEFIX) --in-place $(MDTABLEFIX_SELECT) $(MDTABLEFIX_RULES)
$(MDLINT) --fix "**/*.md"
check-fmt:
$(CARGO) fmt --all -- --check
$(MDTABLEFIX) --check $(MDTABLEFIX_SELECT) $(MDTABLEFIX_RULES)
markdownlint: spelling
$(MDLINT) "**/*.md"
spelling:
$(TYPOS_CONFIG_BUILDER) gate --repository . --scope all
nixie:
$(NIXIE) --no-sandbox
install-kani:
$(PROVER_TOOLS) kani install --repo-root . $(KANI_INSTALL_FLAGS)
check-kani-version:
$(PROVER_TOOLS) kani check-version --repo-root .
install-verus:
$(PROVER_TOOLS) verus install --repo-root .
run-verus:
$(PROVER_TOOLS) verus run --repo-root . --proof-file "$(VERUS_PROOF_FILE)"
test-verification:
RUSTFLAGS="-D warnings" $(CARGO) test -p $(VERIFICATION_CRATE) $(BUILD_JOBS)
kani:
@$(FORMAL_STUB) kani "roadmap 15.3.1 adds src/frame Kani smoke harnesses"
kani-full:
@$(FORMAL_STUB) kani-full "roadmap 15.3.x adds the full Kani harness set"
verus:
@$(FORMAL_STUB) verus "roadmap 15.5.2 adds verus/wireframe_proofs.rs"
formal-pr: test-verification kani verus
formal-nightly: test-verification kani-full verus
formal: formal-pr
help:
@grep -E '^[a-zA-Z_-]+:.*?##' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS=":"; printf "Available targets:\n"} {printf " %-20s %s\n", $$1, $$2}'
YAMLLINT ?= yamllint
ACTIONLINT ?= actionlint
.PHONY: yamllint actionlint
yamllint: SHELL := bash
yamllint: .SHELLFLAGS := -eo pipefail -c
yamllint:
git ls-files -z '*.yml' '*.yaml' | xargs -0 -r $(YAMLLINT) --strict --
actionlint:
$(ACTIONLINT)