help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Breaking from a for loop?


From: David Aldrich
Subject: RE: Breaking from a for loop?
Date: Tue, 24 Nov 2009 11:03:45 +0000

Hi Philip

>Answer #1: it's just a /bin/sh 'for' loop; the shell's 'break'
>built-in works there:

Thanks very much for your answer.

I have modified my code accordingly and laid the shell script out better:

.PHONY : makedynamiclibs
makedynamiclibs :
        for d in $(DYNAMIC_LIBS); do                         \
            $(MAKE) --quiet --directory=$$d $(MAKECMDGOALS); \
            if ( $$? > 0 );                                  \
            then                                             \
                break;                                       \
            else :; fi;                                      \        
        done

# EOF

All lines of the script start with one tab. I get an error:

$ make
for d in <list>; do                                          \
            make --quiet --directory=$d ;                    \
            if ( $? > 0 );                                   \
            then                                             \
                break;                                       \
            else :; fi;                                      \
/bin/sh: -c: line 6: syntax error: unexpected end of file
make: *** [makedynamiclibs] Error 2

I can't see the reason for the syntax error. Can you help please?

Also, I would like to pass the command line options (e.g. -k) to the lower 
level makefile in the second line of this script. How would I do that please?

Best regards

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]