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

    继续翻译

    Then, each place we want to put a list of the object file names, we can 
    substitute the variable's value by writing `$(objects)' (*note How to
    Use Variables: Using Variables.).                        
                            
       Here is how the complete simple makefile looks when you use a 
    variable for the object files:                        
                            
         objects = main.o kbd.o command.o display.o \                        
                   insert.o search.o files.o utils.o                        
                            
         edit : $(objects)                        
                 cc -o edit $(objects)                        
         main.o : main.c defs.h                        
                 cc -c main.c                        
         kbd.o : kbd.c defs.h command.h                        
                 cc -c kbd.c                        
         command.o : command.c defs.h command.h                        
                 cc -c command.c                        
         display.o : display.c defs.h buffer.h                        
                 cc -c display.c                        
         insert.o : insert.c defs.h buffer.h                        
                 cc -c insert.c                        
         search.o : search.c defs.h buffer.h                        
                 cc -c search.c                        
         files.o : files.c defs.h buffer.h command.h                        
                 cc -c files.c                        
         utils.o : utils.c defs.h                        
                 cc -c utils.c                        
         clean :                        
                 rm edit $(objects)                        

    然后,在每一个我们想要列举目标文件名称的地方,我们都可以用 $(objects) 来表达

    (*note How to Use Variables: Using Variables)

    Here is how the complete simple makefile looks when you use a
    variable for the object files:

    下面是完整而简单的 makefile使用了 上述变量后的样子:

         objects = main.o kbd.o command.o display.o \                
                   insert.o search.o files.o utils.o                
                    
         edit : $(objects)                
                 cc -o edit $(objects)                
         main.o : main.c defs.h                
                 cc -c main.c                
         kbd.o : kbd.c defs.h command.h                
                 cc -c kbd.c                
         command.o : command.c defs.h command.h                
                 cc -c command.c                
         display.o : display.c defs.h buffer.h                
                 cc -c display.c                
         insert.o : insert.c defs.h buffer.h                
                 cc -c insert.c                
         search.o : search.c defs.h buffer.h                
                 cc -c search.c                
         files.o : files.c defs.h buffer.h command.h                
                 cc -c files.c                
         utils.o : utils.c defs.h                
                 cc -c utils.c                
         clean :                
                 rm edit $(objects)

    后文待续

  • 相关阅读:
    MapReduce之Map Join
    MapReduce之Reduce Join
    MapReduce清洗日志数据统计PV量
    Hadoop MapReduce自定义数据类型
    ES6 对象拓展方法
    ES6箭头函数与this指向
    ES6参数默认值,剩余参数及展开数组
    ES6模板字符串及字符串的扩展方法
    浅谈ES6数组及对象的解构
    ECMAScript概述及浅谈const,let与块级作用域
  • 原文地址:https://www.cnblogs.com/gaojian/p/2683444.html
Copyright © 2011-2022 走看看