1.错误makefile示例,有syntax error: unexpected end of file
fo=one three five
test:
for j in $(fo); do \
echo $$j; \
end
在写 for循环的时候,注意格式
- for之前用tab键
- do前后有空格
在命令行中输入make test
运行结果如下所示
2.修改了makefile,没有error
fo=one three five
test:
for j in $(fo); do \
echo $$j; \
done
运行make test
结果如下所示
3.如果运行结果不想要显示如下几行
则makefile如下所示
fo=one three five
test:
@(for j in $(fo); do \
echo $$j; \
done)
运行make test
结果如下所示
4.另一种方法,makefile中使用foreach循环
fo=one three five
test:
@(foreach j, $(fo), \
echo $j; \
)
运行结果如下所示
5.参考使用makefile for语句要注意的问题-CSDN博客
如有不正,欢迎指正
标签:bin,do,unexpected,end,makefile,three,five,test,fo From: https://blog.csdn.net/jinyuya/article/details/140212477