[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shell for-loop in make
From: |
ElChino |
Subject: |
shell for-loop in make |
Date: |
Thu, 23 Oct 2014 19:34:01 +0200 |
Hello list. Can someone please help me fix the
below Makefile snippet. I try to understand why the sh-script
doesn't exit the makefile when make returns with !=0 exit-code.
Here is a snippet from my Makefile:
DIRS = dir1 \
dir2
# etc. a long list of dirs.
depend all clean distclean:
rm -f make.log ; \
_cwd=`pwd` ; \
for d in $(DIRS) ; do \
$(MAKE) -C $$d $@ | tee -a make.log ; \
if [ $$? -ne 0 ]; then \
echo "make failed with error $$?" | tee -a make.log; \
exit 1; \
fi; \
cd $$_cwd ; \
done
----------
But the 'exit' isn't called when $(MAKE) fails on a target.
Anybody see the problem?
- shell for-loop in make,
ElChino <=