Minimal C project template featuring a portable Makefile, unit test integration, and clear folder structure.
| includes | ||
| srcs | ||
| tests | ||
| .gitignore | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| sources.mk | ||
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