Hi all,

thanks for your help. The fix by Philip works like a charm.
I had issues with making 'make' recogonize, $?.  I guess it should have been
$$? :)


Thanks a lot.

-Satish


On 5/5/07, Philip Guenther <[EMAIL PROTECTED]> wrote:

On 5/4/07, Eli Zaretskii <[EMAIL PROTECTED]> wrote:
> From: "Satish Somasundaram" <[EMAIL PROTECTED]>
...
> >            for dir in `$(SUB_DIRS)`; do \
> >            $(MAKE) -C $$dir; \
> >            done
>
> Does the following (100% untested) modification work?
>
>             for dir in `$(SUB_DIRS)`; do \
>             $(MAKE) -C $$dir || (echo "ERROR" && exit 1); \
>             done

So close...  By wrapping the echo and exit in parens, you force them
to be performed by a subshell, so the exit doesn't affect the parent
shell which make is watching.  You need to either use braces instead
of parens or leave out the echo.

i.e., leaving out the echo:
            for dir in `$(SUB_DIRS)`; do \
                $(MAKE) -C $$dir || exit $$?; \
            done

(note: $$? will be expanded by make to $?, which the shell will then
expand to the exit status of the previous command)


vs using braces:
            for dir in `$(SUB_DIRS)`; do \
                $(MAKE) -C $$dir || { echo "ERROR" && exit 1; } \
            done

(Yes, the semicolon before the close brace is required, as braces are
"reserved words" and not "meta-characters" for the shell...)

Personally, I prefer the "no echo and no braces" version, as make is
noisy enough about the non-zero exit as is.


Philip Guenther

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

Reply via email to