.PHONY: all build release check test fmt clippy clean help
all: check build
help:
@echo "Available targets:"
@echo " make build - Build debug version"
@echo " make release - Build release version"
@echo " make check - Run all checks (fmt, clippy, test)"
@echo " make test - Run all tests"
@echo " make fmt - Format code"
@echo " make clippy - Run clippy linter"
@echo " make clean - Clean build artifacts"
@echo " make bench - Run benchmarks"
@echo " make docs - Generate documentation"
@echo " make pre-commit - Run all checks before commit (alias for check)"
build:
cargo build
release:
cargo build --release
check: fmt-check clippy test
@echo "✅ All checks passed! Ready to commit."
pre-commit: check
fmt:
cargo fmt --all
fmt-check:
@echo "Checking formatting..."
cargo fmt --all -- --check
clippy:
@echo "Running clippy..."
cargo clippy --all-targets --all-features -- -D warnings
test:
@echo "Running tests..."
cargo test --all-features
test-verbose:
cargo test --all-features -- --nocapture
bench:
cargo bench
docs:
cargo doc --no-deps --open
clean:
cargo clean
rm -rf target/
quick-test: build
@echo "Testing basic sort..."
@echo -e "3\n1\n2" | ./target/debug/sort
@echo ""
@echo "Testing numeric sort..."
@echo -e "10\n2\n1" | ./target/debug/sort -n
@echo ""
@echo "Testing reverse sort..."
@echo -e "a\nb\nc" | ./target/debug/sort -r
perf-test: release
@echo "Generating test file..."
@seq 1 1000000 | sort -R > test_large.txt
@echo "Testing performance..."
@time ./target/release/sort test_large.txt > /dev/null
@rm -f test_large.txt
install-hooks:
@echo "#!/bin/sh" > .git/hooks/pre-commit
@echo "make check" >> .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "Git pre-commit hook installed!"
ci: fmt-check clippy test
@echo "Building release version..."
@cargo build --release
@echo "✅ CI checks passed!"