GNU make manual 翻译(二十六)

简介:
继续翻译

复制代码
2.6 Another Style of Makefile                        
=============================                        
                        
When the objects of a makefile are created only by implicit rules, an 
alternative style of makefile is possible.  In this style of makefile,
you group entries by their prerequisites instead of by their targets.                        
Here is what one looks like:                        
                        
     objects = main.o kbd.o command.o display.o \                        
               insert.o search.o files.o utils.o                        
                        
     edit : $(objects)                        
             cc -o edit $(objects)                        
                        
     $(objects) : defs.h                        
     kbd.o command.o files.o : command.h                        
     display.o insert.o search.o files.o : buffer.h                        
复制代码
2.6 另一种类型的 makefile

如果一个makefile的目标文件仅仅是由隐式规则所创建,那么另一种类型的makefile 是可能的。

在这种类型的makefile中,你可以把它们按照前提条件来分组,而不是按他们的目的来分组。

下面是它可能的样子:

objects = main.o kbd.o command.o display.o \ 
insert.o search.o files.o utils.o

edit : $(objects)
cc -o edit $(objects)

$(objects) : defs.h
kbd.o command.o files.o : command.h
display.o insert.o search.o files.o : buffer.h
后文待续



本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/13/2683568.html,如需转载请自行联系原作者
目录
相关文章
|
Linux C语言
make: gcc:命令未找到
make: gcc:命令未找到
make: gcc:命令未找到
|
C语言 C++ Perl
如何处理错误消息Please install the gcc make perl packages
如何处理错误消息Please install the gcc make perl packages
142 0