abuxton/awesome-makefiles/makefile-basics

Claude Code and agent skill by abuxton/awesome-makefiles

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Core GNU Make concepts, syntax, and best practices for writing effective Makefiles

Install

npx vskill@latest install abuxton/awesome-makefiles/makefile-basics

SKILL.md

The same SKILL.md was published earlier as abuxton/awesome-makefiles/makefile-basics.

Makefile Basics

Instructions for writing and reviewing GNU Make Makefiles following best practices.

When to use

Use this skill when:

  • Writing a new Makefile from scratch
  • Reviewing or refactoring an existing Makefile
  • Explaining Makefile syntax and concepts
  • Helping users understand how make resolves targets

Instructions

Structure
  1. Always declare phony targets to avoid conflicts with files of the same name:

``makefile .PHONY: build test clean help ``

  1. Set a sensible default goal (usually all or help):

``makefile .DEFAULT_GOAL := help ``

  1. Use SHELL := /bin/bash at the top to ensure consistent shell behaviour.
  1. Group variables at the top, targets in logical sections below.
Variables
  • Use ?= for overridable defaults (caller can override via environment or CLI).
  • Use := for immediate (simple) expansion to avoid repeated evaluation.
  • Use = only when deferred (recursive) expansion is intentional.
  • Prefer uppercase names for variables set at the Makefile level.
Targets
  • Every target recipe line must begin with a tab character (not spaces).
  • Prefix recipe lines with @ to suppress echoing, or omit @ when the command itself is informative.
  • Use $(MAKE) (not make) to invoke sub-makes so flags and variables propagate.
Self-documenting help target

Add ## comment after each target declaration and generate a help screen:

makefile
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Error handling
  • Use $(error ...) to abort with a message when required variables are missing.
  • Use $(warning ...) for non-fatal notices.
  • Example guard:

``makefile ifndef REQUIRED_VAR $(error REQUIRED_VAR is not set) endif ``

Including other Makefiles
  • Use -include file.mk (with dash) to silently ignore missing includes.
  • Use include file.mk when the file is mandatory.
Pattern rules

Prefer static pattern rules over implicit rules for clarity:

makefile
$(OBJECTS): $(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -c -o $@ $<
Automatic variables
VariableMeaning
$@Target name
$<First prerequisite
$^All prerequisites (deduplicated)
$*Stem matched by % in a pattern rule
$(@D)Directory part of $@
Portability
  • Test with both GNU Make 3.x and 4.x where possible.
  • Avoid GNU-specific extensions when targeting BSD/macOS unless gmake is guaranteed.
  • Use $(shell ...) sparingly; cache the result in a variable.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/abuxton/awesome-makefiles/makefile-basics/badge)](https://verified-skill.com/skills/abuxton/awesome-makefiles/makefile-basics)

Something wrong with this skill or its page? Tell us.