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源文件都需要被重新编译以保证万无一失。 

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

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

    后文待续

  • 相关阅读:
    Web SSH 客户端Ajaxterm安装
    Ubuntu Manpage: ajaxterm
    Web工程师的工具箱 | 酷壳
    EF架构~二级域名中共享Session
    VS~通过IIS网站启用"域名"调试
    EF架构~豁出去了,为了IOC,为了扩展,改变以前的IRepository接口
    MVVM架构~knockoutjs系列之文本框数符长度动态统计功能
    JS~jwPlayer为js预留的回调方法大总结
    晒网站:应用诺贝尔奖得主罗斯匹配算法的交友网站,具有更符合用户大网撒鱼心理的新颖用户使用模式
    ZOJ 2334(Monkey King-左偏树第一题)
  • 原文地址:https://www.cnblogs.com/gaojian/p/2681726.html
Copyright © 2011-2022 走看看