.DEFAULT_GOAL := help
.PHONY: help test coverage coverage-html build build-release install clean fmt fmt-check lint check doc doc-check all ci ensure-tools inspect schema
CARGO_NEXTEST := $(shell command -v cargo-nextest 2>/dev/null)
CARGO_LLVM_COV := $(shell command -v cargo-llvm-cov 2>/dev/null)
ensure-tools:
ifndef CARGO_NEXTEST
@echo "Installing cargo-nextest..."
@cargo install cargo-nextest --locked
endif
ifndef CARGO_LLVM_COV
@echo "Installing cargo-llvm-cov..."
@cargo install cargo-llvm-cov --locked
endif
help:
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
test: ensure-tools
cargo nextest run --all-features
coverage: ensure-tools
cargo llvm-cov nextest --all-features
coverage-html: ensure-tools
cargo llvm-cov nextest --all-features --html --open
build:
cargo build --all-targets --all-features
build-release:
cargo build --all-targets --all-features --release
install:
cargo install --path .
check:
cargo check --all-targets --all-features
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all -- --check
lint:
cargo clippy --all-targets --all-features -- -D warnings
clean:
cargo clean
doc:
cargo doc --no-deps --open
doc-check:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
all: ensure-tools fmt lint build test
ci: ensure-tools fmt-check lint build doc-check test
inspect: build
npx @modelcontextprotocol/inspector cargo run
schema: build
cargo run -- --schema