zoukankan      html  css  js  c++  java
  • GNU make manual 翻译(七)

    继续翻译

    2 An Introduction to Makefiles    
    ******************************    
        
    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.      
        
       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 *note Complex Makefile::.    
        
       When `make' recompiles the editor, each changed C source file must    
    be recompiled.  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.      

    Makefile介绍

    你需要一个 makefile 来告诉make 作什么。在大多数场合,makefile 告诉make 如何编译和链接一个程序项目。

    在这一章,我们将要讨论一个简单的 makefile,它描述如何编译和链接一个文本编辑器。

    此程序项目由8个C源文件和3个头文件组成。

    此makefile 也能告诉make,当被明确指定时, 如何运行各种杂七杂八的命令

    (例如,作为clean-up 操作的一部分,删除一些文件)

    如果想要看更复杂的例子,可以参考 *note Complex Makefile

    当 make 重新编译此编辑器程序的时候,每一个改变了的C源文件都必须被重新变异。

    如果某个头文件改变了,每一个包含了此头文件的C源文件都需要被重新编译以保证万无一失。 

    每一个编译动作都会产生一个和源文件对应的目标文件,无论是重新编译好的,

    还是已经在以前的编译中生成的文件,都需要被链接到一起以生成这个新的可执行的编辑器程序。

    后文待续

  • 相关阅读:
    KVM克隆CentOS6虚拟机后无法启动
    Python socket网络模块
    LNMP的安装--详细版
    CentOS7 二进制安装MySQL5.6.42
    超越线程池:Java并发并没有你想的那么糟糕
    有哪些实用的计算机相关技能,可以在一天内学会?
    如何写出让hr一看就约你面试的简历
    五个最佳编程字体
    Eclipse 的 Debug 介绍与技巧
    Redis时延问题分析及应对
  • 原文地址:https://www.cnblogs.com/gaojian/p/2681726.html
Copyright © 2011-2022 走看看