.PHONY: build test bench lint fmt clean wasm install dev coverage audit help
.DEFAULT_GOAL := help
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[0;33m
BLUE := \033[0;34m
NC := \033[0m
help:
@echo "$(BLUE)RuVector Mathpix - Development Commands$(NC)"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-15s$(NC) %s\n", $$1, $$2}'
build:
@echo "$(BLUE)Building RuVector Mathpix...$(NC)"
cargo build --release --all-features
build-dev:
@echo "$(BLUE)Building RuVector Mathpix (dev)...$(NC)"
cargo build --all-features
test:
@echo "$(BLUE)Running tests...$(NC)"
cargo test --all-features --verbose
test-unit:
@echo "$(BLUE)Running unit tests...$(NC)"
cargo test --lib --all-features
test-integration:
@echo "$(BLUE)Running integration tests...$(NC)"
cargo test --test '*' --all-features
test-doc:
@echo "$(BLUE)Running documentation tests...$(NC)"
cargo test --doc
bench:
@echo "$(BLUE)Running benchmarks...$(NC)"
cargo bench --all-features
bench-baseline:
@echo "$(BLUE)Running benchmarks (saving baseline)...$(NC)"
cargo bench --all-features -- --save-baseline main
bench-compare:
@echo "$(BLUE)Comparing benchmarks against baseline...$(NC)"
cargo bench --all-features -- --baseline main
lint:
@echo "$(BLUE)Running linting...$(NC)"
cargo clippy --all-features --all-targets -- -D warnings
cargo fmt --check
fmt:
@echo "$(BLUE)Formatting code...$(NC)"
cargo fmt
fix:
@echo "$(BLUE)Auto-fixing linting issues...$(NC)"
cargo clippy --all-features --all-targets --fix --allow-dirty --allow-staged
cargo fmt
clean:
@echo "$(BLUE)Cleaning build artifacts...$(NC)"
cargo clean
rm -rf target/
rm -rf pkg/
rm -rf node_modules/
wasm:
@echo "$(BLUE)Building WebAssembly package...$(NC)"
wasm-pack build --target web --features wasm
wasm-test:
@echo "$(BLUE)Testing WebAssembly package...$(NC)"
wasm-pack test --headless --firefox --chrome
install:
@echo "$(BLUE)Installing development dependencies...$(NC)"
rustup update stable
rustup component add rustfmt clippy
cargo install cargo-tarpaulin cargo-audit cargo-deny cargo-license
cargo install wasm-pack
@echo "$(GREEN)Development environment ready!$(NC)"
dev:
@echo "$(BLUE)Setting up development environment...$(NC)"
./scripts/setup_dev.sh
@echo "$(GREEN)Development environment setup complete!$(NC)"
coverage:
@echo "$(BLUE)Generating coverage report...$(NC)"
cargo tarpaulin --all-features --out Html --output-dir coverage
@echo "$(GREEN)Coverage report generated at coverage/index.html$(NC)"
coverage-ci:
@echo "$(BLUE)Generating coverage for CI...$(NC)"
cargo tarpaulin --all-features --out Xml --output-dir coverage --fail-under 80
audit:
@echo "$(BLUE)Running security audit...$(NC)"
cargo audit
cargo deny check
doc:
@echo "$(BLUE)Generating documentation...$(NC)"
cargo doc --all-features --no-deps --open
doc-private:
@echo "$(BLUE)Generating documentation (with private items)...$(NC)"
cargo doc --all-features --no-deps --document-private-items --open
check:
@echo "$(BLUE)Running all checks...$(NC)"
@make lint
@make test
@make audit
@echo "$(GREEN)All checks passed!$(NC)"
ci:
@echo "$(BLUE)Running CI pipeline...$(NC)"
@make lint
@make test
@make bench
@make wasm
@make coverage-ci
@make audit
@echo "$(GREEN)CI pipeline completed!$(NC)"
release:
@echo "$(BLUE)Building optimized release...$(NC)"
RUSTFLAGS="-C target-cpu=native" cargo build --release --all-features
strip target/release/libruvector_scipix.*
@echo "$(GREEN)Release binary ready at target/release/$(NC)"
profile:
@echo "$(BLUE)Running performance profiling...$(NC)"
cargo build --profile bench
perf record -g target/release/scipix-benchmark
perf report
flamegraph:
@echo "$(BLUE)Generating flamegraph...$(NC)"
cargo flamegraph --bench scipix_benchmark -- --bench
@echo "$(GREEN)Flamegraph generated at flamegraph.svg$(NC)"
models:
@echo "$(BLUE)Downloading ONNX models...$(NC)"
./scripts/download_models.sh
@echo "$(GREEN)Models downloaded to models/$(NC)"
watch:
@echo "$(BLUE)Watching for changes...$(NC)"
cargo watch -x build
watch-test:
@echo "$(BLUE)Watching for changes and running tests...$(NC)"
cargo watch -x test
update:
@echo "$(BLUE)Updating dependencies...$(NC)"
cargo update
@echo "$(GREEN)Dependencies updated!$(NC)"
outdated:
@echo "$(BLUE)Checking for outdated dependencies...$(NC)"
cargo outdated
tree:
@echo "$(BLUE)Dependency tree:$(NC)"
cargo tree --all-features
bloat:
@echo "$(BLUE)Analyzing binary size...$(NC)"
cargo bloat --release --crates
times:
@echo "$(BLUE)Compilation times:$(NC)"
cargo build --release --timings
verify:
@echo "$(BLUE)Verifying project...$(NC)"
@make fmt
@make lint
@make test
@make doc
@echo "$(GREEN)Project verified and ready for commit!$(NC)"