modern-c-makefile

Installation
SKILL.md

Modern C Makefile

Overview

This skill provides guidance and templates for creating clean, maintainable Makefiles for modern C/C++ projects, based on the best practices demonstrated in the gnaro project. It helps structure build systems that integrate compilation, testing, linting, formatting, and dependency management in a clear and organized way.

Core Concepts

Understand these key Makefile concepts before implementing:

  • Variables: Centralize project settings like compiler flags, directories, and tool paths
  • Wildcards: Use patterns like *.c and **/*.c to automatically find source files
  • Automatic Variables: Leverage $@ (target), $< (first dependency), $* (stem), $(@D) (target directory)
  • Phony Targets: Declare .PHONY targets for actions like clean, format, lint that don't produce files
  • Conditionals: Use ifeq/else/endif for debug/release builds or platform-specific configurations
  • Pattern Rules: Create generic rules for compiling .c to .o files

Makefile Template

Related skills
Installs
1
Repository
aresbit/matebot
GitHub Stars
45
First Seen
Apr 14, 2026