在makefile中我需要检查文件是否存在。关于这个answer from holms,我试着这样做了:
all:
ifeq ("","$(wildcard testFile)")
echo "File exists"
else
echo "File is missing"
endif
然而我收到了这个错误:
ifeq ("","")
/bin/sh: 1: Syntax error: word unexpected (expecting ")")
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2
我的错误在哪里以及如何解释此语法错误消息?
答案 0 :(得分:3)
您已选中make语法行,因此make将它们传递给您的shell,摆脱标签(也反转条件并删除引号)
all:
ifeq (,$(wildcard testFile))
echo File is missing
else
echo File exists
endif