A solid reference for writing and debugging Makefiles in C/C++ projects. Covers the essentials: pattern rules, automatic variables like $@ and $<, and automatic dependency generation with -MMD so header changes actually trigger rebuilds. The examples are practical, starting from a minimal correct Makefile and building up to multi-directory projects without recursive make. Includes a debugging table for common errors like "missing separator" and "nothing to be done." Useful if you're converting shell scripts to proper build systems or fixing incremental builds that keep recompiling everything. The flat Makefile approach for medium projects is good advice that people often learn the hard way.

skills.sh installs
697
GitHub stars
279
last updated
Aug 21, 2026

Install

$ npx -y skills add mohitmishra786/low-level-dev-skills --skill make --agent claude-code

Installs into .claude/skills of the current project.

Files

GNU Make

Purpose

Guide agents through idiomatic Makefile patterns for C/C++ projects: phony targets, pattern rules, automatic dependency generation, and common build idioms.

Triggers

  • "How do I write a Makefile for my C project?"
  • "My Makefile rebuilds everything every time"
  • "How do I add dependency tracking to Make?"
  • "What does $@, $<, $^ mean?"
  • "I'm getting 'make: Nothing to be done for all'"
  • "How do I convert my shell compile script to a Makefile?"

Workflow

1. Minimal correct Makefile for C

CC      := gcc
CFLAGS  := -std=c11 -Wall -Wextra -g -O2
LDFLAGS :=
LDLIBS  :=

SRCS    := $(wildcard src/*.c)
OBJS    := $(SRCS:src/%.c=build/%.o)
TARGET  := build/prog

.PHONY: all clean

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

build/%.o: src/%.c | build
	$(CC) $(CFLAGS) -c -o $@ $<

build:
	mkdir -p build

clean:
	rm -rf build

Automatic variables:

  • $@ — target name
  • $< — first prerequisite
  • $^ — all prerequisites (deduplicated)
  • $* — stem (the % part in a pattern rule)
  • $(@D) — directory part of $@

2. Automatic dependency generation

Sponsors

Details

Repository
github.com/mohitmishra786/low-level-dev-skills
Categories
DevOps & CI/CD, Documentation, Debugging
First seen
Jun 3, 2026

More from mohitmishra786/low-level-dev-skills

All 54
1mukul975 avataranalyzing-android-malware-with-apktoolmukul975/anthropic-cybersecurity-skillsPerform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, 697skills.sh installs
2zhinkgit avatargcczhinkgit/embeddedskillsGCC 嵌入式工程构建工具(CMake + arm-none-eabi-gcc),用于扫描 CMake 型嵌入式工程、 列出预设、配置、编译、重建、清理和分析 ELF 大小。当用户提到 GCC、arm-none-eabi、 CMake 嵌入式编译、Ninja 构建、ELF 大小分析、arm-gcc、交叉编译、cmake696skills.sh installs
3aj-geddes avatare2e-testing-automationaj-geddes/useful-ai-promptsBuild end-to-end automated tests that simulate real user interactions across the full application stack. Use for E2E test, Selenium, Cypress, Playwright, browse695skills.sh installs
4joellewis avatarfixed-income-municipaljoellewis/finance_skillsAnalyze municipal bonds including tax-equivalent yield calculations, GO vs revenue bond evaluation, and muni credit analysis. Use when the user asks about munic693skills.sh installs
5aaronontheweb avatardotnet-project-structureaaronontheweb/dotnet-skillsModern .NET project structure including .slnx solution format, Directory.Build.props, central package management, SourceLink, version management with RELEASE_NO692skills.sh installs
6joellewis avatarpost-trade-compliancejoellewis/finance_skillsGuide post-trade compliance monitoring and trade surveillance system design. Use when building alert logic to detect churning, front-running, cherry-picking, la691skills.sh installs