.DEFAULT_GOAL := help
check:
cargo check --all-features
fmt:
cargo fmt
fmt-check:
cargo fmt --check
clippy:
cargo clippy -- -D warnings
features:
@echo "==> default features..." && cargo check
@echo "==> all-features..." && cargo check --all-features
build:
cargo build --release
test-rust:
cargo test
bench:
cargo bench
bump-version: ## Bump version (usage: make bump-version V=0.2.0)
@if [ -z "$(V)" ]; then echo "Usage: make bump-version V=0.2.0"; exit 1; fi
@bash scripts/bump-version.sh $(V)
clean:
cargo clean
python-build:
@echo "==> Building Python wheel..."
@pip install maturin 2>/dev/null || true
@cargo check --features python || { echo "FAIL: cargo check"; exit 1; }
@maturin build --release 2>&1 | grep -q "Built wheel" && echo " ok" || { echo "FAIL: maturin build"; echo " Last output:"; maturin build --release 2>&1; exit 1; }
@pip install target/wheels/*.whl 2>/dev/null || true
test-python: python-build
@echo "==> Running Python tests..."
@pytest python/tests/ -v 2>/dev/null || { echo "FAIL: pytest"; echo " Install: pip install pytest"; }
node-build:
@echo "==> Building Node.js addon..."
@cargo check --features nodejs || { echo "FAIL: cargo check"; exit 1; }
@cd js && npm install --no-audit --no-fund >/dev/null 2>&1 || true
@js/node_modules/.bin/napi build --platform --release -c js/package.json --features nodejs --cargo-flags="--lib" js 2>/dev/null && echo " ok" || { echo "FAIL: napi build"; echo " Install: cd js && npm install"; exit 1; }
test-node: node-build
@echo "==> Running Node.js tests..."
@node js/test.js
test: test-rust test-python test-node
pre-push: fmt-check clippy features test-rust
@echo ""
@echo "==> All pre-push checks passed. Safe to push."
all: build python-build node-build
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'