Commit da06bc1d authored by Peter Eisentraut's avatar Peter Eisentraut

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.
parent f2bfe8a2
# $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, # All PostgreSQL makefiles include this file and use the variables it sets,
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
# parent directory of the directory this file is in.) # 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 # PostgreSQL version number
VERSION = @VERSION@ VERSION = @VERSION@
...@@ -294,7 +299,7 @@ COMPILE.c = $(CC) -c $(CPPFLAGS) $(CFLAGS) ...@@ -294,7 +299,7 @@ COMPILE.c = $(CC) -c $(CPPFLAGS) $(CFLAGS)
autodepend = @autodepend@ autodepend = @autodepend@
ifdef autodepend ifeq ($(autodepend), yes)
DEPDIR = .deps DEPDIR = .deps
df = $(DEPDIR)/$(*F) df = $(DEPDIR)/$(*F)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # 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 ...@@ -15,14 +15,12 @@ include $(top_builddir)/src/Makefile.global
all: initdb all: initdb
initdb: initdb.sh $(top_builddir)/src/Makefile.global initdb: initdb.sh $(top_builddir)/src/Makefile.global
rm -f $@ $@.tmp
sed -e 's/@MULTIBYTE@/$(MULTIBYTE)/g' \ sed -e 's/@MULTIBYTE@/$(MULTIBYTE)/g' \
-e 's/@VERSION@/$(VERSION)/g' \ -e 's/@VERSION@/$(VERSION)/g' \
-e 's,@bindir@,$(bindir),g' \ -e 's,@bindir@,$(bindir),g' \
-e 's,@datadir@,$(datadir),g' \ -e 's,@datadir@,$(datadir),g' \
$< >$@.tmp $< >$@
chmod a+x $@.tmp chmod a+x $@
mv $@.tmp $@
install: all installdirs install: all installdirs
$(INSTALL_SCRIPT) initdb $(bindir)/initdb $(INSTALL_SCRIPT) initdb $(bindir)/initdb
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # 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 ...@@ -16,6 +16,7 @@ all: initlocation
initlocation: initlocation.sh initlocation: initlocation.sh
cp $< $@ cp $< $@
chmod a+x $@
install: all installdirs install: all installdirs
$(INSTALL_SCRIPT) initlocation $(bindir)/initlocation $(INSTALL_SCRIPT) initlocation $(bindir)/initlocation
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # 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 ...@@ -16,6 +16,7 @@ all: ipcclean
ipcclean: ipcclean.sh ipcclean: ipcclean.sh
cp $< $@ cp $< $@
chmod a+x $@
install: all installdirs install: all installdirs
$(INSTALL_SCRIPT) ipcclean $(bindir)/ipcclean $(INSTALL_SCRIPT) ipcclean $(bindir)/ipcclean
......
# $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 subdir = src/bin/pg-config
top_builddir = ../../.. top_builddir = ../../..
...@@ -7,16 +7,14 @@ include $(top_builddir)/src/Makefile.global ...@@ -7,16 +7,14 @@ include $(top_builddir)/src/Makefile.global
all: pg-config all: pg-config
pg-config: pg-config.sh $(top_builddir)/config.status $(top_builddir)/src/Makefile.global Makefile 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` && \ configure=`sed -n '7s,^# [^ ]*configure *,,p' $(top_builddir)/config.status` && \
sed -e 's,@bindir@,$(bindir),g' \ sed -e 's,@bindir@,$(bindir),g' \
-e 's,@includedir@,$(includedir),g' \ -e 's,@includedir@,$(includedir),g' \
-e 's,@libdir@,$(libdir),g' \ -e 's,@libdir@,$(libdir),g' \
-e "s,@configure@,$$configure,g" \ -e "s,@configure@,$$configure,g" \
-e 's,@version@,$(VERSION),g' \ -e 's,@version@,$(VERSION),g' \
$< >$@.tmp $< >$@
chmod a+x $@.tmp chmod a+x $@
mv $@.tmp $@
install: all installdirs install: all installdirs
$(INSTALL_SCRIPT) pg-config $(bindir)/pg-config $(INSTALL_SCRIPT) pg-config $(bindir)/pg-config
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1999, PostgreSQL Global Development Group # 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 ...@@ -16,6 +16,7 @@ all: pg_ctl
pg_ctl: pg_ctl.sh pg_ctl: pg_ctl.sh
cp $< $@ cp $< $@
chmod a+x $@
install: all installdirs install: all installdirs
$(INSTALL_SCRIPT) pg_ctl $(bindir)/pg_ctl $(INSTALL_SCRIPT) pg_ctl $(bindir)/pg_ctl
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # 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 ...@@ -30,10 +30,11 @@ pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
$(MAKE) -C ../../utils strdup.o $(MAKE) -C ../../utils strdup.o
pg_dumpall: pg_dumpall.sh pg_dumpall: pg_dumpall.sh
sed -e 's:__VERSION__:$(VERSION):g' \ sed -e 's,@VERSION@,$(VERSION),g' \
-e 's:__MULTIBYTE__:$(MULTIBYTE):g' \ -e 's,@MULTIBYTE@,$(MULTIBYTE),g' \
-e 's:__bindir__:$(bindir):g' \ -e 's,@bindir@,$(bindir),g' \
< $< > $@ $< >$@
chmod a+x $@
.PHONY: submake .PHONY: submake
submake: submake:
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
# and "pg_group" tables, which belong to the whole installation rather # and "pg_group" tables, which belong to the whole installation rather
# than any one individual database. # 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` CMDNAME=`basename $0`
# substituted at build # substituted at build
VERSION='__VERSION__' VERSION='@VERSION@'
MULTIBYTE='__MULTIBYTE__' MULTIBYTE='@MULTIBYTE@'
bindir='__bindir__' bindir='@bindir@'
# #
# Find out where we're located # Find out where we're located
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # 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 ...@@ -17,9 +17,10 @@ SCRIPTS := createdb dropdb createuser dropuser createlang droplang vacuumdb
all: $(SCRIPTS) all: $(SCRIPTS)
createlang: createlang.sh createlang: createlang.sh
sed -e 's:__DLSUFFIX__:$(DLSUFFIX):g' \ sed -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' \
-e 's:__libdir__:$(libdir):g' \ -e 's,@libdir@,$(libdir),g' \
$< > $@ $< >$@
chmod a+x $@
install: all installdirs install: all installdirs
for i in $(SCRIPTS); do $(INSTALL_SCRIPT) $$i $(bindir) || exit; done for i in $(SCRIPTS); do $(INSTALL_SCRIPT) $$i $(bindir) || exit; done
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# #
# #
# IDENTIFICATION # 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 ...@@ -160,7 +160,7 @@ fi
# Check that we have PGLIB # Check that we have PGLIB
# ---------- # ----------
if [ -z "$PGLIB" ]; then if [ -z "$PGLIB" ]; then
PGLIB='__libdir__' PGLIB='@libdir@'
fi fi
# ---------- # ----------
...@@ -206,13 +206,14 @@ case "$langname" in ...@@ -206,13 +206,14 @@ case "$langname" in
;; ;;
esac esac
DLSUFFIX='@DLSUFFIX@'
# ---------- # ----------
# Check that the shared object for the call handler is installed # Check that the shared object for the call handler is installed
# in PGLIB # in PGLIB
# ---------- # ----------
if [ ! -f $PGLIB/${object}__DLSUFFIX__ ]; then if [ ! -f "$PGLIB/$object$DLSUFFIX" ]; then
echo "$CMDNAME: cannot find the file $PGLIB/${langname}__DLSUFFIX__" echo "$CMDNAME: cannot find the file \`$PGLIB/$langname$DLSUFFIX'"
echo "" echo ""
echo "This file contains the call handler for $lancomp. By default," echo "This file contains the call handler for $lancomp. By default,"
echo "only PL/pgSQL is built and installed; other languages must be" echo "only PL/pgSQL is built and installed; other languages must be"
...@@ -251,7 +252,7 @@ fi ...@@ -251,7 +252,7 @@ fi
# ---------- # ----------
# Create the call handler and the language # 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 if [ $? -ne 0 ]; then
echo "$CMDNAME: language installation failed" echo "$CMDNAME: language installation failed"
exit 1 exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment