Minimal C project template featuring a portable Makefile, unit test integration, and clear folder structure.
Find a file Use this template
2026-01-12 18:56:40 +01:00
includes Initial commit 2026-01-11 21:24:49 +01:00
srcs Initial commit 2026-01-11 21:24:49 +01:00
tests Initial commit 2026-01-11 21:24:49 +01:00
.gitignore Initial commit 2026-01-11 21:24:49 +01:00
LICENSE Initial commit 2026-01-11 21:24:49 +01:00
Makefile fix: LD flags 2026-01-12 18:56:40 +01:00
README.md Initial commit 2026-01-11 21:24:49 +01:00
sources.mk Initial commit 2026-01-11 21:24:49 +01:00

c-template

A minimal, clean, and reusable C project template with unit testing support (Criterion), portable Makefile, and clear directory organization.

Features

  • Modern portable Makefile (with dependency management)
  • Example source and header structure (srcs/, includes/)
  • Unit test setup using Criterion
  • Ready-to-use targets: all, clean, fclean, re, test
  • Easily extensible for larger C projects

Getting Started

Requirements

  • A C compiler (GCC or Clang recommended)
  • Criterion for unit tests

Build and Run

make           # Build the main binary
make test      # Build and run unit tests
make clean     # Remove object files
make fclean    # Full clean (object files + binaries)
make re        # Full rebuild

Edit sources.mk to add your source and test files as the project grows.

Directory Structure

.
├── includes/      # Header files
├── srcs/          # Source files
├── tests/         # Unit test sources
├── Makefile
├── sources.mk

License

MIT