Catch all errors in for and while loops in makefiles. Don't ignore any
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 18 Mar 2008 16:24:50 +0000 (16:24 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 18 Mar 2008 16:24:50 +0000 (16:24 +0000)
errors in any commands, including in various clean targets that have so far
been handled inconsistently.  make -i is available to ignore all errors in
a consistent and official way.

17 files changed:
GNUmakefile.in
doc/Makefile
src/Makefile
src/backend/snowball/Makefile
src/backend/utils/mb/conversion_procs/Makefile
src/bin/Makefile
src/interfaces/Makefile
src/interfaces/ecpg/Makefile
src/pl/Makefile
src/pl/plpgsql/Makefile
src/test/bench/Makefile
src/test/locale/Makefile
src/test/locale/de_DE.ISO8859-1/Makefile
src/test/locale/gr_GR.ISO8859-7/Makefile
src/test/locale/koi8-r/Makefile
src/test/locale/koi8-to-win1251/Makefile
src/test/regress/GNUmakefile

index 434d7af42fa88eea5383bba576eaab450053b8e6..7c743df20b54a376d3ed242bfceb0c85bdf2b17b 100644 (file)
@@ -44,11 +44,11 @@ clean:
 # Important: distclean `src' last, otherwise Makefile.global
 # will be gone too soon.
 distclean maintainer-clean:
-       -$(MAKE) -C doc $@
-       -$(MAKE) -C contrib $@
-       -$(MAKE) -C config $@
-       -$(MAKE) -C src $@
-       -rm -f config.cache config.log config.status GNUmakefile
+       $(MAKE) -C doc $@
+       $(MAKE) -C contrib $@
+       $(MAKE) -C config $@
+       $(MAKE) -C src $@
+       rm -f config.cache config.log config.status GNUmakefile
 # Garbage from autoconf:
        @rm -rf autom4te.cache/
 
@@ -72,7 +72,7 @@ ifeq ($(split-dist), yes)
 dist: postgresql-base-$(VERSION).tar.gz postgresql-docs-$(VERSION).tar.gz postgresql-opt-$(VERSION).tar.gz postgresql-test-$(VERSION).tar.gz 
 endif
 dist:
-       -rm -rf $(distdir)
+       rm -rf $(distdir)
 
 $(distdir).tar: distdir
        $(TAR) chf $@ $(distdir)
@@ -97,7 +97,7 @@ postgresql-test-$(VERSION).tar: distdir
        $(TAR) cf $@ $(distdir)/src/test
 
 distdir:
-       -rm -rf $(distdir)* $(dummy)
+       rm -rf $(distdir)* $(dummy)
        for x in `cd $(top_srcdir) && find . -name CVS -prune -o -print`; do \
          file=`expr X$$x : 'X\./\(.*\)'`; \
          if test -d "$(top_srcdir)/$$file" ; then \
@@ -116,7 +116,7 @@ distdir:
        rm -f $(distdir)/README.CVS
 
 distcheck: $(distdir).tar.gz
-       -rm -rf $(dummy)
+       rm -rf $(dummy)
        mkdir $(dummy)
        $(GZIP) -d -c $< | $(TAR) xf -
        install_prefix=`cd $(dummy) && pwd`; \
@@ -131,7 +131,7 @@ distcheck: $(distdir).tar.gz
        $(MAKE) -C $(distdir) dist
 # Room for improvement: Check here whether this distribution tarball
 # is sufficiently similar to the original one.
-       -rm -rf $(distdir) $(dummy)
+       rm -rf $(distdir) $(dummy)
        @echo "Distribution integrity checks out."
 
 .PHONY: dist distdir distcheck
index 73cf658d23d36ad6c66140c916eedc17712ad4e6..2e2884e60137d188259e57fa85269b319117a69d 100644 (file)
@@ -90,10 +90,10 @@ endif
 
 uninstall:
 ifdef found_html
-       -rm -f $(addprefix $(DESTDIR)$(htmldir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | tar tf -))
+       rm -f $(addprefix $(DESTDIR)$(htmldir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | tar tf -))
 endif
 ifdef found_man
-       -rm -f $(addprefix $(DESTDIR)$(mandir)/, $(shell gunzip -c $(srcdir)/man.tar.gz | tar tf - | sed -e 's,man$(sqlmansect_dummy)/,man$(sqlmansectnum)/,' -e 's/.$(sqlmansect_dummy)$$/.$(sqlmansect)/'))
+       rm -f $(addprefix $(DESTDIR)$(mandir)/, $(shell gunzip -c $(srcdir)/man.tar.gz | tar tf - | sed -e 's,man$(sqlmansect_dummy)/,man$(sqlmansectnum)/,' -e 's/.$(sqlmansect_dummy)$$/.$(sqlmansect)/'))
 endif
 
 
index 250bcd1d777d55aa215137d9ac9c78e9d3c5a90a..acefa7580b04457d2b9b71e7cd2eefa8e023c6a3 100644 (file)
@@ -59,18 +59,18 @@ clean:
        $(MAKE) -C test/thread $@
 
 distclean maintainer-clean:
-       -$(MAKE) -C port $@
-       -$(MAKE) -C timezone $@
-       -$(MAKE) -C backend $@
-       -$(MAKE) -C backend/snowball $@
-       -$(MAKE) -C include $@
-       -$(MAKE) -C interfaces $@
-       -$(MAKE) -C bin $@
-       -$(MAKE) -C pl $@
-       -$(MAKE) -C makefiles $@
-       -$(MAKE) -C test $@
-       -$(MAKE) -C tutorial NO_PGXS=1 $@
-       -$(MAKE) -C test/thread $@
+       $(MAKE) -C port $@
+       $(MAKE) -C timezone $@
+       $(MAKE) -C backend $@
+       $(MAKE) -C backend/snowball $@
+       $(MAKE) -C include $@
+       $(MAKE) -C interfaces $@
+       $(MAKE) -C bin $@
+       $(MAKE) -C pl $@
+       $(MAKE) -C makefiles $@
+       $(MAKE) -C test $@
+       $(MAKE) -C tutorial NO_PGXS=1 $@
+       $(MAKE) -C test/thread $@
        rm -f Makefile.port Makefile.global
 
 
index 07f0d3096b4a85d495ca89dbd8b62c8f1e7add00..ce2067af5c3e6170bb4902b6abefe357b4ed4234 100644 (file)
@@ -92,7 +92,8 @@ $(SQLSCRIPT): Makefile snowball_func.sql.in snowball.sql.in
 ifeq ($(enable_shared), yes)
        echo '-- Language-specific snowball dictionaries' > $@
        cat $(srcdir)/snowball_func.sql.in >> $@        
-       @set $(LANGUAGES) ; \
+       @set -e; \
+       set $(LANGUAGES) ; \
        while [ "$$#" -gt 0 ] ; \
        do \
                lang=$$1; shift; \
@@ -120,7 +121,8 @@ ifeq ($(enable_shared), yes)
        $(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
 endif
        $(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
-       @set $(LANGUAGES) ; \
+       @set -e; \
+       set $(LANGUAGES) ; \
        while [ "$$#" -gt 0 ] ; \
        do \
                lang=$$1; shift; shift; \
@@ -135,7 +137,8 @@ installdirs:
 uninstall:
        rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
        rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)'
-       @set $(LANGUAGES) ; \
+       @set -e; \
+       set $(LANGUAGES) ; \
        while [ "$$#" -gt 0 ] ; \
        do \
                lang=$$1; shift; shift;  \
index a797e3bdbfb0f37a664a01453c4ae12dfa3ce1e1..aced4d1de7de9c2420408c8c831eba36b12974c1 100644 (file)
@@ -164,7 +164,8 @@ all: $(SQLSCRIPT)
 
 $(SQLSCRIPT): Makefile
 ifeq ($(enable_shared), yes)
-       @set $(CONVERSIONS) ; \
+       @set -e; \
+       set $(CONVERSIONS) ; \
        while [ "$$#" -gt 0 ] ; \
        do \
                name=$$1;shift; \
@@ -182,7 +183,8 @@ else
 endif
 
 $(REGRESSION_SCRIPT): Makefile
-       @cp regress_prolog $@; \
+       @set -e; \
+       cp regress_prolog $@; \
        set $(CONVERSIONS) ; \
        while [ "$$#" -gt 0 ] ; \
        do \
@@ -210,5 +212,5 @@ uninstall:
 
 clean distclean maintainer-clean:
        rm -f $(SQLSCRIPT)
-       @for dir in $(DIRS); do $(MAKE) -C $$dir $@; done
+       @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
 
index 0f356bb29a430bc4bd133ada3dc61777bb48b898..1388b30a0a4913ca0af34cd37d9a64520929c4d8 100644 (file)
@@ -19,8 +19,5 @@ ifeq ($(PORTNAME), win32)
 DIRS+=pgevent
 endif
 
-all install installdirs uninstall distprep:
+all install installdirs uninstall distprep clean distclean maintainer-clean:
        @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
-
-clean distclean maintainer-clean:
-       -@for dir in $(DIRS); do $(MAKE) -C $$dir $@; done
index 4de35c1140bc8f5a33728a33267a7a3210e1c185..7a465793142e9990b81a0b181ea0415a815688b5 100644 (file)
@@ -14,13 +14,5 @@ include $(top_builddir)/src/Makefile.global
 
 DIRS = libpq ecpg 
 
-ALLDIRS = $(DIRS) 
-
-all install installdirs uninstall distprep:
+all install installdirs uninstall distprep clean distclean maintainer-clean:
        @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
-
-clean:
-       @for dir in $(DIRS); do $(MAKE) -C $$dir $@; done
-
-distclean maintainer-clean:
-       @for dir in $(ALLDIRS); do $(MAKE) -C $$dir $@; done
index c83144d89594e2c9ca10a20900a05ff25595b73f..71bfff672d7c77c622db949c1f5dbc82dd6cd196 100644 (file)
@@ -10,12 +10,12 @@ all install installdirs uninstall distprep:
        $(MAKE) -C preproc $@
 
 clean distclean maintainer-clean:
-       -$(MAKE) -C include $@
-       -$(MAKE) -C pgtypeslib $@
-       -$(MAKE) -C ecpglib $@
-       -$(MAKE) -C compatlib $@
-       -$(MAKE) -C preproc $@
-       -$(MAKE) -C test clean
+       $(MAKE) -C include $@
+       $(MAKE) -C pgtypeslib $@
+       $(MAKE) -C ecpglib $@
+       $(MAKE) -C compatlib $@
+       $(MAKE) -C preproc $@
+       $(MAKE) -C test clean
 
 check checktcp installcheck: all
        $(MAKE) -C test $@
index b6eaee45c2c84b9a76d1888fbd967b06bc3b01aa..34614debbdda6660f88776fb5a794dcf50b84304 100644 (file)
@@ -26,11 +26,8 @@ ifeq ($(with_tcl), yes)
 DIRS += tcl
 endif
 
-all install installdirs uninstall distprep:
-       @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit 1; done
-
-clean distclean maintainer-clean:
-       @for dir in $(DIRS); do $(MAKE) -C $$dir $@; done
+all install installdirs uninstall distprep clean distclean maintainer-clean:
+       @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
 
 # We'd like check operations to run all the subtests before failing.
 check installcheck:
index 11ca1791d08ce20d310946e26294d13e4dc1e1a3..bb41207f98ad4e713de5b909c8fc6cd71dd04cc3 100644 (file)
@@ -12,8 +12,5 @@ subdir = src/pl/plpgsql
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-all install installdirs uninstall distprep:
+all install installdirs uninstall distprep clean distclean maintainer-clean:
        $(MAKE) -C src $@
-
-clean distclean maintainer-clean:
-       -$(MAKE) -C src $@
index 4649161473dede469a9bdc8e166d48e9eef29456..655aa5ab8f0ee3b28f5299cc644b34b1c38943a2 100644 (file)
@@ -31,9 +31,9 @@ create.sql: create.source
 bench.sql: 
        x=1; \
        for i in `ls query[0-9][0-9]`; do \
-         echo "select $$x as x" >> bench.sql; \
-         cat $$i >> bench.sql; \
-         x=`expr $$x + 1`; \
+         echo "select $$x as x" >> bench.sql && \
+         cat $$i >> bench.sql && \
+         x=`expr $$x + 1` || exit; \
        done
 
 runtest: $(OUTFILES)
index 4faf53d257f5850a451154407a49564ccd409ebe..86002819691cb1ece78654b04ecd40dde6fcb56c 100644 (file)
@@ -13,7 +13,7 @@ all: $(PROGS)
 clean: 
        rm -f $(PROGS)
        for d in $(DIRS); do \
-               $(MAKE) -C $$d clean; \
+               $(MAKE) -C $$d clean || exit; \
        done
 
 check-%: all
index 281014521ef12a20e88338a995b1cd85489bac9f..fd8301928eff14470533410e41bd952348bb3f4c 100644 (file)
@@ -1,12 +1,7 @@
-#
-# Makefile for example programs
-#
-
 all: 
-       -@echo "make: Nothing to be done for \`all'."
 
 test: 
-       @./runall
+       ./runall
 
 clean: 
        rm -f *.out
index 281014521ef12a20e88338a995b1cd85489bac9f..fd8301928eff14470533410e41bd952348bb3f4c 100644 (file)
@@ -1,12 +1,7 @@
-#
-# Makefile for example programs
-#
-
 all: 
-       -@echo "make: Nothing to be done for \`all'."
 
 test: 
-       @./runall
+       ./runall
 
 clean: 
        rm -f *.out
index 281014521ef12a20e88338a995b1cd85489bac9f..fd8301928eff14470533410e41bd952348bb3f4c 100644 (file)
@@ -1,12 +1,7 @@
-#
-# Makefile for example programs
-#
-
 all: 
-       -@echo "make: Nothing to be done for \`all'."
 
 test: 
-       @./runall
+       ./runall
 
 clean: 
        rm -f *.out
index 281014521ef12a20e88338a995b1cd85489bac9f..fd8301928eff14470533410e41bd952348bb3f4c 100644 (file)
@@ -1,12 +1,7 @@
-#
-# Makefile for example programs
-#
-
 all: 
-       -@echo "make: Nothing to be done for \`all'."
 
 test: 
-       @./runall
+       ./runall
 
 clean: 
        rm -f *.out
index bfc97fab4c435d54481239bb6086a363507db5ba..6441f2b56896846b78b480000eec9e2fc3b3ea50 100644 (file)
@@ -133,7 +133,7 @@ all-spi:
 # Tablespace setup
 .PHONY: tablespace-setup
 tablespace-setup:
-       -rm -rf ./testtablespace
+       rm -rf ./testtablespace
        mkdir ./testtablespace
 
 ##