CARGO ?= cargo
FEATURES ?= --all-features
.PHONY: help init audit fmt fmt-check clippy clippy-fix check test lint build pre-commit verify
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
init:
$(CARGO) install cargo-audit cargo-hack --locked
fmt:
$(CARGO) fmt --all
audit:
$(CARGO) audit
fmt-check:
$(CARGO) fmt --all -- --check
clippy:
$(CARGO) clippy $(FEATURES) --all-targets -- -D warnings
clippy-fix:
$(CARGO) clippy $(FEATURES) --all-targets --fix --allow-dirty --allow-staged
check:
$(CARGO) hack check --each-feature
$(CARGO) hack check --feature-powerset
test:
$(CARGO) test $(FEATURES)
lint: fmt-check clippy
build:
$(CARGO) build $(FEATURES) --release
pre-commit: fmt-check clippy check
pre-push: audit test
verify: pre-commit pre-push