无法检查 makefile 中的文件是否存在

Can't check file existense in a makefile

阅读 this answer 的 "How do I check if file exists in Makefile?" 问题后,我决定尝试一下。我在与生成文件相同的文件夹中有一个文件 tact1.pdf

代码:

FILE = 'tact1.pdf'
all:
ifneq ("$(wildcard $(FILE))","")
    @echo "File exists"
else
    @echo "No file"
endif

输出:

$ make
No file

我尝试了文件的完整路径:同样的结果。怎么了? OS: Windows XP,使用 cygwin。

去掉文件名两边的引号。它们在 bash 或 perl 中可能没问题,但在 makefile 中,它们被视为文件名的第一个和最后一个字符。

FILE = tact1.pdf