https://github.com/raphaelcausse/makefile
Makefile template for small / medium C projects.
https://github.com/raphaelcausse/makefile
c linux-makefile make makefile makefile-template
Last synced: about 2 months ago
JSON representation
Makefile template for small / medium C projects.
- Host: GitHub
- URL: https://github.com/raphaelcausse/makefile
- Owner: RaphaelCausse
- License: mit
- Created: 2022-08-23T20:40:18.000Z (about 3 years ago)
- Default Branch: v1
- Last Pushed: 2024-08-19T17:21:54.000Z (about 1 year ago)
- Last Synced: 2024-08-19T20:34:54.541Z (about 1 year ago)
- Topics: c, linux-makefile, make, makefile, makefile-template
- Language: Makefile
- Homepage:
- Size: 60.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://shields.io/)
[](https://shields.io/)# MAKEFILE
Makefile template for small to medium sized C projects, for Linux and Windows.
You can build the project in two modes : **Release** or **Debug**.
By default, the build is in **Debug** mode.
Declare all the source files you want to compile in the `sources.mk`.
Please follow recommended project layout.
# Table of Contents
- [Project Layout](#project-layout)
- [Installation](#installation)
- [Usage](#usage)
- [Features](#features)
- [Author](#author)
## PROJECT LAYOUT
To use this makefile template properly, please follow the project layout bellow.
```
──┬─[ Project ]
│
├──── LICENSE.md
├──── README.md
│
├──── Makefile
├──── sources.mk # Important: declare in that file all the source files to compile
│
├──┬─[ src ]
│ │
│ ├──── *.c
│ ├──── *.h
│ ...
│
...
```
Note that this layout of the project, including `src` directory and `sources.mk` file, is automatically created when executing the command : `make init`## INSTALLATION
**Clone** this repository :
```
git clone https://github.com/RaphaelCausse/Makefile.git
```
**Move** to the cloned directory :
```
cd Makefile
```
**Copy** the Makefile in your project at root level of your project directory.
```
cp Makefile
```
**Initialize** the project layout, in your project directory :
```
cd
make init
```
## USAGE
**Update** the `sources.mk` file with the sources files to compile.
**Update** the Makefile for compiler and linker options for your needs. Check the variables in the `#### PATHS ####` and `#### COMPILER ####` sections.
**Build** the project in Release mode :
```
make release
```
**Build** the project in Debug mode :
```
make debug
```
**Run** the target in Release mode (with optional arguments) :
```
make run
make run ARGS="your arguments"
```
**Run** the target in Debug mode (with optional arguments) :
```
make rund
make rund ARGS="your arguments"
```## FEATURES
**Clean** the project by removing generated files :
```
make clean
```
**Display** info about the project :
```
make info
```
**Display** help message:
```
make help
```## AUTHOR
Raphael CAUSSE