曲径通幽论坛

标题: notdir -- 取文件名 [打印本页]

作者: beyes    时间: 2011-6-27 18:08
标题: notdir -- 取文件名
notdir 函数用来获取文件名,其语法格式是:
$(notdir NAMES...)
“NAMES..." 表示一系列的文件名,其中可以包含目录(以 '/' 符号结尾)名,但在函数返回时,会过滤掉目录部分,而只留下纯文件名部分。需要注意的是,被过滤掉的目录名在返回时用一个空格代替。

测试代码
all:
    @echo "$(notdir file1.c file2.txt /home/beyes/ test.h /root/)"

运行输出
$ make
file1.c file2.txt  test.h





欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2