懂 Makefile 的同志进来下
时间:2010-07-10
来源:互联网
#target1 target2 target3: $@_config
# @echo "Build$@"
#target1_config target2_config target3_config:
# @echo "$@"
target1 target2 target3:
@make $@_config
@echo "Build$@"
target1_config target2_config target3_config:
@echo "$@"
上面的代码是我自己试验的.
(1) 上面用 '#' 注释掉的代码是不能 work 的
(2) 下面没有注释的代码是可以 work 的
大家能解释下为什么注释的代码不能 work ?
tks
作者: shi_wen_qiang 发布时间: 2010-07-10
automatic variable values are available: they only have values within
the command script. In particular, you cannot use them anywhere within
the target list of a rule; they have no value there and will expand to
the empty string. Also, they cannot be accessed directly within the
prerequisite list of a rule. A common mistake is attempting to use
`$@' within the prerequisites list; this will not work. However, there
is a special feature of GNU `make', secondary expansion (*note
Secondary Expansion:

be used in prerequisite lists.
这个问题挺有意思,以前没关注过,翻了半天手册。
作者: 帅绝人寰 发布时间: 2010-07-10
作者: nhuczp 发布时间: 2010-07-10
target1 target2 target3: % : %_config
@echo "Build$@"
作者: drangon 发布时间: 2010-07-10
谢谢大家的回复.
原来很多东西在 manual 里面都可以找到.
作者: shi_wen_qiang 发布时间: 2010-07-10
ps, 推荐一个看info手册的利器:pinfo。
作者: 帅绝人寰 发布时间: 2010-07-10
作者: surpass_li 发布时间: 2010-07-10
作者: peijue 发布时间: 2010-07-10
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28