• GNU make manual 翻译(二十)


    继续翻译

    2.4 Variables Make Makefiles Simpler                        
    ====================================                        
                            
    In our example, we had to list all the object files twice in the rule                        
    for `edit' (repeated here):                        
                            
         edit : main.o kbd.o command.o display.o \                        
                       insert.o search.o files.o utils.o                        
                 cc -o edit main.o kbd.o command.o display.o \                        
                       insert.o search.o files.o utils.o                        
                            
       Such duplication is error-prone; if a new object file is added to the 
    system, we might add it to one list and forget the other.  We can
    eliminate the risk and simplify the makefile by using a variable. 
    Variables allow a text string to be defined once and substituted in 
    multiple places later (*note How to Use Variables: Using Variables.).  

    2.4 变量使得makefile 更加简单 
    ====================================
    在我们的例子中,我们在 edit 的规则里面,不得不列举了所有目标文件两次:

    edit : main.o kbd.o command.o display.o \
    insert.o search.o files.o utils.o
    cc -o edit main.o kbd.o command.o display.o \
    insert.o search.o files.o utils.o

    这种重复容易导致出错;如果一个新的 目标文件被加入到系统中,我们也许会在某处加入了,而某处忘记了加入。

    我们可以通过使用变量,来消除这个风险,简化makefile。

    变量允许一个文本串定义一次,到处使用(*not How to Use Variables:Using Variables)。

    后文待续

  • 相关阅读:
    6、UITableView表的分割线左对齐
    5、清理mac缓存和关闭后台运行程序
    1、iOS9 HTTP 不能正常使用的解决办法
    在ios下提示“@synthesize of ‘weak’ property is only allowed in ARC or GC mode”
    java中的String类
    java思考题
    java思考
    java动手动脑思考
    大道至简第二章读后感
    JAVA训练参数求和
  • 原文地址:https://www.cnblogs.com/gaojian/p/2683394.html
Copyright © 2020-2023  润新知