46 lines
1.1 KiB
Markdown
46 lines
1.1 KiB
Markdown
# 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](https://github.com/Snaipe/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](https://github.com/Snaipe/Criterion) for unit tests
|
|
|
|
### Build and Run
|
|
|
|
```sh
|
|
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](LICENSE)
|