Collection of Makefile templates for C/C++ projects — from simple single-file builds to multi-directory projects.
| Template | Use Case |
|---|---|
simple.mk |
Single C file compilation |
multi_file.mk |
Multiple source files |
with_libs.mk |
Linking external libraries (-lpthread, -lm) |
debug.mk |
Debug build with -g -fsanitize=address |
clean.mk |
Auto clean build artifacts |
# Use a template
make -f simple.mk
# Or rename to Makefile
cp simple.mk Makefile
make
make cleanCC = gcc
CFLAGS = -Wall -Wextra -g
TARGET = output
SRC = main.c utils.c
$(TARGET): $(SRC)
$(CC) $(CFLAGS) -o $(TARGET) $(SRC)
clean:
rm -f $(TARGET)Mayilvannan VB — EEE Student
📧 mayilvannanbalan@gmail.com