Linux之Makefile(# ?=)
来源:互联网 发布:淘宝4.6 编辑:程序博客网 时间:2024/05/16 23:36
如果我们要定义一个变量,其值是一个空格,那么我们可以这样来:
nullstring :=
space := $(nullstring) # end of the line
nullstring是一个Empty变量,其中什么也没有,而我们的space的值是一个空格。因为在操作符的右边是很难描述一个空格的,这里采用的技术很管用,先用一个Empty变量来标明变量的值开始了,而后面采用“#”注释符来表示变量定义的终止,这样,我们可以定义出其值是一个空格的变量。请注意这里关于“#”的使用,注释符“#”的这种特性值得我们注意,如果我们这样定义一个变量:
dir := /foo/bar # directory to put the frobs in
dir这个变量的值是“/foo/bar”,后面还跟了4个空格,如果我们这样使用这样变量来指定别的目录——“$(dir)/file”那么就完蛋了。
还有一个比较有用的操作符是“?=”,先看示例:
FOO ?= bar
其含义是,如果FOO没有被定义过,那么变量FOO的值就是“bar”,如果FOO先前被定义过,那么这条语将什么也不做,其等价于:
ifeq ($(origin FOO), undefined)
FOO = bar
endif
0 0
- Linux之Makefile(# ?=)
- Linux之Makefile(Makefile规则例子)
- Linux之Makefile(Makefile规则)
- Linux之Makefile(Makefile内容)
- Linux之Makefile(变量)
- Linux之Makefile(wildcard)
- Linux之Makefile(ifdef)
- Linux之Makefile(subset)
- Linux之Makefile(patsubst)
- Linux之Makefile(strip)
- Linux之Makefile(findstring)
- Linux之Makefile(filter)
- Linux之Makefile(sort)
- Linux之Makefile(word)
- Linux之Makefile(wordlist)
- Linux之Makefile(words)
- Linux之Makefile(firstword)
- Linux之Makefile(dir)
- 不曾说出的话
- 使用ibatis查询数据小bug
- IEnumerable和IEnumerator 详解
- Android消息队列模型——Thread,Handler,Looper,Massage Queue
- 即将到来的2015
- Linux之Makefile(# ?=)
- 托福语法指导-并列连词及真题要点解析
- ETL Architecture: 01 Create BathPool Table
- java泛型实现链表基本操作
- 项目范围管理
- Activity生命周期
- Axure产品原型在手机上如何运行
- Quartz 2D编程指南(1) - 概览
- 【ASYNC IO】HP-UNIX_ORACLE10G_ASYNC IO ERROR