1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

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.
This commit is contained in:
Peter Eisentraut
2000-07-06 21:33:45 +00:00
parent b027ad9a7a
commit f0b4ae697f
13 changed files with 858 additions and 1093 deletions

View File

@@ -1,47 +1,18 @@
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for the postgres backend (and the postmaster)
# Makefile for the postgres backend
#
# Copyright (c) 1994, Regents of the University of California
#
# Functional notes:
#
# Parallel make:
#
# This make file is set up so that you can do a parallel make (with
# the --jobs option of make) and make multiple subdirectories at
# once.
#
# However, the subdirectory make files are not so careful.
# Normally, the --jobs option would get passed down to those
# subdirectory makes, like any other make option, and they would
# fail. But there's a trick: Put a value (max number of
# processes) on the --jobs option, e.g. --jobs=4. Now, due to a
# special feature of make, the --jobs option will not get passed
# to the subdirectory makes. (make does this because if you only
# want 4 tasks running, then splitting the subdirectory makes into
# multiple tasks would violate your wishes).
#
#
#
# Implementation notes:
#
# We don't use $(LD) for linking. We use $(CC) instead. This is because
# the $(CC) program apparently can do linking too, and it has certain
# things like default options and search paths for libraries set up for
# it that the more primitive $(LD) doesn't have.
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.57 2000/07/02 15:20:44 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.58 2000/07/06 21:33:14 petere Exp $
#
#-------------------------------------------------------------------------
SRCDIR = ..
include $(SRCDIR)/Makefile.global
subdir = src/backend
top_builddir = ../..
include ../Makefile.global
DIRS = access bootstrap catalog commands executor lib libpq \
DIRS := access bootstrap catalog commands executor lib libpq \
main parser nodes optimizer port postmaster regex rewrite \
storage tcop utils
@@ -49,84 +20,144 @@ ifdef TIOGA
DIRS += tioga
endif
OBJS = $(DIRS:%=%/SUBSYS.o)
OBJS := $(DIRS:%=%/SUBSYS.o)
ifeq ($(PORTNAME), qnx4)
# This file crashes qnx4's wlink and is therefore not in bootstrap/SUBSYS.o
# on that platform. (Wotta hack ... is it still necessary?)
# This file crashes qnx4's wlink and is therefore not in
# bootstrap/SUBSYS.o on that platform. (Wotta hack ... is it still
# necessary?)
OBJS+= bootstrap/bootstrap.o
endif
ifeq ($(MAKE_DLL), true)
DLLOBJS= $(OBJS)
DLLLIBS= -L/usr/local/lib -lcygipc -lcrypt -lcygwin -lkernel32
postgres.def: $(DLLOBJS)
$(DLLTOOL) --export-all --output-def $@ $(DLLOBJS)
##########################################################################
libpostgres.a: $(DLLOBJS) $(SRCDIR)/utils/dllinit.o postgres.def
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
endif
all: postgres $(POSTGRES_IMP)
all: prebuildheaders postgres $(POSTGRES_IMP)
# Note that this is bogus. The desired effect is to build these
# commonly used headers before doing much else. However, nothing says
# that make is required to update these dependencies in any particular
# order, it just happens to do that. Parallel make is broken though.
ifneq ($(PORTNAME), win)
postgres: $(OBJS)
$(CC) $(CFLAGS) -o postgres $(OBJS) $(LDFLAGS)
postgres: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
else
else # win
postgres: $(DLLOBJS) $(SRCDIR)/utils/dllinit.o postgres.def libpostgres.a
# No points for style here. How about encapsulating some of these
# commands into variables?
postgres: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h \
$(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(DLLOBJS) $(DLLLIBS)
dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
gcc -g -o $@$(X) $@.exp $(DLLOBJS) $(DLLLIBS)
rm $@.exp $@.base
endif
endif # win
# Parallel make trickery
$(OBJS): $(DIRS:%=%.dir)
.PHONY: $(DIRS:%=%.dir)
$(DIRS:%=%.dir):
$(MAKE) -C $(subst .dir,,$@) all
$(MAKE) -C $(subst .dir,,$@) all
$(SRCDIR)/utils/dllinit.o: $(SRCDIR)/utils/dllinit.c
$(MAKE) -C $(SRCDIR)/utils dllinit.o
ifeq ($(MAKE_DLL), true)
DLLOBJS := $(OBJS)
DLLLIBS := -L/usr/local/lib -lcygipc -lcrypt -lcygwin -lkernel32
postgres.def: $(DLLOBJS)
$(DLLTOOL) --export-all --output-def $@ $(DLLOBJS)
libpostgres.a: $(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
endif # MAKE_DLL
$(top_builddir)/src/utils/dllinit.o: $(top_srcdir)/src/utils/dllinit.c
$(MAKE) -C $(top_builddir)/src/utils dllinit.o
# The postgres.o target is needed by the rule in Makefile.global that
# creates the exports file when MAKE_EXPORTS = true.
postgres.o: $(OBJS)
$(CC) $(LDREL) $(LDOUT) postgres.o $(OBJS) $(LDFLAGS)
$(CC) $(LDREL) $(LDOUT) $@ $^ $(LDFLAGS)
# These header files should be up-to-date before we do much else...
.PHONY: prebuildheaders
prebuildheaders: $(SRCDIR)/include/parser/parse.h \
$(SRCDIR)/include/utils/fmgroids.h
# The following targets are specified in make commands that appear in
# the make files in our subdirectories. Note that it's important we
# match the dependencies shown in the subdirectory makefiles!
############################################################################
# The following targets are specified in make commands that appear in the
# make files in our subdirectories. Note that it's important we match the
# dependencies shown in the subdirectory makefiles!
$(SRCDIR)/include/parser/parse.h: parser/parse.h
cp parser/parse.h $(SRCDIR)/include/parser
parser/parse.h: parser/gram.y
$(srcdir)/parser/parse.h: parser/gram.y
$(MAKE) -C parser parse.h
$(SRCDIR)/include/utils/fmgroids.h: utils/fmgroids.h
cp utils/fmgroids.h $(SRCDIR)/include/utils
utils/fmgroids.h: utils/Gen_fmgrtab.sh $(SRCDIR)/include/catalog/pg_proc.h
utils/fmgroids.h: utils/Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
$(MAKE) -C utils fmgroids.h
#############################################################################
# Make symlinks for these headers in the include directory. That way
# we can cut down on the -I options. Also, a symlink is automatically
# up to date when we update the base file.
$(top_builddir)/src/include/parser/parse.h: $(srcdir)/parser/parse.h
cd $(dir $@) && rm -f $(notdir $@) && \
$(LN_S) ../../../$(subdir)/parser/parse.h .
$(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h
cd $(dir $@) && rm -f $(notdir $@) && \
$(LN_S) ../../../$(subdir)/utils/fmgroids.h .
##########################################################################
install: all installdirs
$(INSTALL_PROGRAM) postgres$(X) $(bindir)/postgres$(X)
@rm -f $(bindir)/postmaster
ln -s postgres$(X) $(bindir)/postmaster
ifeq ($(MAKE_EXPORTS), true)
$(INSTALL_DATA) $(POSTGRES_IMP) $(libdir)/$(POSTGRES_IMP)
endif
ifeq ($(PORTNAME), win)
ifeq ($(MAKE_DLL), true)
$(INSTALL_DATA) libpostgres.a $(libdir)/libpostgres.a
endif
endif
$(MAKE) -C catalog install-bki
$(INSTALL_DATA) libpq/pg_hba.conf.sample $(datadir)/pg_hba.conf.sample
$(INSTALL_DATA) libpq/pg_ident.conf.sample $(datadir)/pg_ident.conf.sample
$(INSTALL_DATA) utils/misc/postgresql.conf.sample $(datadir)/postgresql.conf.sample
installdirs:
$(mkinstalldirs) $(bindir) $(libdir) $(datadir)
##########################################################################
uninstall:
rm -f $(bindir)/postgres$(X) $(bindir)/postmaster
ifeq ($(MAKE_EXPORTS), true)
rm -f $(libdir)/$(POSTGRES_IMP)
endif
ifeq ($(PORTNAME), win)
ifeq ($(MAKE_DLL), true)
rm -f $(libdir)/libpostgres.a
endif
endif
$(MAKE) -C catalog uninstall-bki
rm -f $(datadir)/pg_hba.conf.sample \
$(datadir)/pg_ident.conf.sample \
$(datadir)/postgresql.conf.sample
##########################################################################
clean:
rm -f postgres$(X) $(POSTGRES_IMP) \
$(SRCDIR)/include/parser/parse.h \
$(SRCDIR)/include/utils/fmgroids.h
$(top_srcdir)/src/include/parser/parse.h \
$(top_builddir)/src/include/utils/fmgroids.h
ifeq ($(PORTNAME), win)
ifeq ($(MAKE_DLL), true)
rm -f postgres.dll postgres.def libpostgres.a
@@ -134,136 +165,20 @@ endif
endif
for i in $(DIRS); do $(MAKE) -C $$i clean; done
depend dep: prebuildheaders
for i in $(DIRS); do $(MAKE) -C $$i $@; done
distclean: clean
rm -f port/Makefile port/tas.s port/dynloader.c
.DEFAULT:
for i in $(DIRS); do $(MAKE) -C $$i $@; done
#############################################################################
#
# Installation.
#
# Install the backend program (postgres) to the binary directory and
# make a link as "postmaster". Install the bki files, templates, and sample
# files to the library directory. Install exported headers to the include
# directory (these headers are the minimal ones needed to build loadable
# backend extensions).
#
# (History: Before Release 2, make install generated a bki.source file
# and then used build parameters to convert it to a bki file, then installed
# that bki file in the /files subdirectory of the default data directory.
# Initdb then used the bki file to generate the database catalog classes.
# That had to change because (1) there can be more than one database system,
# and (2) the parameters of a database system should be set at initdb time,
# not at postgres build time.
.PHONY: install install-bin install-templates install-headers
install: $(LIBDIR) $(BINDIR) $(HEADERDIR) $(TEMPLATEDIR) \
postgres $(POSTGRES_IMP) \
install-bin install-templates install-headers
install-bin: $(BINDIR) postgres$(X) $(POSTGRES_IMP)
$(INSTALL) $(INSTL_EXE_OPTS) postgres$(X) $(BINDIR)/postgres$(X)
@rm -f $(BINDIR)/postmaster
ln -s postgres$(X) $(BINDIR)/postmaster
ifeq ($(MAKE_EXPORTS), true)
$(INSTALL) $(INSTLOPTS) $(POSTGRES_IMP) $(LIBDIR)/$(POSTGRES_IMP)
endif
ifeq ($(PORTNAME), win)
ifeq ($(MAKE_DLL), true)
# $(INSTALL) $(INSTLOPTS) postgres.dll $(BINDIR)/postgres.dll
$(INSTALL) $(INSTLOPTS) libpostgres.a $(LIBDIR)/libpostgres.a
endif
endif
install-templates: $(TEMPLATEDIR) \
libpq/pg_hba.conf.sample libpq/pg_ident.conf.sample \
utils/misc/postgresql.conf.sample
$(MAKE) -C catalog install-bki-templates
$(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
$(TEMPLATEDIR)/pg_hba.conf.sample
$(INSTALL) $(INSTLOPTS) libpq/pg_ident.conf.sample \
$(TEMPLATEDIR)/pg_ident.conf.sample
$(INSTALL) $(INSTLOPTS) utils/misc/postgresql.conf.sample \
$(TEMPLATEDIR)/postgresql.conf.sample
install-headers: prebuildheaders $(SRCDIR)/include/config.h
-@if [ ! -d $(HEADERDIR) ]; then mkdir $(HEADERDIR); fi
-@if [ ! -d $(HEADERDIR)/port ]; then mkdir $(HEADERDIR)/port; fi
-@if [ ! -d $(HEADERDIR)/port/$(PORTNAME) ]; \
then mkdir $(HEADERDIR)/port/$(PORTNAME); fi
-@if [ ! -d $(HEADERDIR)/lib ]; \
then mkdir $(HEADERDIR)/lib; fi
-@if [ ! -d $(HEADERDIR)/libpq ]; \
then mkdir $(HEADERDIR)/libpq; fi
-@if [ ! -d $(HEADERDIR)/utils ]; \
then mkdir $(HEADERDIR)/utils; fi
-@if [ ! -d $(HEADERDIR)/access ]; \
then mkdir $(HEADERDIR)/access; fi
-@if [ ! -d $(HEADERDIR)/executor ]; \
then mkdir $(HEADERDIR)/executor; fi
-@if [ ! -d $(HEADERDIR)/commands ]; \
then mkdir $(HEADERDIR)/commands; fi
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/os.h \
$(HEADERDIR)/os.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/config.h \
$(HEADERDIR)/config.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/c.h \
$(HEADERDIR)/c.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/postgres.h \
$(HEADERDIR)/postgres.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/postgres_ext.h \
$(HEADERDIR)/postgres_ext.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/fmgr.h \
$(HEADERDIR)/fmgr.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/libpq/pqcomm.h \
$(HEADERDIR)/libpq/pqcomm.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/libpq/libpq-fs.h \
$(HEADERDIR)/libpq/libpq-fs.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/lib/dllist.h \
$(HEADERDIR)/lib/dllist.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/geo_decls.h \
$(HEADERDIR)/utils/geo_decls.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/elog.h \
$(HEADERDIR)/utils/elog.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/fmgroids.h \
$(HEADERDIR)/utils/fmgroids.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/utils/palloc.h \
$(HEADERDIR)/utils/palloc.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/access/attnum.h \
$(HEADERDIR)/access/attnum.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/executor/spi.h \
$(HEADERDIR)/executor/spi.h
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/include/commands/trigger.h \
$(HEADERDIR)/commands/trigger.h
ifeq ($(PORTNAME), hpux)
# is this still necessary?
$(INSTALL) $(INSTLOPTS) $(SRCDIR)/backend/port/hpux/fixade.h \
$(HEADERDIR)/port/hpux/fixade.h
endif
$(BINDIR):
mkdir $@
$(LIBDIR):
mkdir $@
$(HEADERDIR):
mkdir $@
# TEMPLATEDIR is commonly the same as LIBDIR, but it might be different.
# We don't want duplicate rules if they are the same.
ifneq ($(TEMPLATEDIR),$(LIBDIR))
$(TEMPLATEDIR):
mkdir $@
endif
maintainer-clean: distclean
rm -f $(srcdir)/bootstrap/bootparse.c \
$(srcdir)/bootstrap/bootscanner.c \
$(srcdir)/bootstrap/bootstrap_tokens.h \
$(srcdir)/parser/gram.c \
$(srcdir)/parser/scan.c \
$(srcdir)/parser/parse.h \
$(srcdir)/utils/misc/guc-file.c
#############################################################################
##########################################################################
#
# Support for code development.
#
@@ -273,21 +188,8 @@ endif
quick: $(OBJS)
$(CC) -o postgres $(OBJS) $(LDFLAGS)
#
# Build the file, "./ID", used by the "gid" (grep-for-identifier) tool
#
IDFILE= ID
.PHONY: $(IDFILE)
$(IDFILE):
./makeID
depend dep: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
for i in $(DIRS); do $(MAKE) -C $$i $@; done
#
# Special rule to generate cpp'd version of a .c file. This is
# especially useful given all the hellish macro processing going on.
# The cpp'd version has a .C suffix. To create foo.C from foo.c, just
# type
# make foo.C
#
%.cpp: %.c
$(CC) -E $(CPPFLAGS) $(<:.C=.c) | cat -s | cb | tr -s '\012*' '\012' \
> $(@F)
.DEFAULT:
for i in $(DIRS); do $(MAKE) -C $$i $@; done

View File

@@ -1,74 +1,68 @@
#-------------------------------------------------------------------------
#
# 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 \
)
GLOBAL_BKI_SRCS := $(addprefix $(top_srcdir)/src/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 \
)
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 \
)
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 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)
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 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

View File

@@ -1,4 +1,4 @@
#!/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

View File

@@ -1,67 +0,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 */

View File

@@ -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