1.
#comments
2.
#variable assignments
var1=val1
3.
#variable reference
$(var1)
#dereference a variable
$$(var1)
4.
#rules
target : dependency1 denpendency2 ... dependencyN
5.
<tab> command
Normally, when make encounters a command that returns a nonzero status code to the shell, it will stop execution and display an error message—but if you use a leading dash, it will just
ignore the error and continue.
<tab> -command
A command prefixed with an at sign tells make not to perform its normal behavior of printing the command to the stdout device as it executes it.
<tab> @command
6.
make executes each command in a separate shell, so we need run many commands in the same shell via a trailing backslash, be sure that there are no spaces or other invisible characters after it.
foo: bar.c sources=bar.c; \ gcc -o foo $${sources}
7.
Variables referenced in commands are bound to their value when make start a shell for execution.
... mytarget=foo $(mytarget): $(mytarget).c gcc -o $(mytarget) $(mytarget).c mytarget=bar ...
equals
... foo: foo.c gcc -o bar bar.c ...
8.
automatic variables
$@ - the full target name of the current target
9.
implicit rule
10.
phony target is a target which is not file. E.g., all, clean.