博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
GNU make manual 翻译( 一百六十六)
阅读量:7223 次
发布时间:2019-06-29

本文共 1856 字,大约阅读时间需要 6 分钟。

继续翻译

6.8 Defining Multi-Line Variables=================================Another way to set the value of a variable is to use the `define'directive.  This directive has an unusual syntax which allows newlinecharacters to be included in the value, which is convenient fordefining both canned sequences of commands (*note Defining CannedRecipes: Canned Recipes.), and also sections of makefile syntax to usewith `eval' (*note Eval Function::).   The `define' directive is followed on the same line by the name ofthe variable being defined and an (optional) assignment operator, andnothing more.  The value to give the variable appears on the followinglines.  The end of the value is marked by a line containing just theword `endef'.  Aside from this difference in syntax, `define' worksjust like any other variable definition.  The variable name may containfunction and variable references, which are expanded when the directiveis read to find the actual variable name to use.   You may omit the variable assignment operator if you prefer.  Ifomitted, `make' assumes it to be `=' and creates a recursively-expandedvariable (*note The Two Flavors of Variables: Flavors.).  When using a`+=' operator, the value is appended to the previous value as with anyother append operation: with a single space separating the old and newvalues.

6.8 定义多行变量

=================================

另一个设置一个变量的值的方法就是使用 define 指令。这个指令有一个不同寻常的语法,允许新行字符被包含在其中,方便我们定义命令序列包(*note Defining Canned Recipes: Canned Recipes.),并且也方便用 eval 函数来分隔makefile的语法(*note Eval Functions::)。

define指令在同一行的变量名后面,还有一个(可选的)赋值符号,再没有其他的了。

对变量的赋值出现在后面的行里,值的最后用一个仅仅包含单词'endef'来结尾。除了语法上的略有不同,define的工作方式就像其他的变量定义一样。 

变量名中可以博阿含函数或者变量参照,当是实际读取便来能够命的真实值的时候会被扩展。

如果愿意,你可以省略变量的赋值操作符。如果省略掉,make 假定它为 = ,轻且创建一个递归扩展式的变量(*note The Two Flavors of Variables: Flavors.)。当使用 +=操作符,值会附加到之前的值之上,和其他追加操作一样:有一个单独的空格在旧的和新的值之间。

后文待续

转载地址:http://fuzfm.baihongyu.com/

你可能感兴趣的文章
AES加密算法的JAVA实现
查看>>
面试系列-高并发之synchronized
查看>>
JAVA8给我带了什么——lambda表达
查看>>
我们在编写python代码时应该注意那几件事 !
查看>>
微软工程师认为 Mozilla 也应该拥抱 Chromium
查看>>
论文笔记系列-Neural Architecture Search With Reinforcement Learning
查看>>
使用文本框TextView/EditText的开源库清单
查看>>
通过一个实际例子理解Kubernetes里pod的自动scale - 水平自动伸缩
查看>>
手把手教您将 libreoffice 移植到函数计算平台
查看>>
Ansible批量修改root密码(playbook)
查看>>
c#-WPF string,color,brush之间的转换
查看>>
镁客网每周硬科技领域投融资汇总(10.21-10.27),AI芯片创企Syntiant获英特尔等头部企业投资...
查看>>
惰性计算辨析
查看>>
单据类报表的制作
查看>>
EVCache缓存在 Spring Boot中的实战
查看>>
Kubernetes-架构路线图
查看>>
java类加载时机与过程
查看>>
Win10安装MySQL5.7.22 解压缩版(手动配置)方法
查看>>
ASP.NET CORE系列【四】基于Claim登录授权
查看>>
PostgreSQL checksum
查看>>