|
| 1 | +.DEFAULT_GOAL := help |
| 2 | +.PHONY: help install install-dev lint lint-fix format typecheck quality clean all dev |
| 3 | + |
| 4 | +# Colors for output |
| 5 | +YELLOW := \033[33m |
| 6 | +GREEN := \033[32m |
| 7 | +BLUE := \033[34m |
| 8 | +RED := \033[31m |
| 9 | +RESET := \033[0m |
| 10 | + |
| 11 | +# Project variables |
| 12 | +PYTHON := python3 |
| 13 | +UV := uv |
| 14 | +RUFF := ruff |
| 15 | +TYPECHECK := basedpyright |
| 16 | + |
| 17 | +help: ## Show this help message |
| 18 | + @echo "$(BLUE)BalatroLLM Development Makefile$(RESET)" |
| 19 | + @echo "" |
| 20 | + @echo "$(YELLOW)Available targets:$(RESET)" |
| 21 | + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " $(GREEN)%-18s$(RESET) %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
| 22 | + |
| 23 | +# Installation targets |
| 24 | +install: ## Install package dependencies |
| 25 | + @echo "$(YELLOW)Installing dependencies...$(RESET)" |
| 26 | + $(UV) sync |
| 27 | + |
| 28 | +install-dev: ## Install package with development dependencies |
| 29 | + @echo "$(YELLOW)Installing development dependencies...$(RESET)" |
| 30 | + $(UV) sync --all-extras --group dev |
| 31 | + |
| 32 | +# Code quality targets |
| 33 | +lint: ## Run ruff linter (check only) |
| 34 | + @echo "$(YELLOW)Running ruff linter...$(RESET)" |
| 35 | + $(RUFF) check --select I . |
| 36 | + $(RUFF) check . |
| 37 | + |
| 38 | +lint-fix: ## Run ruff linter with auto-fixes |
| 39 | + @echo "$(YELLOW)Running ruff linter with fixes...$(RESET)" |
| 40 | + $(RUFF) check --select I --fix . |
| 41 | + $(RUFF) check --fix . |
| 42 | + |
| 43 | +format: ## Run ruff formatter |
| 44 | + @echo "$(YELLOW)Running ruff formatter...$(RESET)" |
| 45 | + $(RUFF) check --select I --fix . |
| 46 | + $(RUFF) format . |
| 47 | + |
| 48 | +typecheck: ## Run type checker |
| 49 | + @echo "$(YELLOW)Running type checker...$(RESET)" |
| 50 | + $(TYPECHECK) |
| 51 | + |
| 52 | +quality: lint format typecheck ## Run all code quality checks |
| 53 | + @echo "$(GREEN)✓ All quality checks completed$(RESET)" |
| 54 | + |
| 55 | +# Build targets |
| 56 | +clean: ## Clean build artifacts and caches |
| 57 | + @echo "$(YELLOW)Cleaning build artifacts...$(RESET)" |
| 58 | + rm -rf build/ dist/ *.egg-info/ |
| 59 | + rm -rf .pytest_cache/ .coverage htmlcov/ coverage.xml |
| 60 | + rm -rf .ruff_cache/ |
| 61 | + find . -type d -name __pycache__ -exec rm -rf {} + |
| 62 | + find . -type f -name "*.pyc" -delete |
| 63 | + @echo "$(GREEN)✓ Cleanup completed$(RESET)" |
| 64 | + |
| 65 | +# Convenience targets |
| 66 | +dev: format lint typecheck ## Quick development check |
| 67 | + @echo "$(GREEN)✓ Development checks completed$(RESET)" |
| 68 | + |
| 69 | +all: format lint typecheck ## Complete quality check |
| 70 | + @echo "$(GREEN)✓ All checks completed successfully$(RESET)" |
0 commit comments