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
*.cand**/*.cto automatically find source files - Automatic Variables: Leverage
$@(target),$<(first dependency),$*(stem),$(@D)(target directory) - Phony Targets: Declare
.PHONYtargets for actions likeclean,format,lintthat don't produce files - Conditionals: Use
ifeq/else/endiffor debug/release builds or platform-specific configurations - Pattern Rules: Create generic rules for compiling
.cto.ofiles