#
# Makefile for backend/catalog
#
-# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.49 2003/11/29 19:51:42 pgsql Exp $
+# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.50 2004/01/04 05:57:21 tgl Exp $
#
#-------------------------------------------------------------------------
postgres.bki: genbki.sh $(POSTGRES_BKI_SRCS) \
$(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/pg_config_manual.h
- CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o postgres $(pg_includes) $(POSTGRES_BKI_SRCS) --set-version=$(VERSION)
+ AWK='$(AWK)' $(SHELL) $< $(pg_includes) --set-version=$(VERSION) -o postgres $(POSTGRES_BKI_SRCS)
.PHONY: install-data
install-data: $(BKIFILES) installdirs
#
#
# IDENTIFICATION
-# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.31 2003/11/29 19:51:42 pgsql Exp $
+# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.32 2004/01/04 05:57:21 tgl Exp $
#
# NOTES
# non-essential whitespace is removed from the generated file.
#-------------------------------------------------------------------------
: ${AWK='awk'}
-: ${CPP='cc -E'}
CMDNAME=`basename $0`
-BKIOPTS=
INCLUDE_DIRS=
OUTPUT_PREFIX=
INFILES=
while [ $# -gt 0 ]
do
case $1 in
- -D)
- BKIOPTS="$BKIOPTS -D$2"
- shift;;
- -D*)
- BKIOPTS="$BKIOPTS $1"
- ;;
-I)
INCLUDE_DIRS="$INCLUDE_DIRS $2"
shift;;
echo "$CMDNAME generates system catalog bootstrapping files."
echo
echo "Usage:"
- echo " $CMDNAME [ -D define [...] ] [ -I dir ] --set-version=VERSION -o prefix files..."
+ echo " $CMDNAME [ -I dir ] --set-version=VERSION -o prefix files..."
echo
echo "Options:"
echo " -I path to postgres_ext.h and pg_config_manual.h files"
echo " -o prefix of output files"
echo " --set-version PostgreSQL version number for initdb cross-check"
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 "The environment variable AWK determines which Awk program"
+ echo "to use. The default is \`awk'."
echo
exit 0
;;
- -*)
+ -*)
echo "$CMDNAME: invalid option: $1"
exit 1
;;
exit 1
fi
-if [ x"$TMPDIR" = x"" ] ; then
- TMPDIR=/tmp
-fi
-
-TMPFILE="$TMPDIR/genbkitmp$$.c"
+TMPFILE="genbkitmp$$.c"
trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0 1 2 3 15
# ----------------
BEGIN {
inside = 0;
- raw = 0;
bootstrap = "";
shared_relation = "";
without_oids = "";
/^[ ]*$/ { next; }
-# ----------------
-# anything in a BKI_BEGIN .. BKI_END block should be passed
-# along without interpretation.
-# ----------------
-/^BKI_BEGIN/ { raw = 1; next; }
-/^BKI_END/ { raw = 0; next; }
-raw == 1 { print; next; }
-
# ----------------
# DATA() statements are basically passed right through after
# stripping off the DATA( and the ) on the end. However,
echo "# PostgreSQL $major_version" >${OUTPUT_PREFIX}.bki.$$
-$CPP $BKIOPTS $TMPFILE | \
sed -e '/^[ ]*$/d' \
- -e 's/[ ][ ]*/ /g' >>${OUTPUT_PREFIX}.bki.$$ || exit
+ -e 's/[ ][ ]*/ /g' $TMPFILE >>${OUTPUT_PREFIX}.bki.$$ || exit
#
# Sanity check: if one of the sed/awk/etc commands fails, we'll probably
#
#
# IDENTIFICATION
-# $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.sh,v 1.27 2003/11/29 19:51:57 pgsql Exp $
+# $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.sh,v 1.28 2004/01/04 05:57:21 tgl Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
: ${AWK='awk'}
-: ${CPP='cc -E'}
cleanup(){
- [ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" "$$-$OIDSFILE" "$$-$TABLEFILE"
+ [ x"$noclean" != x"t" ] && rm -f "$SORTEDFILE" "$$-$OIDSFILE" "$$-$TABLEFILE"
}
-BKIOPTS=
noclean=
#
while [ $# -gt 0 ]
do
case $1 in
- -D)
- BKIOPTS="$BKIOPTS -D$2"
- shift;;
- -D*)
- BKIOPTS="$BKIOPTS $1"
- ;;
--noclean)
noclean=t
;;
echo "$CMDNAME generates fmgroids.h and fmgrtab.c from pg_proc.h."
echo
echo "Usage:"
- echo " $CMDNAME [ -D define [...] ]"
+ echo " $CMDNAME inputfile"
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 "The environment variable AWK determines which Awk program"
+ echo "to use. The default is \`awk'."
echo
exit 0
;;
- --) shift; break;;
- -*)
+ -*)
echo "$CMDNAME: invalid option: $1"
exit 1
;;
exit 1
fi
-CPPTMPFILE="$$-fmgrtmp.c"
-RAWFILE="$$-fmgr.raw"
+SORTEDFILE="$$-fmgr.data"
OIDSFILE=fmgroids.h
TABLEFILE=fmgrtab.c
# Generate the file containing raw pg_proc tuple data
# (but only for "internal" language procedures...).
#
-# Unlike genbki.sh, which can run through cpp last, we have to
-# deal with preprocessor statements first (before we sort the
-# function table by oid).
-#
# Note assumption here that prolang == $5 and INTERNALlanguageId == 12.
#
-$AWK '
-BEGIN { raw = 0; }
-/^DATA/ { print; next; }
-/^BKI_BEGIN/ { raw = 1; next; }
-/^BKI_END/ { raw = 0; next; }
-raw == 1 { print; next; }' $INFILE | \
+egrep '^DATA' $INFILE | \
sed -e 's/^.*OID[^=]*=[^0-9]*//' \
-e 's/(//g' \
-e 's/[ ]*).*$//' | \
-$AWK '
-/^#/ { print; next; }
-$5 == "12" { print; next; }' > $CPPTMPFILE
-
-if [ $? -ne 0 ]; then
- cleanup
- echo "$CMDNAME failed"
- exit 1
-fi
-
-$CPP $BKIOPTS $CPPTMPFILE | \
-egrep '^[ ]*[0-9]' | \
-sort -n > $RAWFILE
+$AWK '$5 == "12" { print }' | \
+sort -n > $SORTEDFILE
if [ $? -ne 0 ]; then
cleanup
# Note assumption here that prosrc == $(NF-2).
-tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \
+tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $SORTEDFILE | \
$AWK '
BEGIN { OFS = ""; }
{ if (seenit[$(NF-2)]++ == 0) print "#define F_", $(NF-2), " ", $1; }' >> "$$-$OIDSFILE"
# Note assumption here that prosrc == $(NF-2).
-$AWK '{ print "extern Datum", $(NF-2), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "$$-$TABLEFILE"
+$AWK '{ print "extern Datum", $(NF-2), "(PG_FUNCTION_ARGS);"; }' $SORTEDFILE >> "$$-$TABLEFILE"
if [ $? -ne 0 ]; then
cleanup
}
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
$1, $(NF-2), $11, Bool[$8], Bool[$9], $(NF-2)
-}' $RAWFILE >> "$$-$TABLEFILE"
+}' $SORTEDFILE >> "$$-$TABLEFILE"
if [ $? -ne 0 ]; then
cleanup
#
# Makefile for utils
#
-# $PostgreSQL: pgsql/src/backend/utils/Makefile,v 1.21 2003/11/29 19:51:57 pgsql Exp $
+# $PostgreSQL: pgsql/src/backend/utils/Makefile,v 1.22 2004/01/04 05:57:21 tgl Exp $
#
subdir = src/backend/utils/
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
fmgroids.h fmgrtab.c: Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
- CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h
+ AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h
clean:
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1995, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/postgres.h,v 1.66 2003/11/29 22:40:53 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/postgres.h,v 1.67 2004/01/04 05:57:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#define DATA(x) extern int no_such_variable
#define DESCR(x) extern int no_such_variable
-#define BKI_BEGIN
-#define BKI_END
-
typedef int4 aclitem; /* PHONY definition for catalog use only */
#endif /* POSTGRES_H */