GNU make manual 翻译(二十三)

继续翻译

2.5 Letting `make' Deduce the Recipes                        
=====================================                        
                        
It is not necessary to spell out the recipes for compiling the 
individual C source files, because `make' can figure them out: it has an 
implicit rule for updating a `.o' file from a correspondingly named
`.c' file using a `cc -c' command.  For example, it will use the recipe 
`cc -c main.c -o main.o' to compile `main.c' into `main.o'.  We can 
therefore omit the recipes from the rules for the object files.  *Note 
Using Implicit Rules: Implicit Rules.                        
                        
   When a `.c' file is used automatically in this way, it is also 
automatically added to the list of prerequisites.  We can therefore omit 
the `.c' files from the prerequisites, provided we omit the recipe. 

 让 make 减少 片段数量

为了编译单独的 C 源文件,没有必要写出单独的片段。

因为 make 可以把他们识别出来:

这里有一个隐含的规则:需要改变一个.o文件的时候,要用 cc -c 命令来处理 .c 文件。

例如,make 将用 cc -c main.c -o main.o 来编译 main.c 为 main.o。

我们因此可以省略 这些为 目标文件而定的片段。

*Note Using Implicit Rules: Implicit Rules 

后文待续

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