64 lines
1.6 KiB
Makefile
Raw Normal View History

2026-05-21 16:16:14 +02:00
# Storage engine playground helpers.
2026-05-21 12:28:09 +02:00
2026-05-21 16:16:14 +02:00
HAS_CARGO := $(wildcard Cargo.toml)
2026-05-21 12:28:09 +02:00
.DEFAULT_GOAL := help
.PHONY: help
help: ## Show help messages for all available targets
@grep -E '^[a-zA-Z_-]+:.*## .*$$' Makefile | \
awk 'BEGIN {FS = ":.*## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: fmt
2026-05-21 16:16:14 +02:00
fmt: ## Format Rust code
@if [ -z "$(HAS_CARGO)" ]; then \
echo "No Cargo.toml found. Skipping Rust formatting."; \
else \
cargo fmt --all; \
fi
2026-05-21 12:28:09 +02:00
.PHONY: fmt-check
2026-05-21 16:16:14 +02:00
fmt-check: ## Check Rust formatting
@if [ -z "$(HAS_CARGO)" ]; then \
echo "No Cargo.toml found. Skipping Rust format check."; \
else \
cargo fmt --all --check; \
fi
2026-05-21 12:28:09 +02:00
2026-05-21 16:16:14 +02:00
.PHONY: clippy
clippy: ## Run Clippy for all targets and features
@if [ -z "$(HAS_CARGO)" ]; then \
echo "No Cargo.toml found. Skipping Clippy."; \
else \
cargo clippy --all-targets --all-features -- -D warnings; \
fi
2026-05-21 12:28:09 +02:00
2026-05-21 16:16:14 +02:00
.PHONY: test
test: ## Run Rust tests for all targets and features
@if [ -z "$(HAS_CARGO)" ]; then \
echo "No Cargo.toml found. Skipping Rust tests."; \
else \
cargo test --all-targets --all-features; \
fi
2026-05-21 12:28:09 +02:00
.PHONY: check
2026-05-21 16:16:14 +02:00
check: fmt-check clippy test ## Run all Rust checks
2026-05-21 12:28:09 +02:00
.PHONY: clean
2026-05-21 16:16:14 +02:00
clean: ## Remove build output
@if [ -z "$(HAS_CARGO)" ]; then \
echo "No Cargo.toml found. Nothing to clean."; \
else \
cargo clean; \
fi
2026-05-21 12:28:09 +02:00
.PHONY: setup-hooks
2026-05-21 16:16:14 +02:00
setup-hooks: ## Install Git hooks with pre-commit
2026-05-21 12:28:09 +02:00
@pre-commit install --hook-type pre-commit
@pre-commit install --hook-type pre-push
@pre-commit install-hooks
.PHONY: test-hooks
test-hooks: ## Run pre-commit hooks across all files
@pre-commit run --all-files --show-diff-on-failure