aboutsummaryrefslogtreecommitdiff
path: root/doc/makefiles.md
blob: cb00c9633ee2d56ebf4d7fa22bdeb972bf4393a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# How to write makefiles
and useful notes on understanding them

## Manual
[gnu](https://www.gnu.org/software/make/manual/html_node/index.html)

## [Variables](https://www.gnu.org/software/make/manual/html_node/Setting.html)
:=	expanded variable, right-hand side can contain variables
?=	only set if it doesn't have a value
!=	execute a shell script on the right-hand side and assign its result to the left-hand side

## Targets
$@      is target
$<      is first dependency
$^      is all dependencies

## Dependencies
Use compiled -MMD switch to create rules (.d files)
Include .d files for targets using -include (include if available)