码迷,mamicode.com
首页 > 其他好文 > 详细

makefile下$(wildcard $^),$^,$@,$?,$<,$(@D),$(@F)

时间:2015-12-08 01:59:32      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:

makefile下$(wildcard $^),$^,$@,$?,$<,$(@D),$(@F)代表的不同含义

$(filter-out $(PHONY) $(wildcard $^),$^)
常用用法为$(wildcard *.c)
表示列举当前目录下的所有.c文件
这里$^因为会包含依赖的文件名,如果包含的该文件存在,那么将返回其含路径的文件名
所以$(wildcard $^)就是用来过滤$^包含的所有文件并且该文件确实在本地存在.

自动化变量$?代表依赖文件列表中被改变过的所有文件。
自动化变量$^代表所有通过目录搜索得到的依赖文件的完整路径名(目录 + 一般文件名)列表。
自动化变量$@代表规则的目标。
自动化变量$<代表规则中通过目录搜索得到的依赖文件列表的第一个依赖文件。
自动化变量$(@D)
The directory part of the file name of the target, with the trailing slash removed. If the value of ‘$@’ is dir/foo.o then ‘$(@D)’ is dir. This value is . if ‘$@’ does not contain a slash.
自动化变量$(@F)
The file-within-directory part of the file name of the target. If the value of ‘$@’ is dir/foo.o then ‘$(@F)’ is foo.o. ‘$(@F)’ is equivalent to ‘$(notdir $@)’.

GNU make学习网址:

http://www.gnu.org/software/make/manual/make.html

makefile下$(wildcard $^),$^,$@,$?,$<,$(@D),$(@F)

标签:

原文地址:http://www.cnblogs.com/wind8961/p/5027927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!