简单检查现有文件时 Makefile 出错
Error in Makefile during a simple check for existing file
在生成文件中,我需要检查文件是否存在。关于这个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
我的错误在哪里以及如何解释此语法错误消息?
您已经标记了 make 语法行,因此 make 将它们传递给您的 shell,去掉标签(同时反转条件并删除引号)
all:
ifeq (,$(wildcard testFile))
echo File is missing
else
echo File exists
endif
在生成文件中,我需要检查文件是否存在。关于这个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
我的错误在哪里以及如何解释此语法错误消息?
您已经标记了 make 语法行,因此 make 将它们传递给您的 shell,去掉标签(同时反转条件并删除引号)
all:
ifeq (,$(wildcard testFile))
echo File is missing
else
echo File exists
endif