简体   繁体   English

带有 2 个目标和 if 语句的 makefile,为什么会出错?

[英]makefile with 2 targets and if statement,error why?

Makefile:生成文件:

ab: if [ -fs ];then echo aaa fi

command:make b命令:make b

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

Could anyone tell me why?谁能告诉我为什么?

You should not be mixing shell scripting and make scripting.您不应该混合使用 shell 脚本和 make 脚本。 Try the below试试下面的

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM