2 An Introduction to Makefiles (makefile文件的介绍)

You need a file called a makefile to tell make what to do. Most often, the makefile tells make how to compile and link a program. (makefile文件就是一堆指令,用来告诉make如何编译和链接一个程序)

In this chapter, we will discuss a simple makefile that describes how to compile and link a text editor which consists of eight C source files and three header files. The makefile can also tell make how to run miscellaneous(各种各样的) commands when explicitly(明确地) asked (for example, to remove certain files as a clean-up operation). To see a more complex example of a makefile, see Complex(复杂的) Makefile.

When make recompiles the editor, each changed C source file must be recompiled(使用make重新编译程序时,每一个改变的C源文件必须重新编译). If a header file has changed, each C source file that includes the header file must be recompiled to be safe(头文件改变,包含该头文件的源文件也必须被重新编译). Each compilation produces an object file corresponding to the source file(每个源文件编译后都会有一个对应的目标文件). Finally, if any source file has been recompiled, all the object files, whether newly made or saved from previous compilations, must be linked together to produce the new executable editor(只要有源文件被编译了,所有的目标文件,不管是新的还是旧的都必须被链接从而产生一个新的可执行程序). 

<<<返回主目录

 

发布了200 篇原创文章 · 获赞 37 · 访问量 23万+

猜你喜欢

转载自blog.csdn.net/wo198711203217/article/details/104318169
今日推荐