Makefile

File name in searching sequence: GNUmakefile makefile Makefile(prefer)

targets: prerequisites
<Tab>command

or

targets: prerequisites; command
command

(targets and prerequisites delimited by <space>, and support wildcards)

wildcards: * ?

VAR = value (always set with eventually value)
VAR := value (always set with current value)
VAR ?= value (only set if it is empty)
VAR += value (append value)
Blog: Makefile 中:= ?= += =的区别

$(VAR) (use variable)
${VAR} (use variable)
$@ (current target name)
$^ (dependencies)

include filename1 filename2 (could use wildcards in filenames)

- (place this before a cmd, means continue if exception)
@ (place this before a cmd, means don't output the cmd to the console)

# comment

.PHONY: target1 target2 (declare fake targets)