BOLD := \033[1m
RESET := \033[0m
RED := \033[31m
GREEN := \033[32m
YELLOW := \033[33m
BLUE := \033[34m
MAGENTA := \033[35m
CYAN := \033[36m
.PHONY: help
help:
@echo "$(BOLD)$(CYAN)xcargo - Cross-compilation, zero friction ๐ฏ$(RESET)"
@echo ""
@echo "$(BOLD)Available commands:$(RESET)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " $(CYAN)%-20s$(RESET) %s\n", $$1, $$2}'
@echo ""
.PHONY: build
build:
@echo "$(BOLD)$(BLUE)๐จ Building xcargo...$(RESET)"
cargo build
.PHONY: build-release
build-release:
@echo "$(BOLD)$(GREEN)๐ Building xcargo (release mode)...$(RESET)"
cargo build --release
@echo "$(GREEN)โ
Release build complete!$(RESET)"
.PHONY: test
test:
@echo "$(BOLD)$(YELLOW)๐งช Running tests...$(RESET)"
cargo test
.PHONY: test-verbose
test-verbose:
@echo "$(BOLD)$(YELLOW)๐ Running tests (verbose)...$(RESET)"
cargo test -- --nocapture --test-threads=1
.PHONY: check
check:
@echo "$(BOLD)$(CYAN)โ
Checking code...$(RESET)"
cargo check
.PHONY: clippy
clippy:
@echo "$(BOLD)$(MAGENTA)๐ Running clippy...$(RESET)"
cargo clippy -- -D warnings
.PHONY: fmt
fmt:
@echo "$(BOLD)$(CYAN)๐จ Formatting code...$(RESET)"
cargo fmt
.PHONY: fmt-check
fmt-check:
@echo "$(BOLD)$(CYAN)๐ Checking formatting...$(RESET)"
cargo fmt -- --check
.PHONY: clean
clean:
@echo "$(BOLD)$(RED)๐งน Cleaning build artifacts...$(RESET)"
cargo clean
@echo "$(GREEN)โ
Clean complete!$(RESET)"
.PHONY: run
run:
@echo "$(BOLD)$(GREEN)๐ Running xcargo...$(RESET)"
cargo run
.PHONY: run-example
run-example:
@echo "$(BOLD)$(CYAN)๐ Running target_info example...$(RESET)"
cargo run --example target_info
.PHONY: install
install:
@echo "$(BOLD)$(GREEN)๐ฆ Installing xcargo...$(RESET)"
cargo install --path .
@echo "$(GREEN)โ
xcargo installed!$(RESET)"
.PHONY: bench
bench:
@echo "$(BOLD)$(YELLOW)โก Running benchmarks...$(RESET)"
cargo bench
.PHONY: docs-install
docs-install:
@echo "$(BOLD)$(BLUE)๐ฅ Installing documentation dependencies...$(RESET)"
cd docs && npm install
@echo "$(GREEN)โ
Dependencies installed!$(RESET)"
.PHONY: docs-dev
docs-dev:
@echo "$(BOLD)$(CYAN)๐ Starting documentation server...$(RESET)"
cd docs && npm start
.PHONY: docs-build
docs-build:
@echo "$(BOLD)$(BLUE)๐๏ธ Building documentation...$(RESET)"
cd docs && npm run build
@echo "$(GREEN)โ
Documentation built!$(RESET)"
.PHONY: docs-serve
docs-serve:
@echo "$(BOLD)$(MAGENTA)๐ญ Serving documentation...$(RESET)"
cd docs && npm run serve
.PHONY: docs-deploy
docs-deploy:
@echo "$(BOLD)$(GREEN)๐ Deploying documentation...$(RESET)"
cd docs && npm run deploy
@echo "$(GREEN)โ
Documentation deployed!$(RESET)"
.PHONY: docs-clean
docs-clean:
@echo "$(BOLD)$(RED)๐งน Cleaning documentation...$(RESET)"
rm -rf docs/build docs/.docusaurus docs/.cache-loader
@echo "$(GREEN)โ
Documentation cleaned!$(RESET)"
.PHONY: dev
dev: fmt clippy test
@echo "$(BOLD)$(GREEN)โ
All development checks passed!$(RESET)"
.PHONY: ci
ci: fmt-check clippy test
@echo "$(BOLD)$(GREEN)โ
CI checks passed!$(RESET)"
.PHONY: watch
watch:
@echo "$(BOLD)$(YELLOW)๐ Watching for changes...$(RESET)"
cargo watch -x test
.PHONY: coverage
coverage:
@echo "$(BOLD)$(CYAN)๐ Generating coverage report...$(RESET)"
cargo tarpaulin --out Html --output-dir coverage
@echo "$(GREEN)โ
Coverage report generated in coverage/$(RESET)"
.PHONY: pre-release
pre-release: ci build-release docs-build
@echo "$(BOLD)$(GREEN)โ
Pre-release checks complete!$(RESET)"
@echo "$(YELLOW)Ready to publish!$(RESET)"
.PHONY: publish
publish:
@echo "$(BOLD)$(RED)โ ๏ธ Publishing to crates.io...$(RESET)"
@read -p "Are you sure? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
cargo publish; \
echo "$(GREEN)โ
Published!$(RESET)"; \
else \
echo "$(YELLOW)Cancelled.$(RESET)"; \
fi
.PHONY: all
all: build test docs-build
@echo "$(BOLD)$(GREEN)โ
Full build complete!$(RESET)"
.PHONY: clean-all
clean-all: clean docs-clean
@echo "$(BOLD)$(GREEN)โ
Everything cleaned!$(RESET)"
.PHONY: setup
setup:
@echo "$(BOLD)$(CYAN)๐ฌ Setting up xcargo development environment...$(RESET)"
@echo "$(YELLOW)Installing Rust dependencies...$(RESET)"
rustup component add clippy rustfmt
@echo "$(YELLOW)Installing cargo tools...$(RESET)"
cargo install cargo-watch 2>/dev/null || true
cargo install cargo-tarpaulin 2>/dev/null || true
@echo "$(YELLOW)Installing documentation dependencies...$(RESET)"
cd docs && npm install
@echo "$(BOLD)$(GREEN)โ
Setup complete!$(RESET)"
@echo ""
@echo "$(BOLD)Next steps:$(RESET)"
@echo " โข Run $(CYAN)make dev$(RESET) to check code"
@echo " โข Run $(CYAN)make docs-dev$(RESET) to start documentation server"
@echo " โข Run $(CYAN)make help$(RESET) to see all commands"
.DEFAULT_GOAL := help