makefile

Author and review GNU Make Makefiles for portability and correct build rules.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/dallay/opencode-docker --skill makefile-dallay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: makefile
Source: https://github.com/dallay/opencode-docker/tree/main/config/skills/makefile
Command: npx skills add https://github.com/dallay/opencode-docker --skill makefile-dallay

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Makefiles are easy to break with subtle syntax errors, non-portable assumptions, and fragile dependency handling; this Skill helps authors and reviewers produce clean, maintainable, and portable GNU Make Makefiles that avoid those pitfalls.

Core Features & Use Cases

  • Syntax and Style Guidance: Enforce tab-based recipes, recommend .PHONY for non-file targets, and prefer := for predictable variable expansion.
  • Dependency and Rule Best Practices: Advise automatic dependency generation, pattern rules, order-only prerequisites, and safe handling of intermediate files.
  • Portability and Maintainability: Provide strategies to avoid recursive make, split configuration, and structure variables and targets for easier maintenance and cross-platform builds.
  • Use Cases: Creating a new Makefile for a C or Go project, refactoring a legacy build to use pattern rules and automatic deps, and debugging build failures caused by incorrect prerequisites or variable expansion.

Quick Start

Ask the makefile skill to review my project's Makefile and produce a corrected, portable version that includes .PHONY, automatic dependency generation, and consistent tab-based recipes.

Frequently Asked Questions about makefile

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a portable GNU Makefile with automatic dependency generation?

Use := for immediate variable expansion instead of recursive assignment to avoid unexpected behavior in Makefiles. This ensures variables are evaluated once at definition time, making builds predictable and preventing infinite recursion issues during complex target processing.

Why does my Makefile build fail with incorrect prerequisites and variable expansion?

Automatic dependency generation in GNU Make uses compiler flags like -MMD -MP to output prerequisite files during compilation. This mechanism tracks header file changes automatically, ensuring incremental builds recompile only the necessary source files.

What is the best way to avoid recursive make and ensure build portability across languages?

The best way to ensure build portability is to avoid recursive make, split configuration logically, and use pattern rules. This approach maintains correct dependency tracking across C, C++, Go, and Node.js build automation workflows.

When do I need .PHONY declarations and order-only prerequisites in a Makefile?

Yes, GNU Make build automation applies to projects across languages including C, C++, Go, and Node.js. It handles new Makefile creation, legacy refactoring to pattern rules, and debugging build failures caused by incorrect prerequisites.