.PHONY: all
all: help
.PHONY: build
build:
@echo "Building all project components..."
@cargo build --all
.PHONY: lint
lint: ensure-clippy
@echo "Linting with Clippy..."
@cargo clippy --all-features --all-targets --all -- \
--deny clippy::dbg_macro --deny clippy::unimplemented --deny clippy::todo --deny warnings \
--deny missing_docs --deny broken_intra_doc_links --forbid unused_must_use --deny clippy::result_unit_err
.PHONY: test
test:
@echo "Running tests..."
@cargo test
.PHONY: check
check:
@echo "Checking code formatting..."
@cargo check
.PHONY: format
format: ensure-rustfmt
@echo "Formatting all project components..."
@cargo fmt --all
.PHONY: format-check-verbose
format-check-verbose: ensure-rustfmt
@echo "Checking code format with verbose output..."
@cargo fmt --all -- --check --verbose
.PHONY: fix
fix: ensure-cargo-fix
@echo "Applying cargo fix..."
@cargo fix --all
.PHONY: deny
deny: ensure-cargo-deny
@echo "Running cargo deny checks..."
@cargo deny check
.PHONY: outdated
outdated: ensure-cargo-outdated
@echo "Checking for outdated dependencies..."
@cargo outdated --root-deps-only
.PHONY: ensure-clippy ensure-rustfmt ensure-cargo-fix ensure-cargo-deny ensure-cargo-outdated
ensure-clippy:
@cargo clippy --version || rustup component add clippy
ensure-rustfmt:
@cargo fmt --version || rustup component add rustfmt
ensure-cargo-fix:
@cargo fix --version || rustup component add rustfix
ensure-cargo-deny:
@command -v cargo-deny || cargo install cargo-deny
ensure-cargo-outdated:
@command -v cargo-outdated || cargo install cargo-outdated
.PHONY: help
help:
@echo "Usage: make [target]..."
@echo ""
@echo "Targets:"
@awk 'BEGIN {FS = ":.*?##"} /^[a-zA-Z_-]+:.*?##/ {printf " %-30s %s\n", $$1, $$2}' $(MAKEFILE_LIST)