.PHONY: help
help:
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
RUST_VERSION := 1.91
.PHONY: install-hooks
install-hooks:
git config core.hooksPath .githooks
@echo "Git hooks installed from .githooks/"
.PHONY: install-rust
install-rust:
rustup toolchain install $(RUST_VERSION)
rustup component add rustfmt clippy --toolchain $(RUST_VERSION)
.PHONY: check
check:
cargo +$(RUST_VERSION) check --all-features
.PHONY: fmt
fmt:
cargo +$(RUST_VERSION) fmt --all
.PHONY: fmt-check
fmt-check:
cargo +$(RUST_VERSION) fmt --all --check
.PHONY: clippy
clippy:
cargo +$(RUST_VERSION) clippy --all-features -- -D warnings
.PHONY: test
test:
cargo +$(RUST_VERSION) test --all-features
.PHONY: test-doc
test-doc:
cargo +$(RUST_VERSION) test --doc --all-features
.PHONY: build
build:
cargo +$(RUST_VERSION) build --all-features
.PHONY: build-release
build-release:
cargo +$(RUST_VERSION) build --all-features --release
.PHONY: doc
doc:
cargo +$(RUST_VERSION) doc --all-features --no-deps
.PHONY: doc-open
doc-open:
cargo +$(RUST_VERSION) doc --all-features --no-deps --open
.PHONY: clean
clean:
cargo clean
.PHONY: ci
ci: fmt-check clippy test test-doc
.PHONY: pre-commit
pre-commit: fmt clippy test
.PHONY: verify-version
verify-version:
@echo "Checking version..."
@VERSION=$$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/'); \
echo " Cargo.toml version: $$VERSION"; \
TAG=$$(git describe --tags --abbrev=0 2>/dev/null || echo "no tags"); \
echo " Latest git tag: $$TAG"; \
if [ "$$TAG" != "no tags" ]; then \
TAG_VERSION=$${TAG#v}; \
if [ "$$VERSION" != "$$TAG_VERSION" ]; then \
echo " ⚠ Version mismatch: Cargo.toml=$$VERSION, tag=$$TAG_VERSION"; \
else \
echo " ✓ Versions match"; \
fi \
fi
.PHONY: publish-dry-run
publish-dry-run:
cargo +$(RUST_VERSION) publish --dry-run --all-features
.PHONY: publish
publish:
cargo +$(RUST_VERSION) publish --all-features
.PHONY: update-deps
update-deps:
cargo update
.PHONY: all
all: ci doc