xcargo 0.1.0

Cross-compilation, zero friction - Rust cross-compilation tool with automatic toolchain management
Documentation
# xcargo Makefile
# Cross-compilation, zero friction ๐ŸŽฏ

# Colors
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: ## ๐Ÿ“š Show this help message
	@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 ""

# ========================================
# ๐Ÿฆ€ Rust/Cargo Commands
# ========================================

.PHONY: build
build: ## ๐Ÿ”จ Build the project
	@echo "$(BOLD)$(BLUE)๐Ÿ”จ Building xcargo...$(RESET)"
	cargo build

.PHONY: build-release
build-release: ## ๐Ÿš€ Build in release mode
	@echo "$(BOLD)$(GREEN)๐Ÿš€ Building xcargo (release mode)...$(RESET)"
	cargo build --release
	@echo "$(GREEN)โœ… Release build complete!$(RESET)"

.PHONY: test
test: ## ๐Ÿงช Run tests
	@echo "$(BOLD)$(YELLOW)๐Ÿงช Running tests...$(RESET)"
	cargo test

.PHONY: test-verbose
test-verbose: ## ๐Ÿ” Run tests with verbose output
	@echo "$(BOLD)$(YELLOW)๐Ÿ” Running tests (verbose)...$(RESET)"
	cargo test -- --nocapture --test-threads=1

.PHONY: check
check: ## โœ… Check code without building
	@echo "$(BOLD)$(CYAN)โœ… Checking code...$(RESET)"
	cargo check

.PHONY: clippy
clippy: ## ๐Ÿ“Ž Run clippy lints
	@echo "$(BOLD)$(MAGENTA)๐Ÿ“Ž Running clippy...$(RESET)"
	cargo clippy -- -D warnings

.PHONY: fmt
fmt: ## ๐ŸŽจ Format code
	@echo "$(BOLD)$(CYAN)๐ŸŽจ Formatting code...$(RESET)"
	cargo fmt

.PHONY: fmt-check
fmt-check: ## ๐Ÿ” Check code formatting
	@echo "$(BOLD)$(CYAN)๐Ÿ” Checking formatting...$(RESET)"
	cargo fmt -- --check

.PHONY: clean
clean: ## ๐Ÿงน Clean build artifacts
	@echo "$(BOLD)$(RED)๐Ÿงน Cleaning build artifacts...$(RESET)"
	cargo clean
	@echo "$(GREEN)โœ… Clean complete!$(RESET)"

.PHONY: run
run: ## ๐Ÿƒ Run xcargo
	@echo "$(BOLD)$(GREEN)๐Ÿƒ Running xcargo...$(RESET)"
	cargo run

.PHONY: run-example
run-example: ## ๐Ÿ“‹ Run target_info example
	@echo "$(BOLD)$(CYAN)๐Ÿ“‹ Running target_info example...$(RESET)"
	cargo run --example target_info

.PHONY: install
install: ## ๐Ÿ“ฆ Install xcargo locally
	@echo "$(BOLD)$(GREEN)๐Ÿ“ฆ Installing xcargo...$(RESET)"
	cargo install --path .
	@echo "$(GREEN)โœ… xcargo installed!$(RESET)"

.PHONY: bench
bench: ## โšก Run benchmarks
	@echo "$(BOLD)$(YELLOW)โšก Running benchmarks...$(RESET)"
	cargo bench

# ========================================
# ๐Ÿ“š Documentation Commands
# ========================================

.PHONY: docs-install
docs-install: ## ๐Ÿ“ฅ Install documentation dependencies
	@echo "$(BOLD)$(BLUE)๐Ÿ“ฅ Installing documentation dependencies...$(RESET)"
	cd docs && npm install
	@echo "$(GREEN)โœ… Dependencies installed!$(RESET)"

.PHONY: docs-dev
docs-dev: ## ๐ŸŒ Start documentation dev server
	@echo "$(BOLD)$(CYAN)๐ŸŒ Starting documentation server...$(RESET)"
	cd docs && npm start

.PHONY: docs-build
docs-build: ## ๐Ÿ—๏ธ  Build documentation
	@echo "$(BOLD)$(BLUE)๐Ÿ—๏ธ  Building documentation...$(RESET)"
	cd docs && npm run build
	@echo "$(GREEN)โœ… Documentation built!$(RESET)"

.PHONY: docs-serve
docs-serve: ## ๐ŸŽญ Serve built documentation
	@echo "$(BOLD)$(MAGENTA)๐ŸŽญ Serving documentation...$(RESET)"
	cd docs && npm run serve

.PHONY: docs-deploy
docs-deploy: ## ๐Ÿš€ Deploy documentation to GitHub Pages
	@echo "$(BOLD)$(GREEN)๐Ÿš€ Deploying documentation...$(RESET)"
	cd docs && npm run deploy
	@echo "$(GREEN)โœ… Documentation deployed!$(RESET)"

.PHONY: docs-clean
docs-clean: ## ๐Ÿงน Clean documentation build
	@echo "$(BOLD)$(RED)๐Ÿงน Cleaning documentation...$(RESET)"
	rm -rf docs/build docs/.docusaurus docs/.cache-loader
	@echo "$(GREEN)โœ… Documentation cleaned!$(RESET)"

# ========================================
# ๐Ÿ”ง Development Commands
# ========================================

.PHONY: dev
dev: fmt clippy test ## ๐Ÿ”ง Run all development checks
	@echo "$(BOLD)$(GREEN)โœ… All development checks passed!$(RESET)"

.PHONY: ci
ci: fmt-check clippy test ## ๐Ÿค– Run CI checks
	@echo "$(BOLD)$(GREEN)โœ… CI checks passed!$(RESET)"

.PHONY: watch
watch: ## ๐Ÿ‘€ Watch for changes and run tests
	@echo "$(BOLD)$(YELLOW)๐Ÿ‘€ Watching for changes...$(RESET)"
	cargo watch -x test

.PHONY: coverage
coverage: ## ๐Ÿ“Š Generate code coverage report
	@echo "$(BOLD)$(CYAN)๐Ÿ“Š Generating coverage report...$(RESET)"
	cargo tarpaulin --out Html --output-dir coverage
	@echo "$(GREEN)โœ… Coverage report generated in coverage/$(RESET)"

# ========================================
# ๐Ÿ“ฆ Release Commands
# ========================================

.PHONY: pre-release
pre-release: ci build-release docs-build ## ๐Ÿ“‹ Pre-release checklist
	@echo "$(BOLD)$(GREEN)โœ… Pre-release checks complete!$(RESET)"
	@echo "$(YELLOW)Ready to publish!$(RESET)"

.PHONY: publish
publish: ## ๐ŸŽ‰ Publish to crates.io
	@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

# ========================================
# ๐ŸŽฏ All-in-one Commands
# ========================================

.PHONY: all
all: build test docs-build ## ๐ŸŽฏ Build everything
	@echo "$(BOLD)$(GREEN)โœ… Full build complete!$(RESET)"

.PHONY: clean-all
clean-all: clean docs-clean ## ๐Ÿงน Clean everything
	@echo "$(BOLD)$(GREEN)โœ… Everything cleaned!$(RESET)"

.PHONY: setup
setup: ## ๐ŸŽฌ Initial project 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 target
.DEFAULT_GOAL := help