aresbit/openmatecode/modern-c-makefile
Claude Code and agent skill by aresbit/openmatecode
- community
Checking that the SKILL.md file is still in the repository.
Create, analyze, or improve Makefiles for modern C/C++ projects using best practices from the gnaro project template. Use when working with C/C++ projects that need clean, maintainable build systems for creating new Makefiles, improving existing ones, understanding modern patterns, or setting up comprehensive build workflows with testing and code quality tools.
Install
npx vskill@latest install aresbit/openmatecode/modern-c-makefileSKILL.md
The same SKILL.md was published earlier as aresbit/openmatecode/modern-c-makefile.
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
Makefile Template
The complete gnaro Makefile template is available in references/gnaro_makefile.md. Key sections include:
Project Structure Variables
Automatic Object File Generation
Compiler and Tool Configuration
Core Targets
$(NAME): Build executable with dependencies on format, lint, and object files$(OBJS): Pattern rule for compiling object files with directory creationtest: Compile and run CUnit testslint: Run static analysis with clang-tidyformat: Apply code formatting with clang-formatcheck: Run valgrind memory checkssetup: Install development dependencies (Debian/Ubuntu)clean: Remove build artifactsbear: Generate compile_commands.json for tooling
Customization Guide
Adapting to Your Project
- Basic Configuration:
- Update
NAMEto your project name - Adjust directory variables to match your project structure
- Modify
CFLAGSfor your C standard and feature requirements
- Compiler and Tools:
- Change
CC,LINTER,FORMATTERto match your installed versions - For GCC projects:
CC := gcc - Adjust tool paths for non-Debian systems
- Cross-Platform Considerations:
- Replace apt-based
setuptarget with appropriate package manager commands - Use conditionals for platform-specific configurations:
``makefile ifeq ($(OS),Windows_NT) # Windows-specific settings else ifeq ($(shell uname -s),Darwin) # macOS-specific settings else # Linux-specific settings endif ``
- Adding Features:
- Documentation: Add
docstarget for Doxygen or other documentation generators - Packaging: Add
packagetarget for creating distributable archives - Installation: Add
installanduninstalltargets for system installation
Common Modifications
Multiple Executables:
Header Dependency Generation:
Verbose Mode:
Usage Examples
Example 1: Creating a New Makefile
Example 2: Adding Testing to Existing Makefile
Example 3: Improving Build Performance
Example 4: Cross-Platform Support
Quick Reference
Essential Commands
Project Structure Convention
Resources
This skill includes the following bundled resources:
references/
Reference documentation for Makefile best practices and templates:
- [gnaro_makefile.md](references/gnaro_makefile.md): Complete Makefile from the gnaro project with detailed analysis and adaptation notes. Use this as the primary reference template.
- [best_practices.md](references/best_practices.md): Comprehensive guide to modern C Makefile design patterns, advanced techniques, and common solutions.
When to load references: Read these files when you need detailed analysis of Makefile patterns, adaptation guidance, or advanced techniques beyond what's covered in the main skill.
assets/
Template files and guides for project setup:
- [basic_makefile.template](assets/basic_makefile.template): Simplified Makefile template ready for customization. Replace
PROJECT_NAMEand adjust directories as needed. - [project_structure_example.md](assets/project_structure_example.md): Recommended project structure with variations for different project types (single-header libraries, applications with resources, multi-target projects).
- [cross_platform_guide.md](assets/cross_platform_guide.md): Guide for adapting Makefiles to different operating systems (Linux, macOS, Windows) with platform detection, package manager integration, and cross-compilation support.
When to use assets: These files provide starting points and templates that can be copied and adapted for specific projects. They're particularly useful when creating new projects or porting existing ones to different platforms.
scripts/
This skill doesn't include scripts since Makefile creation is primarily about configuration and structure rather than automated processing. However, consider creating custom scripts for:
- Project scaffolding (generating directory structure)
- Dependency management
- Build automation beyond Makefile capabilities
Security
- Security scanPassed, 91 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/modern-c-makefile/SKILL.md
Popularity
- Repository stars
- 7
- 7-day trend score
- 10
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 8 months ago.
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
[](https://verified-skill.com/skills/aresbit/openmatecode/modern-c-makefile)