make
是个啥,官方定义是这样写的:
The make utility will determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them. The manual describes the GNU implementation of make, which was written by Richard Stallman and Roland McGrath, and is currently maintained by Paul Smith. Our examples show C programs, since they are very common, but you can use make with any programming language whose compiler can be run with a shell command. In fact, make is not limited to programs. You can use it to describe any task where some files must be updated automatically from others whenever the others change.
To prepare to usemake
, you must write a file called themakefile
that describes the relationships among files in your program, and the states the commands for updating each file. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files.(这句话是说:通过编译源文件可以得到目标文件,通过更新链接目标文件,就可以得到可执行文件)Once a suitablemakefile
exists, each time you change some source files, this simple shell command:
make
suffices to perform all necessary recompilations. Themake
program uses themakefile
description and the last-modification times of the files to decide which of the files need to be updated. For each of those files, it issues the commands recorded in the makefile.make
executes commands in themakefile
to update one or more target names, where name is typically a program. If no -f option is present,make
will look for the makefilesGNUmakefile
,makefile
, andMakefile
, in that order. Normally you should call your makefile eithermakefile
orMakefile
. (We recommendMakefile
because it appears prominently near the beginning of a directory listing, right near other important files such as README.) The first name checked,GNUmakefile
, is not recommended for most makefiles. You should use this name if you have amakefile
that is specific to GNU make, and will not be understood by other versions of make. If makefile is ‘-’, the standard input is read.
make
updates a target if it depends on prerequisite files that have been modified since the target was last modified, or if the target does not exist.
make
本质上就是为了方便管理、检查和更新大型程序内部文件之间的依赖,并生成目标文件而提出的一个utility。
具体make
怎么用,makefile
的文件怎么编写,暂时没有功夫细致了解。下面的一个链接说的不错,可以参考
https://blog.csdn.net/twc829/article/details/72729799?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1