Makefile is a tool for organizing programs under Linux, and its command is make.
(The initials m/m all can)
"Makefile"
The main melody written by Makefile:
Target: [Prerequisities] (TAB) [command]
"Make"
Learn about the supported features and options:
Mans Make Make--help # Quick View formats and options
Usage examples:
Make-S-f build.mk all make # Default read Makefile, default target is the first target in the file
Process
Make command to read Makefile and target;
Check that the target's dependencies are updated, have the command executed, and do not indicate that the destination file is up to date.
A statistical controbuter of Makefile:
# Original code: HTTPS://github.com/youzan/zan/blob/master/makefile"\ make <option> authors"--format='%an <%aE>' Sort -u > [email protected]
@ Cancel show command at Terminal.
[email protected] is equivalent to the current target.
$^ all dependencies of the current target.
$< the first one in the current target dependency.
"Variable use"
Reference (=), Mutual influence:
Jack ==default: -
Expand (: =), take only the values of the preceding variables:
Jack ==default: -
"Pseudo-target"
Hellomake: gcc -o hellomake hellomake.c func.c-i.create :touch clean#. Phony:cleanclean: rm -F Hellomake
Analyze the above file:
Make, do not specify target default is Hellomake.
Make create and execute the command ' touch clean '.
Make clean, no dependent changes detected, prompting the target file clean is up to date.
Obviously, make clean has unintended effect, in order to avoid such conflicts, it is necessary to exclude target from becoming the destination file;
Open the comment. Phony:clean is used to mark the pseudo target clean, please execute the command below clean.
Added
Makefile implied rules
A Simple Makefile Tutorial
Link:http://www.cnblogs.com/farwish/p/6148023.html
[MK] drink a cup of coffee, write a Makefile