# {{ project_name }} - Rust CLI Binary Makefile
# Generated by Pragmatic AI Labs MCP Agent Toolkit (pmat)
.PHONY: all check format lint test bench build build-release run clean install help
# Default target: run all checks and build
all: format check lint test build
# Type check the code
check:
cargo check{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %}
# Format code with rustfmt
format:
cargo fmt --all
# Lint with clippy
lint:
cargo clippy --all-targets{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %} -- -D warnings
# Run tests
test:
{% if has_tests %} cargo test{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %}{% else %} @echo "No tests configured"{% endif %}
# Run benchmarks
bench:
{% if has_benchmarks %} cargo bench{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %}{% else %} @echo "No benchmarks configured"{% endif %}
# Build debug binary
build:
cargo build{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %}
# Build release binary
build-release:
cargo build --release{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %}
# Run the application
run:
cargo run{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %}{% if default_args %} -- {{ default_args }}{% endif %}
# Clean build artifacts
clean:
cargo clean
# Install the binary to cargo bin directory
install: build-release
cargo install --path .{% if target %} --target {{ target }}{% endif %}{% if features %} --features "{% for feature in features %}{{ feature }}{% if not loop.last %},{% endif %}{% endfor %}"{% endif %}
# Show help
help:
@echo "{{ project_name }} - Available targets:"
@echo " all - Run format, check, lint, test, and build"
@echo " check - Type check the code"
@echo " format - Format code with rustfmt"
@echo " lint - Run clippy linter"
@echo " test - Run tests"
@echo " bench - Run benchmarks"
@echo " build - Build debug binary"
@echo " build-release - Build optimized release binary"
@echo " run - Run the application"
@echo " clean - Remove build artifacts"
@echo " install - Install the binary"
@echo " help - Show this help message"