Makefile
- A rule
three elements: goals, dependence, command
target: dependency
Command
1, the first rule is used to generate the ultimate goal rule
if the rule is dependent not present, looking downwardly other rules
Update mechanism: the comparison is time-dependent files and object files
- Two functions
1) Find a specified directory, specify the type of file
src = $ (wildcard ~ / aa / *. C)
2) Match the replacement function
obj = $ (patsubst% .c, % .o, $ (src))
- Three automatic variables
1) $ <: first dependent rules
2) $ ^: all dependent rules
3) $ @: goals rule
Can only be used in the rule command
- Mode rule
% .o:% .c
gcc -c $< -o $@