On Tue, 2011-07-19 at 15:23 +0200, Warlich, Christof wrote:
> all:
>     @for i in false true; do\
>         if ! eval $$i; then\
>             echo We leave the loop when $$i is called, but ...;\
>             false;\
>             break;\
>         fi;\
>     done;
>     @echo ... the exit status is always $$?. So how can I cause make\
>                 to stop when a failure occurs inside a for loop?;
> $ make
> We leave the loop when false is called, but ...
> ... the exit status is always 0.

The exit status is the exit code of the final program, unless you exit
early.  The exit code of "break" is not an error.

> So how can I cause make to stop when a failure occurs inside a for
> loop?

Use "exit 1" instead of "false; break;"

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email protected]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to