It has at lot to do with files, C, text processing, jobs-parallel-recursive functions.
mytarget: prerequisites; recepies
or with new line%
is matching anything.PHONY
.PHONY: clean make run tests
to make sure name of target does not collide with file if file exists-gcc ...
use -
at rule start to not fail if command failscd
.ONESHELL
%.c: ; gcc ...
is matching patternabs: ;
explicit empty rulefoo: bar | acs; gcc ..
style$?
files that changed$@
target fileUseful to update timestamp of a file:
print: a.c b.h
...
touch print
.PRECIOUS
will keep file even if it is temporary. Will not delete a file..SILENT
do not printa.o b.o &: ..
is grouped targets. weird. do not use.3.1 there is second pass if specified (secondary expansion)
MAKELEVEL
has level at which current make is runningmake -O line
to make output linewise, useful for parallel mode to make sure output is synchronized-
or contains =
make --warn-undefined-variables
make clean build
processes multiple target goals in orderMAKECMDGOALS
list of targets set automaticallymake -n
shows targets needs to be run, but not running them. prevents PHONY targetsmake -t
touch, makes up to date without changingmake -q
whether needs to run anything, only status code 1 signals this, 0 otherwisemake CFLAGS='-g'
to override variablemake -k
keep-going to continue run on error. useful to get all the errorsmake -L
consider timestamps of symbolic links in addition to timestamps of files referenced by those linksmake -O
sync output, can be target
(default), line
, recourse
, none
make -p
print database of rules and variablesmake -r
no built-in rulesmake -s
silent, not printing recepies as they are executed.. more complicated things
$(myvar)
or ${myvar}
which is samea = ...
is recursive variable, uses data at runtimea := ...
is simply expanded variable (or ::=
), uses data only at time of defininga ?= ...
if not defined yeta != ls -la
execute shell and get output with new lines replaced with spacesa += ...
line concatenate$(a:b=c)
substitution of suffixundefine a
if
, else
, endif
, ifeq
$(function arg1 arg2)
or ${function arg1 arg2}
subst
, patsbust
, strip
, findstring
, filter
, sort
, word
, and more on p.88$(dir names...)
, suffix
, basename
, join
$(wildcard pattern)
matches all existing files matching pattern$(if ...)
$(foreach...)
$(file ...)
can read or write to file$(eval ...)
is complex$(origin variable)
shows where var is coming from$(flavor variable)
shows if it is undefined recursive or simple$(error msg)
generates fatal error$(warning msg)
$(info msg)
$(shell cat foo)
returns result of execution of shell. converts new lines to spaces... and even more arcane things
.mod
is one of suffixes! so collides with go.mod
!ar
myarchive(myfile): ...
targets inside files.. and even more strange things
load
, which is something like C linked libs?馃嵃