"Bob Proulx" <b...@proulx.com> wrote:
If tee exits last then it will set the $? exit code. I didn't try it but I think that is your problem. I didn't try it so I could be wrong.
You were right.
depend all clean distclean: rm -f make.log ; \ for d in $(DIRS) ; do \ $(MAKE) -C $$d $@ ; \ if [ $$? -ne 0 ]; then \ echo "make failed with error $$?"; \ exit 1; \ fi; \ done | tee -a make.log
I actually did this before I read your reply.
Additionally that pwd save and cd restore was useless in the example you showed.
I don't know 'sh' that well. I imagined I had to push pop the directery. Thanks for your help!