编译几个项目(生成文件),但停在第一个破构建? [英] Compile several projects (with makefile), but stop on first broken build?

查看:126
本文介绍了编译几个项目(生成文件),但停在第一个破构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的的东西的,如:

for i in *
do
    if test -d $i
    then
        cd $i; make clean; make; cd -;
    fi;
done

这工作得很好,但我想破发的 -loop在一个破碎的构建情况。

And this works fine, but I want "break" the for-loop in case of a broken build.

有没有办法做到这一点?也许某种,如果语句来,可检查的成功制作

Is there a way to do this? Maybe some kind of if-statement, that can check for success of make?

推荐答案

您可以检查是否制作已通过经检验其退出code成功退出 $ 变量,然后有一个语句:

You can check whether the make has exited successfully by examining its exit code via the $? variable, and then have a break statement:

...
make

if [ $? -ne 0 ]; then
    break
fi

这篇关于编译几个项目(生成文件),但停在第一个破构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆