makefile有2个目标和if语句,错误原因何在?

时间:2014-04-03 09:44:22

标签: linux makefile

生成文件:

a b: if [ -f s ];then echo aaa fi

命令:make b

if [ -f s ];then /bin/sh: -c: line 1: syntax error: unexpected end of file make: *** [b] Error 2

有人可以告诉我为什么吗?

1 个答案:

答案 0 :(得分:0)

您不应该混合使用shell脚本并编写脚本。试试下面的

a b:
        @if test -f s; then \
             echo "aaa";\
        fi