fugue-evo 0.1.0

A Probabilistic Genetic Algorithm Library for Rust
Documentation
.PHONY: all build check test lint fmt clippy doc clean ci help deps-check \
       mdbook mdbook-serve mdbook-clean mdbook-test doc-all doc-serve clean-all

# Default target
all: check

# Build the project
build:
	cargo build

# Build in release mode
release:
	cargo build --release

# Run cargo check (type checking)
check:
	cargo check --all-targets --all-features

# Run all tests
test:
	cargo test --all-features

# Run tests with output
test-verbose:
	cargo test --all-features -- --nocapture

# Run formatting check
fmt:
	cargo fmt --all -- --check

# Run formatting and apply fixes
fmt-fix:
	cargo fmt --all

# Run clippy linter
clippy:
	cargo clippy --all-targets --all-features -- -D warnings

# Run clippy and apply suggestions
clippy-fix:
	cargo clippy --all-targets --all-features --fix --allow-dirty

# Generate documentation
doc:
	cargo doc --no-deps --all-features

# Open documentation in browser
doc-open:
	cargo doc --no-deps --all-features --open

# Build mdbook documentation
mdbook:
	mdbook build docs

# Serve mdbook documentation locally with live reload
mdbook-serve:
	mdbook serve docs --open

# Clean mdbook build artifacts
mdbook-clean:
	rm -rf docs/book

# Test code examples in mdbook documentation
mdbook-test:
	mdbook test docs

# Build all documentation (rustdoc + mdbook)
doc-all: doc mdbook
	@echo "All documentation built successfully!"

# Serve all documentation (copies rustdoc into mdbook output)
doc-serve: doc mdbook
	@mkdir -p docs/book/api
	@cp -r target/doc/* docs/book/api/
	@echo "Documentation available at docs/book/"
	@echo "  - Guide: docs/book/index.html"
	@echo "  - API:   docs/book/api/fugue_evo/index.html"
	mdbook serve docs --open

# Clean build artifacts
clean:
	cargo clean

# Clean all build artifacts (cargo + mdbook)
clean-all: clean mdbook-clean
	@echo "All build artifacts cleaned!"

# Guard against duplicate major versions of the rand stack (EV-74).
# `cargo tree -d` lists only crates that appear at more than one version, so a
# match on any rand-stack crate at column 0 means a duplicate major crept back
# in (e.g. a proptest >= 1.7 bump reintroducing rand 0.9). Fail CI if so.
deps-check:
	@echo "Checking for duplicate rand-stack majors (EV-74)..."
	@if cargo tree -d 2>/dev/null | grep -E '^(rand|rand_core|rand_chacha) v'; then \
		echo "ERROR: duplicate major of the rand stack detected (see EV-74 / Cargo.toml note)"; \
		exit 1; \
	else \
		echo "OK: single rand-stack major."; \
	fi

# Run the full CI pipeline (same as GitHub Actions)
ci: fmt clippy check test deps-check doc mdbook
	@echo "CI pipeline completed successfully!"

# Run quick checks (for development)
quick: fmt-fix clippy check test
	@echo "Quick checks completed!"

# Watch for changes and run tests
watch:
	cargo watch -x test

# Run benchmarks (if any)
bench:
	cargo bench

# Check for security vulnerabilities
audit:
	cargo audit

# Update dependencies
update:
	cargo update

# Show outdated dependencies
outdated:
	cargo outdated

# Help
help:
	@echo "Available targets:"
	@echo "  all          - Default target (runs check)"
	@echo "  build        - Build the project"
	@echo "  release      - Build in release mode"
	@echo "  check        - Run cargo check (type checking)"
	@echo "  test         - Run all tests"
	@echo "  test-verbose - Run tests with output"
	@echo "  fmt          - Check code formatting"
	@echo "  fmt-fix      - Fix code formatting"
	@echo "  clippy       - Run clippy linter"
	@echo "  clippy-fix   - Run clippy and apply fixes"
	@echo "  doc          - Generate rustdoc documentation"
	@echo "  doc-open     - Generate and open rustdoc"
	@echo "  mdbook       - Build mdbook documentation"
	@echo "  mdbook-serve - Serve mdbook with live reload"
	@echo "  mdbook-clean - Clean mdbook build artifacts"
	@echo "  mdbook-test  - Test code examples in mdbook"
	@echo "  doc-all      - Build all documentation (rustdoc + mdbook)"
	@echo "  doc-serve    - Build and serve all documentation"
	@echo "  clean        - Clean cargo build artifacts"
	@echo "  clean-all    - Clean all build artifacts (cargo + mdbook)"
	@echo "  ci           - Run full CI pipeline"
	@echo "  deps-check   - Fail if a duplicate rand-stack major exists (EV-74)"
	@echo "  quick        - Run quick development checks"
	@echo "  watch        - Watch for changes and run tests"
	@echo "  bench        - Run benchmarks"
	@echo "  audit        - Check for security vulnerabilities"
	@echo "  update       - Update dependencies"
	@echo "  outdated     - Show outdated dependencies"
	@echo "  help         - Show this help message"