Auto-activate for Makefile, GNUmakefile. GNU Make patterns for uv-based Python project automation: .PHONY, targets, recipes. Use when: creating or editing a Makefile, adding development targets (install, clean, test, lint), or setting up self-documenting help. Not for CMake (see cpp), Cargo (see rust), or non-Make build systems.
All projects should use a consistent Makefile structure to ensure developer familiarity. The standard includes:
.ONESHELL, .EXPORT_ALL_VARIABLES, strict shell flags.BLUE, GREEN, RED, YELLOW) and icons (ℹ, ✓, ⚠, ✖).help target parsing ## comments.install, upgrade, clean, test, lint.Copy this template to the root of new projects:
<example>SHELL := /bin/bash
# =============================================================================
# Variables
# =============================================================================
.DEFAULT_GOAL:=help
.ONESHELL:
.EXPORT_ALL_VARIABLES:
MAKEFLAGS += --no-print-directory
# Silence output if VERBOSE is not set
ifndef VERBOSE
.SILENT:
endif
# Define colors and formatting
BLUE := $(shell printf "\033[1;34m")
GREEN := $(shell printf "\033[1;32m")
RED := $(shell printf "\033[1;31m")
YELLOW := $(shell printf "\033[1;33m")
NC := $(shell printf "\033[0m")
INFO := $(shell printf "$(BLUE)ℹ$(NC)")
OK := $(shell printf "$(GREEN)✓$(NC)")
WARN := $(shell printf "$(YELLOW)⚠$(NC)")
ERROR := $(shell printf "$(RED)✖$(NC)")
.PHONY: help