在生成文件中,我需要检查文件是否存在。关于这个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
关于makefile - 简单检查现有文件时 Makefile 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40926931/