GNU make manual 翻译(二)

继续翻译

Preparing and Running Make    
==========================    
    
   To prepare to use `make', you must write a file called the    
makefile that describes the relationships among files in your program    
and provides 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 suitable makefile exists, each time you change some source    
files, this simple shell command:    
    
     make    
    
suffices to perform all necessary recompilations.  The `make' program    
uses the makefile data base 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 recipes recorded in the data base.    
    
   You can provide command line arguments to `make' to control which    
files should be recompiled, or how.  *Note How to Run `make': Running.    

准备和运行 make

为了准备运行 make, 你必须写一个名为 "makefile" 的文件。该文件描述你的程序项目中的文件之间关系,

也提供改变各个文件的指令。

在一个典型的程序项目中,可执行文件由 目标文件而来,而目标文件又是由对源文件的编译而来。

一旦做好了一个适当的 makefile, 每次你修改一些源文件的时候,下面的简单的shell 命令:

  make

就会担当起所有重新编译的任务。这个 make 程序使用  makefile中的数据信息 和 各文件的被修改时间,

来决定那些文件需要被改变。对每一个需要被改变的文件,它都会根据 makefile的数据信息来执行相应的指令片段。

你可以向make 提供 命令行参数, 来控制那些文件需要被重新编译和如何被重新编译。

后文待续

posted @ 2012-09-12 13:16  健哥的数据花园  阅读(338)  评论(0编辑  收藏  举报