From da06bc1d4088508781a82737365a486c2927a2f8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 8 Sep 2000 18:29:28 +0000 Subject: [PATCH] Make building scripts kind of consistent in look and feel, kind of immune to parallel make, kind of resistent to corruption due to incomplete builds. --- src/Makefile.global.in | 9 +++++++-- src/bin/initdb/Makefile | 8 +++----- src/bin/initlocation/Makefile | 3 ++- src/bin/ipcclean/Makefile | 3 ++- src/bin/pg-config/Makefile | 8 +++----- src/bin/pg_ctl/Makefile | 3 ++- src/bin/pg_dump/Makefile | 11 ++++++----- src/bin/pg_dump/pg_dumpall.sh | 8 ++++---- src/bin/scripts/Makefile | 9 +++++---- src/bin/scripts/createlang.sh | 11 ++++++----- 10 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 949d240fb2..d0188db79f 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -1,4 +1,4 @@ -# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.92 2000/08/31 16:09:22 petere Exp $ +# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.93 2000/09/08 18:29:20 petere Exp $ #------------------------------------------------------------------------------ # All PostgreSQL makefiles include this file and use the variables it sets, @@ -12,6 +12,11 @@ # parent directory of the directory this file is in.) #------------------------------------------------------------------------------ +# Delete target files if the command fails after it has +# started to update the file. +.DELETE_ON_ERROR: + + # PostgreSQL version number VERSION = @VERSION@ @@ -294,7 +299,7 @@ COMPILE.c = $(CC) -c $(CPPFLAGS) $(CFLAGS) autodepend = @autodepend@ -ifdef autodepend +ifeq ($(autodepend), yes) DEPDIR = .deps df = $(DEPDIR)/$(*F) diff --git a/src/bin/initdb/Makefile b/src/bin/initdb/Makefile index f8f656f81c..d856f8b4db 100644 --- a/src/bin/initdb/Makefile +++ b/src/bin/initdb/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.22 2000/09/01 13:15:27 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.23 2000/09/08 18:29:21 petere Exp $ # #------------------------------------------------------------------------- @@ -15,14 +15,12 @@ include $(top_builddir)/src/Makefile.global all: initdb initdb: initdb.sh $(top_builddir)/src/Makefile.global - rm -f $@ $@.tmp sed -e 's/@MULTIBYTE@/$(MULTIBYTE)/g' \ -e 's/@VERSION@/$(VERSION)/g' \ -e 's,@bindir@,$(bindir),g' \ -e 's,@datadir@,$(datadir),g' \ - $< >$@.tmp - chmod a+x $@.tmp - mv $@.tmp $@ + $< >$@ + chmod a+x $@ install: all installdirs $(INSTALL_SCRIPT) initdb $(bindir)/initdb diff --git a/src/bin/initlocation/Makefile b/src/bin/initlocation/Makefile index 05b32819de..2ea19e0462 100644 --- a/src/bin/initlocation/Makefile +++ b/src/bin/initlocation/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/Makefile,v 1.10 2000/08/31 16:11:07 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/Makefile,v 1.11 2000/09/08 18:29:22 petere Exp $ # #------------------------------------------------------------------------- @@ -16,6 +16,7 @@ all: initlocation initlocation: initlocation.sh cp $< $@ + chmod a+x $@ install: all installdirs $(INSTALL_SCRIPT) initlocation $(bindir)/initlocation diff --git a/src/bin/ipcclean/Makefile b/src/bin/ipcclean/Makefile index ab452f9e89..43d640afea 100644 --- a/src/bin/ipcclean/Makefile +++ b/src/bin/ipcclean/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/Makefile,v 1.12 2000/08/31 16:11:08 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/Makefile,v 1.13 2000/09/08 18:29:23 petere Exp $ # #------------------------------------------------------------------------- @@ -16,6 +16,7 @@ all: ipcclean ipcclean: ipcclean.sh cp $< $@ + chmod a+x $@ install: all installdirs $(INSTALL_SCRIPT) ipcclean $(bindir)/ipcclean diff --git a/src/bin/pg-config/Makefile b/src/bin/pg-config/Makefile index 3c2b5a0866..241d722c16 100644 --- a/src/bin/pg-config/Makefile +++ b/src/bin/pg-config/Makefile @@ -1,4 +1,4 @@ -# $Header: /cvsroot/pgsql/src/bin/pg-config/Attic/Makefile,v 1.1 2000/08/26 13:08:16 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg-config/Attic/Makefile,v 1.2 2000/09/08 18:29:26 petere Exp $ subdir = src/bin/pg-config top_builddir = ../../.. @@ -7,16 +7,14 @@ include $(top_builddir)/src/Makefile.global all: pg-config pg-config: pg-config.sh $(top_builddir)/config.status $(top_builddir)/src/Makefile.global Makefile - rm -f $@ $@.tmp configure=`sed -n '7s,^# [^ ]*configure *,,p' $(top_builddir)/config.status` && \ sed -e 's,@bindir@,$(bindir),g' \ -e 's,@includedir@,$(includedir),g' \ -e 's,@libdir@,$(libdir),g' \ -e "s,@configure@,$$configure,g" \ -e 's,@version@,$(VERSION),g' \ - $< >$@.tmp - chmod a+x $@.tmp - mv $@.tmp $@ + $< >$@ + chmod a+x $@ install: all installdirs $(INSTALL_SCRIPT) pg-config $(bindir)/pg-config diff --git a/src/bin/pg_ctl/Makefile b/src/bin/pg_ctl/Makefile index 200fdf8d6a..dc7defbd21 100644 --- a/src/bin/pg_ctl/Makefile +++ b/src/bin/pg_ctl/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1999, PostgreSQL Global Development Group # -# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Makefile,v 1.7 2000/08/31 16:11:10 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Makefile,v 1.8 2000/09/08 18:29:27 petere Exp $ # #------------------------------------------------------------------------- @@ -16,6 +16,7 @@ all: pg_ctl pg_ctl: pg_ctl.sh cp $< $@ + chmod a+x $@ install: all installdirs $(INSTALL_SCRIPT) pg_ctl $(bindir)/pg_ctl diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile index 87d9ace079..53d0e8e930 100644 --- a/src/bin/pg_dump/Makefile +++ b/src/bin/pg_dump/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.23 2000/08/31 16:11:13 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.24 2000/09/08 18:29:27 petere Exp $ # #------------------------------------------------------------------------- @@ -30,10 +30,11 @@ pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a $(MAKE) -C ../../utils strdup.o pg_dumpall: pg_dumpall.sh - sed -e 's:__VERSION__:$(VERSION):g' \ - -e 's:__MULTIBYTE__:$(MULTIBYTE):g' \ - -e 's:__bindir__:$(bindir):g' \ - < $< > $@ + sed -e 's,@VERSION@,$(VERSION),g' \ + -e 's,@MULTIBYTE@,$(MULTIBYTE),g' \ + -e 's,@bindir@,$(bindir),g' \ + $< >$@ + chmod a+x $@ .PHONY: submake submake: diff --git a/src/bin/pg_dump/pg_dumpall.sh b/src/bin/pg_dump/pg_dumpall.sh index 3c0d28397b..e638681562 100644 --- a/src/bin/pg_dump/pg_dumpall.sh +++ b/src/bin/pg_dump/pg_dumpall.sh @@ -6,14 +6,14 @@ # and "pg_group" tables, which belong to the whole installation rather # than any one individual database. # -# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.3 2000/07/04 16:29:59 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_dumpall.sh,v 1.4 2000/09/08 18:29:27 petere Exp $ CMDNAME=`basename $0` # substituted at build -VERSION='__VERSION__' -MULTIBYTE='__MULTIBYTE__' -bindir='__bindir__' +VERSION='@VERSION@' +MULTIBYTE='@MULTIBYTE@' +bindir='@bindir@' # # Find out where we're located diff --git a/src/bin/scripts/Makefile b/src/bin/scripts/Makefile index e43fc90121..85ef899048 100644 --- a/src/bin/scripts/Makefile +++ b/src/bin/scripts/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/scripts/Makefile,v 1.8 2000/08/31 16:11:25 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Makefile,v 1.9 2000/09/08 18:29:28 petere Exp $ # #------------------------------------------------------------------------- @@ -17,9 +17,10 @@ SCRIPTS := createdb dropdb createuser dropuser createlang droplang vacuumdb all: $(SCRIPTS) createlang: createlang.sh - sed -e 's:__DLSUFFIX__:$(DLSUFFIX):g' \ - -e 's:__libdir__:$(libdir):g' \ - $< > $@ + sed -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' \ + -e 's,@libdir@,$(libdir),g' \ + $< >$@ + chmod a+x $@ install: all installdirs for i in $(SCRIPTS); do $(INSTALL_SCRIPT) $$i $(bindir) || exit; done diff --git a/src/bin/scripts/createlang.sh b/src/bin/scripts/createlang.sh index 46e503baf4..0ba0edaa97 100644 --- a/src/bin/scripts/createlang.sh +++ b/src/bin/scripts/createlang.sh @@ -8,7 +8,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.14 2000/08/20 11:56:29 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.15 2000/09/08 18:29:28 petere Exp $ # #------------------------------------------------------------------------- @@ -160,7 +160,7 @@ fi # Check that we have PGLIB # ---------- if [ -z "$PGLIB" ]; then - PGLIB='__libdir__' + PGLIB='@libdir@' fi # ---------- @@ -206,13 +206,14 @@ case "$langname" in ;; esac +DLSUFFIX='@DLSUFFIX@' # ---------- # Check that the shared object for the call handler is installed # in PGLIB # ---------- -if [ ! -f $PGLIB/${object}__DLSUFFIX__ ]; then - echo "$CMDNAME: cannot find the file $PGLIB/${langname}__DLSUFFIX__" +if [ ! -f "$PGLIB/$object$DLSUFFIX" ]; then + echo "$CMDNAME: cannot find the file \`$PGLIB/$langname$DLSUFFIX'" echo "" echo "This file contains the call handler for $lancomp. By default," echo "only PL/pgSQL is built and installed; other languages must be" @@ -251,7 +252,7 @@ fi # ---------- # Create the call handler and the language # ---------- -$PSQL "CREATE FUNCTION $handler () RETURNS OPAQUE AS '$PGLIB/${object}__DLSUFFIX__' LANGUAGE 'newC'" +$PSQL "CREATE FUNCTION $handler () RETURNS OPAQUE AS '$PGLIB/${object}$DLSUFFIX' LANGUAGE 'newC'" if [ $? -ne 0 ]; then echo "$CMDNAME: language installation failed" exit 1 -- 2.11.0