您的位置:首页 > 其它

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

2016-04-15 17:02 309 查看
$(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.
http://www.gnu.org/software/make/manual/make.html
自动化变量$(@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 $@)’.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: