Commit f0b4ae69 authored by Peter Eisentraut's avatar Peter Eisentraut

Backend makefile cleanup. make maintainer-clean is now completely

functional.

Handle include file installation in src/include/Makefile

genbki.sh improvements: Don't substitute anything by config.status,
instead pass in AWK and CPP through environment. Change calling
convention to support named output files, so we get to see error
messages on stderr.

Rename bootstrap template files and install them into PREFIX/share.
Update initdb to that effect and other readability improvements
in initdb.
parent b027ad9a
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -133,7 +133,7 @@ if test ! -f "src/template/$TEMPLATE"; then
echo ""
echo "Available Templates (select one using --with-template):"
echo ""
ls template
ls src/template
echo ""
exit
fi
......@@ -680,9 +680,6 @@ AC_PROG_LN_S
AC_PROG_RANLIB
AC_PATH_PROG(find, find)
AC_PATH_PROG(tar, tar)
AC_PATH_PROG(split, split)
AC_PATH_PROG(etags, etags)
AC_PATH_PROG(xargs, xargs)
AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat)
AC_CHECK_PROGS(PERL, perl,)
AC_PROG_YACC
......@@ -1203,6 +1200,5 @@ AC_OUTPUT(
src/GNUmakefile
src/Makefile.global
src/backend/port/Makefile
src/backend/catalog/genbki.sh
src/test/regress/GNUmakefile
)
#-------------------------------------------------------------------------
#
# Makefile.inc--
# Build and install postgres.
# Makefile for src
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.56 2000/07/02 15:20:41 petere Exp $
# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.57 2000/07/06 21:33:12 petere Exp $
#
#-------------------------------------------------------------------------
SRCDIR= .
subdir = src
top_builddir = ..
include Makefile.global
FIND = @find@
# assuming gnu tar and split here
TAR = @tar@
SPLIT = @split@
ETAGS = @etags@
XARGS = @xargs@
all:
$(MAKE) -C backend all
$(MAKE) -C interfaces all
$(MAKE) -C bin all
$(MAKE) -C pl all
install: installdirs
$(MAKE) -C backend install
$(MAKE) -C interfaces install
$(MAKE) -C bin install
$(MAKE) -C pl install
installdirs:
../config/mkinstalldirs $(BINDIR) $(LIBDIR) $(INCLUDEDIR)
all install installdirs uninstall dep depend:
$(MAKE) -C backend $@
$(MAKE) -C include $@
$(MAKE) -C interfaces $@
$(MAKE) -C bin $@
$(MAKE) -C pl $@
clean:
$(MAKE) -C utils clean
$(MAKE) -C backend clean
$(MAKE) -C interfaces clean
$(MAKE) -C bin clean
$(MAKE) -C pl clean
$(MAKE) -C backend $@
$(MAKE) -C include $@
$(MAKE) -C interfaces $@
$(MAKE) -C bin $@
$(MAKE) -C pl $@
$(MAKE) -C utils $@
$(MAKE) -C test clean
$(MAKE) -C ../contrib/spi clean
# Not all subdirectories have a make distclean target yet
distclean maintainer-clean:
-$(MAKE) -C utils clean
-$(MAKE) -C backend clean
rm -f backend/port/Makefile backend/catalog/genbki.sh \
backend/port/tas.s backend/port/dynloader.c
-$(MAKE) -C utils $@
-$(MAKE) -C backend $@
-$(MAKE) -C include $@
-$(MAKE) -C interfaces $@
-$(MAKE) -C bin $@
-$(MAKE) -C pl $@
-$(MAKE) -C test clean
rm -f test/regress/GNUmakefile
-$(MAKE) -C ../contrib/spi clean
rm -f Makefile.port \
include/config.h include/dynloader.h \
include/os.h include/version.h \
Makefile.global \
GNUmakefile
.DEFAULT:
$(MAKE) -C utils $@
$(MAKE) -C backend $@
$(MAKE) -C interfaces $@
$(MAKE) -C bin $@
$(MAKE) -C pl $@
TAGS:
rm -f TAGS; \
for i in backend interfaces/libpq bin; do \
$(FIND) $$i -name '*.[chyl]' -print | $(XARGS) $(ETAGS) -a ; \
done
# target to generate a backup tar file and split files that can be
# saved to 1.44M floppy
BACKUP:
rm -f BACKUP.filelist BACKUP.tgz; \
$(FIND) . -not -path '*obj/*' -not -path '*data/*' -type f -print > BACKUP.filelist; \
$(TAR) --files-from BACKUP.filelist -c -z -v -f BACKUP.tgz
$(SPLIT) --bytes=1400k BACKUP.tgz pgBACKUP.
.PHONY: TAGS
.PHONY: BACKUP
rm -f Makefile.port Makefile.global GNUmakefile
This diff is collapsed.
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for catalog
# Makefile for catalog
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.22 2000/06/05 07:16:13 tgl Exp $
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.23 2000/07/06 21:33:22 petere Exp $
#
#-------------------------------------------------------------------------
SRCDIR = ../..
include $(SRCDIR)/Makefile.global
subdir = src/backend/catalog
top_builddir = ../../..
include ../../Makefile.global
OBJS = catalog.o heap.o index.o indexing.o aclchk.o \
pg_aggregate.o pg_operator.o pg_proc.o pg_type.o
BKIFILES = global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description
BKIFILES = global.bki template1.bki global.description template1.description
all: SUBSYS.o $(BKIFILES)
SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
GENBKI= ./genbki.sh
GLOBALBKI_SRCS= $(addprefix $(SRCDIR)/include/catalog/, \
pg_database.h pg_variable.h pg_shadow.h \
pg_group.h pg_log.h \
)
LOCALBKI_SRCS= $(addprefix $(SRCDIR)/include/catalog/, \
pg_proc.h pg_type.h pg_attribute.h pg_class.h \
pg_inherits.h pg_index.h pg_statistic.h \
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
pg_language.h \
pg_aggregate.h pg_ipl.h pg_inheritproc.h \
pg_rewrite.h pg_listener.h pg_description.h indexing.h \
)
global1.bki.source: $(GENBKI) $(GLOBALBKI_SRCS) \
$(addprefix $(SRCDIR)/include/catalog/, indexing.h)
ifneq ($(PORTNAME), win)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(GLOBALBKI_SRCS) > $@ 2>global1.description
else
$(GENBKI) $(BKIOPTS) $(GLOBALBKI_SRCS) > $@ 2>global1.description
endif
local1_template1.bki.source: $(GENBKI) $(LOCALBKI_SRCS)
ifneq ($(PORTNAME), win)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(LOCALBKI_SRCS) > $@ 2>local1_template1.description
else
$(GENBKI) $(BKIOPTS) $(LOCALBKI_SRCS) > $@ 2>local1_template1.description
endif
GLOBAL_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
pg_database.h pg_variable.h pg_shadow.h pg_group.h pg_log.h \
)
install-bki-templates: $(BKIFILES)
$(INSTALL) $(INSTLOPTS) global1.bki.source \
$(TEMPLATEDIR)/global1.bki.source
$(INSTALL) $(INSTLOPTS) global1.description \
$(TEMPLATEDIR)/global1.description
$(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
$(TEMPLATEDIR)/local1_template1.bki.source
$(INSTALL) $(INSTLOPTS) local1_template1.description \
$(TEMPLATEDIR)/local1_template1.description
TEMPLATE1_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
pg_proc.h pg_type.h pg_attribute.h pg_class.h \
pg_inherits.h pg_index.h pg_statistic.h \
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
pg_language.h \
pg_aggregate.h pg_ipl.h pg_inheritproc.h \
pg_rewrite.h pg_listener.h pg_description.h indexing.h \
)
global.bki global.description: genbki.sh $(GLOBAL_BKI_SRCS) $(top_srcdir)/src/include/catalog/indexing.h
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o global -I$(top_srcdir)/src/include $(GLOBAL_BKI_SRCS)
template1.bki template1.description: genbki.sh $(TEMPLATE1_BKI_SRCS)
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o template1 -I$(top_srcdir)/src/include $(TEMPLATE1_BKI_SRCS)
.PHONY: install-bki
install-bki: $(BKIFILES) installdirs
$(INSTALL_DATA) global.bki $(datadir)/global.bki
$(INSTALL_DATA) global.description $(datadir)/global.description
$(INSTALL_DATA) template1.bki $(datadir)/template1.bki
$(INSTALL_DATA) template1.description $(datadir)/template1.description
installdirs:
$(mkinstalldirs) $(datadir)
.PHONY: uninstall-bki
uninstall-bki:
rm -f $(addprefix $(datadir)/, $(BKIFILES))
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
rm -f SUBSYS.o $(OBJS) $(BKIFILES)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
ifeq (depend,$(wildcard depend))
include depend
endif
#!/bin/sh
#! /bin/sh
#-------------------------------------------------------------------------
#
# genbki.sh--
......@@ -10,7 +10,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh.in,v 1.5 2000/01/11 04:02:28 tgl Exp $
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.15 2000/07/06 21:33:22 petere Exp $
#
# NOTES
# non-essential whitespace is removed from the generated file.
......@@ -18,45 +18,105 @@
# end can be changed into another awk script or something smarter..
#
#-------------------------------------------------------------------------
trap "rm -f /tmp/genbki.tmp /tmp/genbkitmp.c" 0 1 2 3 15
# make sure it is empty
>/tmp/genbki.tmp
: ${AWK='awk'}
: ${CPP='cc -E'}
if [ $? != 0 ]
then
echo `basename $0`: Bad option
exit 1
fi
CMDNAME=`basename $0`
BKIOPTS=''
BKIOPTS=
INCLUDE_DIR=
OUTPUT_PREFIX=
INFILES=
for opt in $*
#
# Process command line switches.
#
while [ $# -gt 0 ]
do
case $opt in
-D) BKIOPTS="$BKIOPTS -D$2"; shift; shift;;
-D*) BKIOPTS="$BKIOPTS $1";shift;;
--) shift; break;;
case $1 in
-D)
BKIOPTS="$BKIOPTS -D$2"
shift;;
-D*)
BKIOPTS="$BKIOPTS $1"
;;
-I)
INCLUDE_DIR="$2"
shift;;
-I*)
INCLUDE_DIR=`echo $1 | sed s/^-I//`
;;
-o)
OUTPUT_PREFIX="$2"
shift;;
-o*)
OUTPUT_PREFIX=`echo $1 | sed s/^-o//`
;;
--help)
echo "$CMDNAME generates system catalog bootstrapping files."
echo
echo "Usage:"
echo " $CMDNAME [ -D define [...] ] [ -I dir ] [ -o prefix ]"
echo
echo "Options:"
echo " -I path to postgres_ext.h and config.h files"
echo " -o prefix of output files"
echo
echo "The environment variables CPP and AWK determine which C"
echo "preprocessor and Awk program to use. The defaults are"
echo "\`cc -E' and \`awk'."
echo
echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
;;
-*)
echo "$CMDNAME: invalid option: $1"
exit 1
;;
*)
INFILES="$INFILES $1"
;;
esac
done
# ----------------
# collect nodefiles
# ----------------
SYSFILES=''
x=1
numargs=$#
while test $x -le $numargs ; do
SYSFILES="$SYSFILES $1"
x=`expr $x + 1`
shift
done
if [ x"$INFILES" = x"" ] ; then
echo "$CMDNAME: no input files" 1>&2
exit 1
fi
if [ x"$OUTPUT_PREFIX" = x"" ] ; then
echo "$CMDNAME: no output prefix specified" 1>&2
exit 1
fi
if [ x"$INCLUDE_DIR" = x"" ] ; then
echo "$CMDNAME: path to include directory unknown" 1>&2
exit 1
fi
if [ x"$TMPDIR" = x"" ] ; then
TMPDIR=/tmp
fi
TMPFILE="$TMPDIR/genbkitmp.c"
trap "rm -f $TMPFILE" 0 1 2 3 15
# clear output files
> ${OUTPUT_PREFIX}.bki
> ${OUTPUT_PREFIX}.description
# Get NAMEDATALEN from postgres_ext.h
NAMEDATALEN=`grep '#define[ ]*NAMEDATALEN' ../../include/postgres_ext.h | awk '{ print $3 }'`
NAMEDATALEN=`grep '#define[ ]*NAMEDATALEN' $INCLUDE_DIR/postgres_ext.h | awk '{ print $3 }'`
# Get INDEX_MAX_KEYS from config.h (who needs consistency?)
INDEXMAXKEYS=`grep '#define[ ]*INDEX_MAX_KEYS' ../../include/config.h | awk '{ print $3 }'`
INDEXMAXKEYS=`grep '#define[ ]*INDEX_MAX_KEYS' $INCLUDE_DIR/config.h | awk '{ print $3 }'`
# NOTE: we assume here that FUNC_MAX_ARGS has the same value as INDEX_MAX_KEYS,
# and don't read it separately from config.h. This is OK because both of them
......@@ -73,7 +133,7 @@ INDEXMAXKEYS4=`expr $INDEXMAXKEYS '*' 4`
# also, change NameData to name. -- jolly 8/21/95.
# put multi-line start/end comments on a separate line
#
cat $SYSFILES | \
cat $INFILES | \
sed -e 's;/\*.*\*/;;g' \
-e 's;/\*;\
/*\
......@@ -96,7 +156,7 @@ sed -e "s/;[ ]*$//g" \
-e "s/FUNC_MAX_ARGS\*2/$INDEXMAXKEYS2/g" \
-e "s/FUNC_MAX_ARGS\*4/$INDEXMAXKEYS4/g" \
-e "s/FUNC_MAX_ARGS/$INDEXMAXKEYS/g" \
| awk '
| $AWK '
# ----------------
# now use awk to process remaining .h file..
#
......@@ -161,7 +221,7 @@ raw == 1 { print; next; }
{
data = substr($0, 8, length($0) - 9);
if (data != "")
printf "%d %s\n", oid, data >> "/tmp/genbki.tmp";
printf "%d %s\n", oid, data >>descriptionfile;
}
next;
}
......@@ -289,16 +349,11 @@ END {
reln_open = 0;
}
}
' >/tmp/genbkitmp.c
' "descriptionfile=${OUTPUT_PREFIX}.description" > $TMPFILE || exit
@CPP@ $BKIOPTS /tmp/genbkitmp.c | \
$CPP $BKIOPTS $TMPFILE | \
sed -e '/^[ ]*$/d' \
-e 's/[ ][ ]*/ /g' || exit 1
-e 's/[ ][ ]*/ /g' > ${OUTPUT_PREFIX}.bki || exit
# send pg_description file contents to standard error
cat /tmp/genbki.tmp 1>&2
# ----------------
# all done
# ----------------
exit 0
/*-------------------------------------------------------------------------
*
* fixade.h
* compiler tricks to make things work while POSTGRES does non-native
* dereferences on PA-RISC.
*
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: fixade.h,v 1.8 2000/01/26 05:56:46 momjian Exp $
*
* NOTES
* This must be included in EVERY source file.
*
*-------------------------------------------------------------------------
*/
#ifndef FIXADE_H
#define FIXADE_H
#if !defined(NOFIXADE)
#if defined(HP_S500_ALIGN)
/* ----------------
* This cheesy hack turns ON unaligned-access fixup on H-P PA-RISC;
* the resulting object files contain code that explicitly handles
* realignment on reference, so it slows memory access down by a
* considerable factor. It must be used in conjunction with the +u
* flag to cc. The #pragma is included in c.h to be safe since EVERY
* source file that performs unaligned access must contain the #pragma.
* ----------------
*/
#pragma HP_ALIGN HPUX_NATURAL_S500
#if defined(BROKEN_STRUCT_INIT)
/* ----------------
* This is so bogus. The HP-UX 9.01 compiler has totally broken
* struct initialization code. It actually length-checks ALL
* array initializations within structs against the FIRST one that
* it sees (when #pragma HP_ALIGN HPUX_NATURAL_S500 is defined)..
* we have to throw in this unused structure before struct varlena
* is defined.
*
* XXX guess you don't need the #pragma anymore after all :-)
* since no one looks at this except me i think i'll just leave
* this here for now..
* ----------------
*/
struct HP_WAY_BOGUS
{
char hpwb_bogus[8191 + 1];
};
struct HP_TOO_BOGUS
{
int hptb_bogus[8191 + 1];
};
#endif /* BROKEN_STRUCT_INIT */
#endif /* HP_S500_ALIGN */
#if defined(WEAK_C_OPTIMIZER)
#pragma OPT_LEVEL 1
#endif /* WEAK_C_OPTIMIZER */
#endif /* !NOFIXADE */
#endif /* FIXADE_H */
......@@ -9,7 +9,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.15 2000/07/01 21:16:44 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.16 2000/07/06 21:33:30 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -33,10 +33,10 @@ do
case $1 in
-D)
BKIOPTS="$BKIOPTS -D$2"
;;
shift;;
-D*)
BKIOPTS="$BKIOPTS $1"
shift;;
;;
--noclean)
noclean=t
;;
......@@ -60,6 +60,7 @@ do
;;
*)
INFILE=$1
;;
esac
shift
done
......
......@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.19 2000/07/02 15:21:00 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.20 2000/07/06 21:33:38 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -15,7 +15,11 @@ include ../../Makefile.global
all: initdb
initdb: initdb.sh ../../Makefile.global
sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/g' -e 's/__VERSION__/$(VERSION)/g' < $< > $@
sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/g' \
-e 's/__VERSION__/$(VERSION)/g' \
-e 's:__bindir__:$(bindir):g' \
-e 's:__datadir__:$(datadir):g' \
< $< > $@
install: all installdirs
$(INSTALL_SCRIPT) initdb $(bindir)/initdb
......
This diff is collapsed.
#-------------------------------------------------------------------------
#
# Makefile for src/include
#
# Install exported headers to the include directory (these headers are
# the minimal ones needed to build loadable backend extensions).
#
# $Header: /cvsroot/pgsql/src/include/Makefile,v 1.1 2000/07/06 21:33:44 petere Exp $
#
#-------------------------------------------------------------------------
subdir = src/include
top_builddir = ../..
include ../Makefile.global
HEADERS := os.h config.h c.h postgres.h postgres_ext.h fmgr.h \
libpq/pqcomm.h libpq/libpq-fs.h lib/dllist.h \
utils/geo_decls.h utils/elog.h utils/fmgroids.h utils/palloc.h \
access/attnum.h executor/spi.h commands/trigger.h
all: $(HEADERS)
# These rules are necessary in case someone installs the include tree
# before building the backend tree. Very messy.
utils/fmgroids.h: $(top_builddir)/src/backend/utils/fmgroids.h
cd utils && rm -f fmgroids.h && $(LN_S) ../$(top_builddir)/src/backend/utils/fmgroids.h .
# This file is built in the backend tree, but we need to keep track of
# the dependencies here.
$(top_builddir)/src/backend/utils/fmgroids.h: $(top_srcdir)/src/backend/utils/Gen_fmgrtab.sh catalog/pg_proc.h
$(MAKE) -C $(dir $@) fmgroids.h
install: all installdirs
@for i in $(HEADERS); do \
echo "$(INSTALL_DATA) $(srcdir)/$$i $(includedir)/$$i"; \
$(INSTALL_DATA) $(srcdir)/$$i $(includedir)/$$i; \
done
# Automatically pick out the needed subdirectories for the include
# tree.
installdirs:
$(mkinstalldirs) $(addprefix $(includedir)/, $(sort $(dir $(HEADERS))))
uninstall:
rm -f $(addprefix $(includedir)/, $(HEADERS))
clean:
rm -f utils/fmgroids.h parser/parse.h
distclean maintainer-clean: clean
rm -f config.h dynloader.h os.h
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.74 2000/06/08 22:37:35 momjian Exp $
* $Id: c.h,v 1.75 2000/07/06 21:33:44 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -904,12 +904,6 @@ extern char *vararg_format(const char *fmt,...);
#define PG_BINARY_W "w"
#endif
#ifdef FIXADE
#if defined(hpux)
#include "port/hpux/fixade.h" /* for unaligned access fixup */
#endif /* hpux */
#endif
#if defined(sun) && defined(__sparc__) && !defined(__SVR4)
#define memmove(d, s, l) bcopy(s, d, l)
#include <unistd.h>
......
#!/bin/sh
#
# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.20 2000/06/20 16:40:19 petere Exp $
# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.21 2000/07/06 21:33:45 petere Exp $
# ----------
# Check call syntax
......@@ -187,7 +187,7 @@ export PATH
# Run initdb to initialize a database system in ./tmp_check
# ----------
echo "=============== Initializing check database instance ================"
initdb -L $LIBDIR -D $PGDATA --noclean >$LOGDIR/initdb.log 2>&1
initdb -D $PGDATA --noclean >$LOGDIR/initdb.log 2>&1
if [ $? -ne 0 ]
then
......
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