Re: shell for-loop in make

2014-10-23 Thread Bob Proulx
Hi Paul! Paul Jarc wrote: > Bob Proulx wrote: > > 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

Re: shell for-loop in make

2014-10-23 Thread Paul Jarc
Bob Proulx wrote: > ElChino wrote: >>$(MAKE) -C $$d $@ | tee -a make.log ; \ > >> But the 'exit' isn't called when $(MAKE) fails on a target. >> Anybody see the problem? > > If tee exits last then it will set the $? exit code. That will happen regardless of what order the commands exit. It's

Re: shell for-loop in make

2014-10-23 Thread ElChino
"Bob Proulx" 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 ]

Re: shell for-loop in make

2014-10-23 Thread Bob Proulx
ElChino wrote: >$(MAKE) -C $$d $@ | tee -a make.log ; \ > But the 'exit' isn't called when $(MAKE) fails on a target. > Anybody see the problem? 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. Havin