Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zyedidia/make-template
Makefile template for simple C/C++ programs
https://github.com/zyedidia/make-template
Last synced: about 1 month ago
JSON representation
Makefile template for simple C/C++ programs
- Host: GitHub
- URL: https://github.com/zyedidia/make-template
- Owner: zyedidia
- Created: 2020-04-15T21:06:43.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-07T19:17:37.000Z (10 months ago)
- Last Synced: 2024-11-15T21:29:31.247Z (3 months ago)
- Language: Makefile
- Size: 12.7 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Makefile templates for simple C and C++ programs.
Usage:
```
make [TARGET] [OPTIONS]
```Possible options include
* `DEBUG=1`: enable debugging information (`-ggdb3`), optimize for debugging (`-Og`), and enable sanitizers.
* `SANITIZE=1`: enable sanitizers (address, undefined, leak, thread).
* For thread sanitization, needs `WANT_TSAN=1`, for leak sanitization needs `LSAN=1`.
* `PTHREAD=1`: link with pthread library.
* `PROFILE=1`: write profile information for use with the analysis program `gprof` (`-pg`).
* `PIE=0`: disable generation of position independent executables.
* `FAST=1`: enables optimization level 3 (`-O3`), and generates CPU-specific code (`-march=native`), and enables some other options that might slightly increase performance.These options can also be set directly inside the Makefile.
Possible targets are
* `all` (default): builds all programs.
* `format`: formats source files with `clang-format` (according to the style defined in the `.clang-format` file).
* `clean`: removes build files and executables.Recommendation: for faster builds, set your `MAKEFLAGS` environment variable to use the full number of logical cores on your machine.
Linux:
```
export MAKEFLAGS="-j$(grep -c ^processor /proc/cpuinfo)"
```MacOS:
```
export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"
```---
Adapted from the CS61 section notes Makefile at https://github.com/cs61/cs61-sections.