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

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

posted @ 2015-12-08 00:01  大老渊  阅读(469)  评论(0编辑  收藏  举报