Dear patchers,

Please find attached version number 3 for a patch to enable extensions
such as contribs or external add-ons to be installed simply with an
already installed postgresql.

This version addresses Peter's comments about src/makefiles/Makefile.*
that do not need to be installed. It works for me, as previous versions.

See other comments in previous submissions and responses.

-- 
Fabien.
*** ./GNUmakefile.in.orig       Mon Jun 14 15:33:06 2004
--- ./GNUmakefile.in    Mon Jul  5 09:24:51 2004
***************
*** 13,30 ****
        $(MAKE) -C src all
        @echo "All of PostgreSQL successfully made. Ready to install."
  
! install:
        $(MAKE) -C doc install
        $(MAKE) -C src install
-       @echo "PostgreSQL installation complete."
  
! installdirs uninstall distprep:
        $(MAKE) -C doc $@
        $(MAKE) -C src $@
  
  install-all-headers:
        $(MAKE) -C src $@
  
  # clean, distclean, etc should apply to contrib too, even though
  # it's not built by default
  clean:
--- 13,55 ----
        $(MAKE) -C src all
        @echo "All of PostgreSQL successfully made. Ready to install."
  
! install: light-install install-all-headers install-config-files
!       @echo "PostgreSQL installation complete."
! 
! light-install:
        $(MAKE) -C doc install
        $(MAKE) -C src install
  
! distprep:
        $(MAKE) -C doc $@
        $(MAKE) -C src $@
  
+ installdirs:
+       $(MAKE) -C doc $@
+       $(MAKE) -C src $@
+       $(MAKE) -C config $@
+       $(mkinstalldirs) $(DESTDIR)$(pgxsdir)
+ 
+ uninstall:
+       $(MAKE) -C doc $@
+       $(MAKE) -C src $@
+       $(MAKE) -C config $@
+       $(DESTDIR)$(pgxsdir)
+ 
  install-all-headers:
        $(MAKE) -C src $@
  
+ install-config-files: installdirs
+       $(MAKE) -C src $@
+       $(MAKE) -C config $@
+       $(INSTALL_DATA) config.status $(DESTDIR)$(pgxsdir)
+ 
+ install-client-only:
+       $(MAKE) -C src/bin install
+       $(MAKE) -C src/include install
+       $(MAKE) -C src/interfaces install
+       $(MAKE) -C doc install
+ 
  # clean, distclean, etc should apply to contrib too, even though
  # it's not built by default
  clean:
*** ./config/Makefile.orig      Mon Jul  5 09:24:51 2004
--- ./config/Makefile   Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,19 ----
+ # $PostgreSQL$
+ 
+ subdir = config
+ top_builddir = ..
+ include $(top_builddir)/src/Makefile.global
+ 
+ ins_files     = install-sh mkinstalldirs
+ ins_dir               = $(DESTDIR)$(pgxsdir)/config
+ 
+ install-config-files: install
+ 
+ install: installdirs
+       for f in $(ins_files) ; do $(INSTALL_DATA) $$f $(ins_dir) ; done;
+ 
+ installdirs:
+       $(mkinstalldirs) $(ins_dir)
+ 
+ uninstall:
+       for f in $(ins_files) ; do $(RM) $(ins_dir)/$$f ; done;
*** ./contrib/btree_gist/pgxs.mk.orig   Mon Jul  5 09:24:51 2004
--- ./contrib/btree_gist/pgxs.mk        Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,28 ----
+ # local configuration
+ MODULE_big = btree_gist
+ OBJS= btree_common.o btree_int2.o btree_int4.o btree_int8.o btree_float4.o 
btree_float8.o btree_ts.o
+ DATA_built = btree_gist.sql
+ DOCS = README.btree_gist
+ REGRESS = btree_gist
+ 
+ EXTRA_CLEAN = btree_int2.c btree_int4.c btree_int8.c btree_float4.c btree_float8.c 
+ 
+ # generic settings
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ # local rules
+ btree_int2.c: btree_num.c.in
+       sed 
's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_INT2,g;s,__BTREE_GIST_TYPE__,int16,g;s,__BTREE_GIST_TYPE2__,int2,g'
 < $<  > $@
+ 
+ btree_int4.c: btree_num.c.in
+       sed 
's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_INT4,g;s,__BTREE_GIST_TYPE__,int32,g;s,__BTREE_GIST_TYPE2__,int4,g'
 < $<  > $@
+ 
+ btree_int8.c: btree_num.c.in
+       sed 
's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_INT8,g;s,__BTREE_GIST_TYPE__,int64,g;s,__BTREE_GIST_TYPE2__,int8,g'
 < $<  > $@
+ 
+ btree_float4.c: btree_num.c.in
+       sed 
's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_FLOAT4,g;s,__BTREE_GIST_TYPE__,float4,g;s,__BTREE_GIST_TYPE2__,float4,g'
 < $<  > $@
+ 
+ btree_float8.c: btree_num.c.in
+       sed 
's,__DEFINE_BTREE_TYPE_HERE__,BTREE_GIST_FLOAT8,g;s,__BTREE_GIST_TYPE__,float8,g;s,__BTREE_GIST_TYPE2__,float8,g'
 < $<  > $@
*** ./contrib/chkpass/pgxs.mk.orig      Mon Jul  5 09:24:51 2004
--- ./contrib/chkpass/pgxs.mk   Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,12 ----
+ # local conf
+ MODULE_big = chkpass
+ OBJS = chkpass.o
+ SHLIB_LINK = $(filter -lcrypt, $(LIBS))
+ DATA_built = chkpass.sql
+ DOCS = README.chkpass
+ 
+ # global
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ # local rules
*** ./contrib/cube/pgxs.mk.orig Mon Jul  5 09:24:51 2004
--- ./contrib/cube/pgxs.mk      Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,35 ----
+ # generic macros
+ MODULE_big = cube
+ OBJS= cube.o cubeparse.o
+ 
+ DATA_built = cube.sql
+ DOCS = README.cube
+ REGRESS = cube
+ 
+ EXTRA_CLEAN = cubeparse.c cubeparse.h cubescan.c y.tab.c y.tab.h
+ 
+ # postgresql extensions
+ PGXS := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ # specific rules
+ # cubescan is compiled as part of cubeparse
+ cubeparse.o: cubescan.c
+ 
+ cubeparse.c: cubeparse.h ;
+ 
+ cubeparse.h: cubeparse.y
+ ifdef YACC
+       $(YACC) -d $(YFLAGS) -p cube_yy $<
+       mv -f y.tab.c cubeparse.c
+       mv -f y.tab.h cubeparse.h
+ else
+       @$(missing) bison $< $@
+ endif
+ 
+ cubescan.c: cubescan.l
+ ifdef FLEX
+       $(FLEX) $(FLEXFLAGS) -o'$@' $<
+ else
+       @$(missing) flex $< $@
+ endif
*** ./contrib/dbase/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./contrib/dbase/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,18 ----
+ # local configuration
+ PROGRAM = dbf2pg
+ OBJS  = dbf.o dbf2pg.o endian.o
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ PG_LIBS = $(libpq)
+ 
+ # Uncomment this to provide charset translation
+ #PG_CPPFLAGS += -DHAVE_ICONV_H
+ # You might need to uncomment this too, if libiconv is a separate
+ # library on your platform
+ #PG_LIBS += -liconv
+ 
+ DOCS = README.dbf2pg
+ MAN = dbf2pg.1                        # XXX not implemented
+ 
+ # global
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/dblink/pgxs.mk.orig       Mon Jul  5 09:24:51 2004
--- ./contrib/dblink/pgxs.mk    Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,11 ----
+ MODULE_big = dblink
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ OBJS  = dblink.o
+ SHLIB_LINK = $(libpq)
+ 
+ DATA_built = dblink.sql 
+ DOCS = README.dblink
+ REGRESS = dblink
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/dbsize/pgxs.mk.orig       Mon Jul  5 09:24:51 2004
--- ./contrib/dbsize/pgxs.mk    Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = dbsize
+ DATA_built = dbsize.sql
+ DOCS = README.dbsize
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/earthdistance/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./contrib/earthdistance/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,7 ----
+ MODULES = earthdistance
+ DATA_built = earthdistance.sql
+ DOCS = README.earthdistance
+ REGRESS = earthdistance
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/findoidjoins/pgxs.mk.orig Mon Jul  5 09:24:51 2004
--- ./contrib/findoidjoins/pgxs.mk      Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,11 ----
+ PROGRAM = findoidjoins
+ OBJS  = findoidjoins.o
+ 
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ PG_LIBS = $(libpq)
+ 
+ SCRIPTS = make_oidjoins_check
+ DOCS = README.findoidjoins
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/fulltextindex/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./contrib/fulltextindex/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,7 ----
+ MODULES = fti
+ DATA_built = fti.sql
+ DOCS = README.fti
+ SCRIPTS = fti.pl
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/fuzzystrmatch/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./contrib/fuzzystrmatch/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = fuzzystrmatch
+ DATA_built = fuzzystrmatch.sql
+ DOCS = README.fuzzystrmatch README.soundex
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/intagg/pgxs.mk.orig       Mon Jul  5 09:24:51 2004
--- ./contrib/intagg/pgxs.mk    Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = int_aggregate
+ DATA_built = int_aggregate.sql
+ DOCS = README.int_aggregate
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/intarray/pgxs.mk.orig     Mon Jul  5 09:24:51 2004
--- ./contrib/intarray/pgxs.mk  Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,8 ----
+ MODULE_big = _int
+ OBJS = _int_bool.o _int_gist.o _int_op.o _int_tool.o _intbig_gist.o 
+ DATA_built = _int.sql
+ DOCS = README.intarray
+ REGRESS = _int
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/isbn_issn/pgxs.mk.orig    Mon Jul  5 09:24:51 2004
--- ./contrib/isbn_issn/pgxs.mk Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = isbn_issn
+ DATA_built = isbn_issn.sql
+ DOCS = README.isbn_issn
+ 
+ PGXS := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/lo/pgxs.mk.orig   Mon Jul  5 09:24:51 2004
--- ./contrib/lo/pgxs.mk        Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,7 ----
+ MODULES = lo
+ DATA_built = lo.sql
+ DATA = lo_drop.sql lo_test.sql
+ DOCS = README.lo
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/ltree/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./contrib/ltree/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,10 ----
+ PG_CPPFLAGS = -DLOWER_NODE
+ MODULE_big = ltree
+ OBJS =        ltree_io.o ltree_op.o lquery_op.o _ltree_op.o crc32.o \
+       ltxtquery_io.o ltxtquery_op.o ltree_gist.o _ltree_gist.o
+ DATA_built = ltree.sql
+ DOCS = README.ltree
+ REGRESS = ltree
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/mSQL-interface/pgxs.mk.orig       Mon Jul  5 09:24:51 2004
--- ./contrib/mSQL-interface/pgxs.mk    Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,8 ----
+ PROGRAM       = mpgsql
+ SO_MAJOR_VERSION = 0
+ SO_MINOR_VERSION = 0
+ OBJS  = mpgsql.o
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/miscutil/pgxs.mk.orig     Mon Jul  5 09:24:51 2004
--- ./contrib/miscutil/pgxs.mk  Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = misc_utils
+ DATA_built = misc_utils.sql
+ DOCS = README.misc_utils
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/noupdate/pgxs.mk.orig     Mon Jul  5 09:24:51 2004
--- ./contrib/noupdate/pgxs.mk  Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = noup
+ DATA_built = noup.sql
+ DOCS = README.noup
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/oid2name/pgxs.mk.orig     Mon Jul  5 09:24:51 2004
--- ./contrib/oid2name/pgxs.mk  Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,8 ----
+ PROGRAM = oid2name
+ OBJS  = oid2name.o
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ PG_LIBS = $(libpq)
+ DOCS = README.oid2name
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/pg_autovacuum/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./contrib/pg_autovacuum/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,10 ----
+ PROGRAM = pg_autovacuum
+ OBJS  = pg_autovacuum.o
+ 
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ PG_LIBS = $(libpq)
+ 
+ DOCS = README.pg_autovacuum
+ 
+ PGXS := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/pg_dumplo/pgxs.mk.orig    Mon Jul  5 09:24:51 2004
--- ./contrib/pg_dumplo/pgxs.mk Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,8 ----
+ PROGRAM = pg_dumplo
+ OBJS  = main.o lo_export.o lo_import.o utils.o
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ PG_LIBS = $(libpq)
+ DOCS = README.pg_dumplo
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/pg_logger/pgxs.mk.orig    Mon Jul  5 09:24:51 2004
--- ./contrib/pg_logger/pgxs.mk Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ PROGRAM = pg_logger
+ OBJS  = pg_logger.o
+ DOCS = README.pg_logger
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/pgbench/pgxs.mk.orig      Mon Jul  5 09:24:51 2004
--- ./contrib/pgbench/pgxs.mk   Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,8 ----
+ PROGRAM = pgbench
+ OBJS  = pgbench.o
+ PG_CPPFLAGS = -I$(libpq_srcdir)
+ PG_LIBS = $(libpq)
+ DOCS = README.pgbench README.pgbench_jis
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/pgcrypto/pgxs.mk.orig     Mon Jul  5 09:24:51 2004
--- ./contrib/pgcrypto/pgxs.mk  Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,79 ----
+ # either 'builtin', 'mhash', 'openssl'
+ cryptolib = builtin
+ 
+ # either 'builtin', 'system'
+ cryptsrc = builtin
+ 
+ # Random source, preferred order:
+ # 'dev'      - read from random device
+ #
+ # 'openssl'  - use openssl PRNG.
+ #              Note that currently pgcrypto does not do any
+ #              entropy feeding to it
+ #              This works ofcouse only with cryptolib = openssl
+ #
+ # 'silly'    - use libc random() - very weak
+ random = silly
+ random_dev = \"/dev/urandom\"
+ 
+ ##########################
+ 
+ ifeq ($(cryptolib), builtin)
+ CRYPTO_CFLAGS =
+ CRYPTO_LDFLAGS =
+ SRCS = md5.c sha1.c internal.c blf.c rijndael.c
+ endif
+ 
+ ifeq ($(cryptolib), openssl)
+ CRYPTO_CFLAGS = -I/usr/include/openssl
+ CRYPTO_LDFLAGS = -lcrypto
+ SRCS = openssl.c
+ endif
+ 
+ ifeq ($(cryptolib), mhash)
+ CRYPTO_CFLAGS = -I/usr/local/include
+ CRYPTO_LDFLAGS = -L/usr/local/lib -lmcrypt -lmhash -lltdl
+ SRCS = mhash.c
+ endif
+ 
+ ifeq ($(cryptsrc), builtin)
+ SRCS += crypt-blowfish.c crypt-des.c crypt-md5.c 
+ else
+ CRYPTO_CFLAGS += -DPX_SYSTEM_CRYPT
+ endif
+ 
+ ifeq ($(random), dev)
+ CRYPTO_CFLAGS += -DRAND_DEV=$(random_dev)
+ endif
+ ifeq ($(random), openssl)
+ CRYPTO_CFLAGS += -DRAND_OPENSSL
+ endif
+ ifeq ($(random), silly)
+ CRYPTO_CFLAGS += -DRAND_SILLY
+ endif
+ 
+ MODULE_big    := pgcrypto
+ SRCS          += pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \
+                       crypt-gensalt.c random.c
+ OBJS          := $(SRCS:.c=.o)
+ DOCS          := README.pgcrypto
+ DATA_built    := pgcrypto.sql
+ EXTRA_CLEAN   := gen-rtab
+ 
+ PG_CPPFLAGS   := $(CRYPTO_CFLAGS) -I$(srcdir) 
+ SHLIB_LINK    := $(CRYPTO_LDFLAGS)
+ 
+ REGRESS := init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
+               crypt-des crypt-md5 crypt-blowfish crypt-xdes 
+ 
+ # global
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ # local rules
+ rijndael.o: rijndael.tbl
+ 
+ rijndael.tbl:
+       $(CC) $(CPPFLAGS) $(CFLAGS) -DPRINT_TABS rijndael.c -o gen-rtab
+       ./gen-rtab > rijndael.tbl
+ 
*** ./contrib/pgstattuple/pgxs.mk.orig  Mon Jul  5 09:24:51 2004
--- ./contrib/pgstattuple/pgxs.mk       Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,11 ----
+ MODULE_big    := pgstattuple
+ SRCS          += pgstattuple.c
+ OBJS          := $(SRCS:.c=.o)
+ DOCS          := README.pgstattuple README.pgstattuple.euc_jp
+ DATA_built    := pgstattuple.sql
+ 
+ PG_CPPFLAGS   :=
+ SHLIB_LINK    :=
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/rserv/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./contrib/rserv/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,25 ----
+ NAME  = rserv
+ MODULES       = rserv
+ DATA  = RServ.pm
+ DATA_built    = master.sql slave.sql
+ SQLS  = $(DATA_built)
+ DOCS  = README.rserv
+ SCRIPTS_built = RservTest
+ SCRIPTS_built += MasterInit MasterAddTable Replicate MasterSync CleanLog
+ SCRIPTS_built += SlaveInit SlaveAddTable GetSyncID
+ SCRIPTS_built += PrepareSnapshot ApplySnapshot
+ SCRIPTS_built += InitRservTest
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ 
+ $(SQLS): %.sql: %.sql.in
+       sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@
+ 
+ $(SCRIPTS_built): %: %.in
+       sed -e 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' \
+           -e 's:@SQLDIR@:$(datadir)/contrib:g' \
+           -e 's:@BINDIR@:$(bindir):g' \
+           -e 's:@LIBDIR@:$(datadir)/contrib:g' $< >$@
+       chmod a+x $@
*** ./contrib/rtree_gist/pgxs.mk.orig   Mon Jul  5 09:24:51 2004
--- ./contrib/rtree_gist/pgxs.mk        Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,7 ----
+ MODULES = rtree_gist
+ DATA_built = rtree_gist.sql
+ DOCS = README.rtree_gist
+ REGRESS = rtree_gist
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/seg/pgxs.mk.orig  Mon Jul  5 09:24:51 2004
--- ./contrib/seg/pgxs.mk       Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,32 ----
+ MODULE_big = seg
+ OBJS = seg.o segparse.o
+ DATA_built = seg.sql
+ DOCS = README.seg
+ REGRESS = seg
+ EXTRA_CLEAN = segparse.c segparse.h segscan.c y.tab.c y.tab.h
+ 
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ 
+ # segscan is compiled as part of segparse
+ segparse.o: segscan.c
+ 
+ segparse.c: segparse.h ;
+ 
+ segparse.h: segparse.y
+ ifdef YACC
+       $(YACC) -d $(YFLAGS) -p seg_yy $<
+       mv -f y.tab.c segparse.c
+       mv -f y.tab.h segparse.h
+ else
+       @$(missing) bison $< $@
+ endif
+ 
+ segscan.c: segscan.l
+ ifdef FLEX
+       $(FLEX) $(FLEXFLAGS) -o'$@' $<
+ else
+       @$(missing) flex $< $@
+ endif
*** ./contrib/spi/pgxs.mk.orig  Mon Jul  5 09:24:51 2004
--- ./contrib/spi/pgxs.mk       Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,11 ----
+ MODULES = autoinc insert_username moddatetime refint timetravel
+ DATA_built = $(addsuffix .sql, $(MODULES))
+ DOCS  = README.spi $(addsuffix .example, $(MODULES))
+ 
+ # this is needed for the regression tests;
+ # comment out if you want a quieter refint package for other uses
+ PG_CPPFLAGS = -DREFINT_VERBOSE
+ 
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/string/pgxs.mk.orig       Mon Jul  5 09:24:51 2004
--- ./contrib/string/pgxs.mk    Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = string_io
+ DATA_built = string_io.sql
+ DOCS = README.string_io
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/tablefunc/pgxs.mk.orig    Mon Jul  5 09:24:51 2004
--- ./contrib/tablefunc/pgxs.mk Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,7 ----
+ MODULES = tablefunc
+ DATA_built = tablefunc.sql
+ DOCS = README.tablefunc
+ REGRESS = tablefunc
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/tips/pgxs.mk.orig Mon Jul  5 09:24:51 2004
--- ./contrib/tips/pgxs.mk      Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,4 ----
+ DOCS = README.apachelog
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/tsearch/pgxs.mk.orig      Mon Jul  5 09:24:51 2004
--- ./contrib/tsearch/pgxs.mk   Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,24 ----
+ PG_CPPFLAGS = -I.
+ MODULE_big = tsearch
+ OBJS = crc32.o morph.o txtidx.o query.o gistidx.o rewrite.o
+ DATA_built = tsearch.sql
+ DOCS = README.tsearch
+ REGRESS = tsearch
+ EXTRA_CLEAN = parser.c
+ 
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ 
+ # parser is compiled as part of query
+ query.o: parser.c
+ 
+ parser.c: parser.l
+ ifdef FLEX
+       $(FLEX) $(FLEXFLAGS) -8 -Ptsearch_yy -o'$@' $<
+ else
+       @$(missing) flex $< $@
+ endif
+ 
+ # DO NOT DELETE
*** ./contrib/tsearch2/pgxs.mk.orig     Mon Jul  5 09:24:51 2004
--- ./contrib/tsearch2/pgxs.mk  Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,43 ----
+ MODULE_big = tsearch2
+ OBJS = dict_ex.o dict.o snmap.o stopword.o common.o prs_dcfg.o \
+        dict_snowball.o dict_ispell.o dict_syn.o \
+        wparser.o wparser_def.o \
+        ts_cfg.o tsvector.o rewrite.o crc32.o query.o gistidx.o \
+        tsvector_op.o rank.o ts_stat.o
+ 
+ SUBDIRS     := snowball ispell wordparser
+ SUBDIROBJS  := $(SUBDIRS:%=%/SUBSYS.o)
+ 
+ OBJS:= $(OBJS) $(SUBDIROBJS)
+ 
+ $(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
+ 
+ $(SUBDIRS:%=%-recursive):
+       $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
+ 
+ PG_CPPFLAGS = -I$(srcdir)/snowball -I$(srcdir)/ispell -I$(srcdir)/wordparser
+ 
+ DATA = stopword/english.stop stopword/russian.stop
+ DATA_built = tsearch2.sql untsearch2.sql
+ DOCS = README.tsearch2
+ REGRESS = tsearch2
+ 
+ SHLIB_LINK := -lm
+ 
+ #
+ PGXS := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ # specific rules
+ tsearch2.sql: tsearch.sql.in
+       sed -e 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' \
+           -e 's,DATA_PATH,$(datadir)/contrib,g' $< >$@
+ 
+ untsearch2.sql: untsearch.sql.in
+       cp $< $@
+ 
+ .PHONY: subclean
+ clean: subclean
+ 
+ subclean:
+       for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean || exit; done
*** ./contrib/userlock/pgxs.mk.orig     Mon Jul  5 09:24:51 2004
--- ./contrib/userlock/pgxs.mk  Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,6 ----
+ MODULES = user_locks
+ DATA_built = user_locks.sql
+ DOCS = README.user_locks
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/xml/pgxs.mk.orig  Mon Jul  5 09:24:51 2004
--- ./contrib/xml/pgxs.mk       Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,9 ----
+ MODULE_big = pgxml_dom
+ OBJS = pgxml_dom.o
+ SHLIB_LINK = -lxml2
+ DATA_built = pgxml_dom.sql
+ DOCS = README.xml
+ 
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./contrib/xml2/pgxs.mk.orig Mon Jul  5 09:24:51 2004
--- ./contrib/xml2/pgxs.mk      Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,11 ----
+ MODULE_big = pgxml
+ # Remove xslt_proc.o from the following line if you don't have libxslt
+ OBJS = xpath.o xslt_proc.o
+ # Remove -lxslt from the following line if you don't have libxslt.
+ SHLIB_LINK = -lxml2 -lxslt
+ DATA_built = pgxml.sql
+ DOCS = README.xml2
+ 
+ 
+ PGXS  := $(shell pg_config --pgxs)
+ include $(PGXS)
*** ./doc/src/sgml/installation.sgml.orig       Mon Jun 21 08:36:52 2004
--- ./doc/src/sgml/installation.sgml    Mon Jul  5 09:24:51 2004
***************
*** 1042,1071 ****
     </para>
  
     <para>
!     The standard installation provides only the header files needed for client
!     application development.  If you plan to do any server-side program
!     development (such as custom functions or data types written in C),
!     then you may want to install the entire <productname>PostgreSQL</>
!     include tree into your target include directory.  To do that, enter
  <screen>
! <userinput>gmake install-all-headers</userinput>
  </screen>
!     This adds a megabyte or two to the installation footprint, and is only
!     useful if you don't plan to keep the whole source tree around for
!     reference.  (If you do, you can just use the source's include
!     directory when building server-side software.)
     </para>
  
     <formalpara>
      <title>Client-only installation:</title>
      <para>
       If you want to install only the client applications and
!      interface libraries, then you can use these commands:
  <screen>
! <userinput>gmake -C src/bin install</>
! <userinput>gmake -C src/include install</>
! <userinput>gmake -C src/interfaces install</>
! <userinput>gmake -C doc install</>
  </screen>
      </para>
     </formalpara>
--- 1042,1068 ----
     </para>
  
     <para>
!     The standard installation provides all the header files needed for client
!     application development, as well as headers for server-side program
!     development such as custom functions or data types written in C.
!     If you do not want to install the entire <productname>PostgreSQL</>
!     include tree into your target include directory.  Enter
  <screen>
! <userinput>gmake light-install</userinput>
  </screen>
!     rather than the <literal>install</literal> target.
!     This reduce by two megabytes the installation footprint, at the price
!     of having to recover the whole source tree if you need
!     to add extensions such as new data types or custom functions.
     </para>
  
     <formalpara>
      <title>Client-only installation:</title>
      <para>
       If you want to install only the client applications and
!      interface libraries, then you can use these command:
  <screen>
! <userinput>gmake install-client-only</>
  </screen>
      </para>
     </formalpara>
*** ./doc/src/sgml/pgxs.sgml.orig       Mon Jul  5 09:24:51 2004
--- ./doc/src/sgml/pgxs.sgml    Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,64 ----
+ <!--
+ $PostgreSQL$
+ -->
+ 
+ <chapter id="pgxs">
+ <title><productname>PostgreSQL</productname> extension build infrastructure
+ </title>
+ 
+ <!-- other indexes? -->
+ <indexterm zone="pgxs">
+ <primary>pgxs</primary>
+ </indexterm>
+ <indexterm zone="pgxs">
+ <primary>extending PostgreSQL</primary>
+ </indexterm>
+ 
+ <para>
+ This section describes the <productname>PostgreSQL</productname>
+ build infrastructure for extensions, so that new contributions
+ can be built simply against an already installed server.
+ 
+ Such contributions include: new types, functions, gist-based
+ indexes, and so on.
+ 
+ Extensions can be compiled and installed as if it would have
+ been directly done during server installation, by reusing
+ postgresql build infrastructure.
+ </para>
+ 
+ <sect1>
+ <title>How to use <productname>PostgreSQL</productname> extension
+ build infrastructure</title>
+ 
+ <para>
+ In order to use the infrastructure for your extension, you must 
+ use a specific makefile and tailor it to your needs. 
+ A ready to use template makefile is available under the
+ same directory as file <literal>pg_config --pgxs</literal>,
+ see file <literal>pgxs_template.mk</literal>.
+ </para>
+ 
+ <para>
+ Copy this makefile as <literal>Makefile</literal> in the directory 
+ which holds your extension. Comments in this makefile indicates 
+ which macros can be set and which effect is to be expected. 
+ Then you can do <literal>make</literal> to compile, and later
+ <literal>make install</literal> to install your contribution.
+ </para>
+ 
+ <para>
+ The extension is compiled and installed for the 
+ <productname>PostgreSQL</productname> which correspond to the
+ first <literal>pg_config</literal> command found in your 
+ <literal>PATH</literal>.
+ </para>
+ 
+ <para>
+ Many examples of such tailored makefiles, named
+ <literal>pgxs.mk</literal>, can be found in
+ <literal>contrib/</literal> subdirectories. They can be used
+ with <literal>make -f pgxs.mk ...</literal>.
+ </para>
+ </sect1>
+ </chapter>
*** ./src/Makefile.global.in.orig       Thu Jun  3 15:05:55 2004
--- ./src/Makefile.global.in    Mon Jul  5 09:24:51 2004
***************
*** 116,121 ****
--- 116,123 ----
  
  localedir := @localedir@
  
+ # where the postgres extension framework is to be put:
+ pgxsdir := $(pkglibdir)/pgxs
  
  ##########################################################################
  #
***************
*** 166,172 ****
--- 168,180 ----
  
  CPP = @CPP@
  CPPFLAGS = @CPPFLAGS@
+ 
+ ifdef PGXS
+ override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
+ else
  override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
+ endif
+ 
  ifdef VPATH
  override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
  endif
***************
*** 198,203 ****
--- 206,216 ----
  LORDER = @LORDER@
  X = @EXEEXT@
  
+ ifdef PGXS
+ LDFLAGS += -L$(pkglibdir)
+ endif
+ 
+ 
  # Perl 
  
  PERL                  = @PERL@
***************
*** 366,371 ****
--- 379,387 ----
  %.bz2: %
        $(BZIP2) -f $<
  
+ 
+ ifndef PGXS
+ 
  # Remake Makefile.global from Makefile.global.in if the latter
  # changed. In order to trigger this rule, the including file must
  # write `include $(top_builddir)/src/Makefile.global', not some
***************
*** 393,398 ****
--- 409,415 ----
  $(top_builddir)/config.status: $(top_srcdir)/configure
        cd $(top_builddir) && ./config.status --recheck
  
+ endif
  
  install-strip:
        @$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
*** ./src/Makefile.orig Fri Apr 30 17:18:16 2004
--- ./src/Makefile      Mon Jul  5 09:24:51 2004
***************
*** 12,17 ****
--- 12,19 ----
  top_builddir = ..
  include Makefile.global
  
+ ins_files     = Makefile.global Makefile.port Makefile.shlib nls-global.mk 
+ ins_dir               = $(DESTDIR)$(pgxsdir)/src
  
  all install installdirs uninstall dep depend distprep:
        $(MAKE) -C port $@
***************
*** 26,31 ****
--- 28,52 ----
  install-all-headers:
        $(MAKE) -C include $@
  
+ install-config-files: installdirs
+       $(MAKE) -C utils $@
+       $(MAKE) -C makefiles $@
+       $(MAKE) -C port $@
+       for f in $(ins_files) ; do $(INSTALL_DATA) $$f $(ins_dir) ; done
+ 
+ uninstall: uninstall-local
+ 
+ uninstall-local:
+       $(MAKE) -C utils $@
+       $(MAKE) -C makefiles $@
+       for f in $(ins_files) ; do $(RM) $(ins_dir)/$$f ; done
+ 
+ installdirs: installdirs-local
+ 
+ installdirs-local:
+       $(mkinstalldirs) $(DESTDIR)$(pgxsdir)
+       $(mkinstalldirs) $(DESTDIR)$(pgxsdir)/src
+ 
  clean:
        $(MAKE) -C port $@
        $(MAKE) -C timezone $@
*** ./src/bin/pg_config/Makefile.orig   Sat Nov 29 20:52:04 2003
--- ./src/bin/pg_config/Makefile        Mon Jul  5 09:24:51 2004
***************
*** 14,19 ****
--- 14,20 ----
            -e 's,@pkglibdir@,$(pkglibdir),g' \
            -e "s|@configure@|$(configure_args)|g" \
            -e 's,@version@,$(VERSION),g' \
+           -e 's,@pgxsdir@,$(pgxsdir),g' \
          $< >$@
        chmod a+x $@
  
*** ./src/bin/pg_config/pg_config.sh.orig       Sat Nov 29 20:52:04 2003
--- ./src/bin/pg_config/pg_config.sh    Mon Jul  5 09:24:51 2004
***************
*** 19,24 ****
--- 19,25 ----
  val_pkglibdir='@pkglibdir@'
  val_configure="@configure@"
  val_version='@version@'
+ val_pgxsdir='@pgxsdir@'
  
  help="\
  $me provides information about the installed version of PostgreSQL.
***************
*** 35,40 ****
--- 36,42 ----
    --pkglibdir           show location of dynamically loadable modules
    --configure           show options given to 'configure' script when
                          PostgreSQL was built
+   --pgxs              show location of extension makefile
    --version             show the PostgreSQL version, then exit
    --help                show this help, then exit
  
***************
*** 61,66 ****
--- 63,69 ----
          --libdir)       show="$show \$val_libdir";;
          --pkglibdir)    show="$show \$val_pkglibdir";;
          --configure)    show="$show \$val_configure";;
+       --pgxs)         show="$show \$val_pgxsdir/src/makefiles/pgxs.mk";;
  
        --version)      echo "PostgreSQL $val_version"
                          exit 0;;
*** ./src/makefiles/Makefile.orig       Mon Jul  5 09:24:51 2004
--- ./src/makefiles/Makefile    Mon Jul  5 09:27:52 2004
***************
*** 0 ****
--- 1,18 ----
+ # Makefile for src/makefiles
+ 
+ subdir = src/makefiles
+ top_builddir = ../..
+ include $(top_builddir)/src/Makefile.global
+ 
+ ins_files =   pgxs.mk pgxs_template.mk
+ 
+ ins_dir               = $(DESTDIR)$(pgxsdir)/$(subdir)
+ 
+ install-config-files: installdirs
+       for f in $(ins_files) ; do $(INSTALL_DATA) $$f $(ins_dir) ; done;
+ 
+ installdirs:
+       $(mkinstalldirs) $(ins_dir)
+ 
+ uninstall:
+       for f in $(ins_files) ; do $(RM) $(ins_dir)/$$f ; done;
*** ./src/makefiles/pgxs.mk.orig        Mon Jul  5 09:24:51 2004
--- ./src/makefiles/pgxs.mk     Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,210 ----
+ # $PostgreSQL$ 
+ #
+ # PGXS: PostGreSQL eXtensionS initial directory
+ #
+ 
+ ifndef PGXS
+ $(error pgxs error: PGXS makefile macro must be set)
+ endif
+ 
+ # we assume that we are in ./src/makefiles, so top is:
+ top_builddir := $(dir $(PGXS))/../..
+ 
+ # are other macros needed? subdir??
+ 
+ # now we assume we're in the main tree.
+ include $(top_builddir)/src/Makefile.global
+ 
+ # issues:
+ # - what about includes? fixed with "ifdef PGXS" in Makefile.global
+ # - others?
+ 
+ override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
+ 
+ ifdef MODULES
+ override CFLAGS += $(CFLAGS_SL)
+ SHLIB_LINK += $(BE_DLLLIBS)
+ endif
+ 
+ ifdef PG_CPPFLAGS
+ override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
+ endif
+ 
+ all: $(PROGRAM) $(DATA_built) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES))
+ 
+ ifdef MODULE_big
+ # shared library parameters
+ NAME = $(MODULE_big)
+ SO_MAJOR_VERSION= 0
+ SO_MINOR_VERSION= 0
+ rpath =
+ 
+ SHLIB_LINK += $(BE_DLLLIBS)
+ 
+ include $(top_srcdir)/src/Makefile.shlib
+ 
+ all: all-lib
+ endif # MODULE_big
+ 
+ 
+ install: all installdirs
+ ifneq (,$(DATA)$(DATA_built))
+       @for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built); do \
+         echo "$(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/contrib"; \
+         $(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/contrib; \
+       done
+ endif # DATA
+ ifdef MODULES
+       @for file in $(addsuffix $(DLSUFFIX), $(MODULES)); do \
+         echo "$(INSTALL_SHLIB) $$file $(DESTDIR)$(pkglibdir)"; \
+         $(INSTALL_SHLIB) $$file $(DESTDIR)$(pkglibdir); \
+       done
+ endif # MODULES
+ ifdef DOCS
+       @for file in $(addprefix $(srcdir)/, $(DOCS)); do \
+         echo "$(INSTALL_DATA) $$file $(DESTDIR)$(docdir)/contrib"; \
+         $(INSTALL_DATA) $$file $(DESTDIR)$(docdir)/contrib; \
+       done
+ endif # DOCS
+ ifdef PROGRAM
+       $(INSTALL_PROGRAM) $(PROGRAM)$(X) $(DESTDIR)$(bindir)
+ endif # PROGRAM
+ ifdef MODULE_big
+       $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)
+ endif # MODULE_big
+ ifdef SCRIPTS
+       @for file in $(addprefix $(srcdir)/, $(SCRIPTS)); do \
+         echo "$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir)"; \
+         $(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir); \
+       done
+ endif # SCRIPTS
+ ifdef SCRIPTS_built
+       @for file in $(SCRIPTS_built); do \
+         echo "$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir)"; \
+         $(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir); \
+       done
+ endif # SCRIPTS_built
+ 
+ 
+ installdirs:
+ ifneq (,$(DATA)$(DATA_built))
+       $(mkinstalldirs) $(DESTDIR)$(datadir)/contrib
+ endif
+ ifneq (,$(MODULES)$(MODULE_big))
+       $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
+ endif
+ ifdef DOCS
+       $(mkinstalldirs) $(DESTDIR)$(docdir)/contrib
+ endif
+ ifneq (,$(PROGRAM)$(SCRIPTS)$(SCRIPTS_built))
+       $(mkinstalldirs) $(DESTDIR)$(bindir)
+ endif
+ 
+ 
+ uninstall:
+ ifneq (,$(DATA)$(DATA_built))
+       rm -f $(addprefix $(DESTDIR)$(datadir)/contrib/, $(notdir $(DATA) 
$(DATA_built)))
+ endif
+ ifdef MODULES
+       rm -f $(addprefix $(DESTDIR)$(pkglibdir)/, $(addsuffix $(DLSUFFIX), 
$(MODULES)))
+ endif
+ ifdef DOCS
+       rm -f $(addprefix $(DESTDIR)$(docdir)/contrib/, $(DOCS))
+ endif
+ ifdef PROGRAM
+       rm -f $(DESTDIR)$(bindir)/$(PROGRAM)$(X)
+ endif
+ ifdef MODULE_big
+       rm -f $(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)
+ endif
+ ifdef SCRIPTS
+       rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS))
+ endif
+ ifdef SCRIPTS_built
+       rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS_built))
+ endif
+ 
+ 
+ clean:
+ ifdef MODULES
+       rm -f $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .o, $(MODULES))
+ endif
+ ifdef DATA_built
+       rm -f $(DATA_built)
+ endif
+ ifdef SCRIPTS_built
+       rm -f $(SCRIPTS_built)
+ endif
+ ifdef PROGRAM
+       rm -f $(PROGRAM)$(X)
+ endif
+ ifdef OBJS
+       rm -f $(OBJS)
+ endif
+ ifdef EXTRA_CLEAN
+       rm -f $(EXTRA_CLEAN)
+ endif
+ ifdef REGRESS
+ # things created by various check targets
+       rm -rf results tmp_check log
+       rm -f regression.diffs regression.out regress.out run_check.out
+ ifeq ($(PORTNAME), win)
+       rm -f regress.def
+ endif
+ endif # REGRESS
+ 
+ ifdef MODULE_big
+ clean: clean-lib
+ endif
+ 
+ distclean maintainer-clean: clean
+ 
+ 
+ ifdef REGRESS
+ 
+ # When doing a VPATH build, must copy over the test .sql and .out
+ # files so that the driver script can find them.  We have to use an
+ # absolute path for the targets, because otherwise make will try to
+ # locate the missing files using VPATH, and will find them in
+ # $(srcdir), but the point here is that we want to copy them from
+ # $(srcdir) to the build directory.
+ 
+ ifdef VPATH
+ abs_builddir := $(shell pwd)
+ test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard 
$(srcdir)/expected/*.out) $(wildcard $(srcdir)/data/*.data)
+ test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
+ 
+ all: $(test_files_build)
+ $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
+       ln -s $< $@
+ endif # VPATH
+ 
+ .PHONY: submake
+ submake:
+       $(MAKE) -C $(top_builddir)/src/test/regress pg_regress
+ 
+ # against installed postmaster
+ installcheck: submake
+       $(top_builddir)/src/test/regress/pg_regress $(REGRESS)
+ 
+ # in-tree test doesn't work yet (no way to install my shared library)
+ #check: all submake
+ #     $(top_builddir)/src/test/regress/pg_regress --temp-install \
+ #       --top-builddir=$(top_builddir) $(REGRESS)
+ check:
+       @echo "'make check' is not supported."
+       @echo "Do 'make install', then 'make installcheck' instead."
+ endif # REGRESS
+ 
+ 
+ # STANDARD RULES
+ 
+ ifneq (,$(MODULES)$(MODULE_big))
+ %.sql: %.sql.in
+       sed 's,MODULE_PATHNAME,$$libdir/$*,g' $< >$@
+ endif
+ 
+ ifdef PROGRAM
+ $(PROGRAM): $(OBJS)
+       $(CC) $(CFLAGS) $(OBJS) $(PG_LIBS) $(LDFLAGS) $(LIBS) -o $@
+ endif
*** ./src/makefiles/pgxs_template.mk.orig       Mon Jul  5 09:24:51 2004
--- ./src/makefiles/pgxs_template.mk    Mon Jul  5 09:24:51 2004
***************
*** 0 ****
--- 1,40 ----
+ # PGXS: PostgreSQL extensions template makefile
+ #
+ # This file contains generic rules to build many kinds of simple
+ # contrib modules.  You only need to set a few variables and include
+ # this file, the rest will be done here.
+ #
+ #   MODULES -- list of shared objects to be build from source file with
+ #     same stem (do not include suffix in this list)
+ #   DATA -- random files to install into $PREFIX/share/contrib
+ #   DATA_built -- random files to install into $PREFIX/share/contrib,
+ #     which need to be built first
+ #   DOCS -- random files to install under $PREFIX/doc/contrib
+ #   SCRIPTS -- script files (not binaries) to install into $PREFIX/bin
+ #   SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin,
+ #     which need to be built first
+ #   REGRESS -- list of regression test cases (without suffix)
+ #
+ # or at most one of these two:
+ #
+ #   PROGRAM -- a binary program to build (list objects files in OBJS)
+ #   MODULE_big -- a shared object to build (list object files in OBJS)
+ #
+ # The following can also be set:
+ #
+ #   EXTRA_CLEAN -- extra files to remove in 'make clean'
+ #   PG_CPPFLAGS -- will be added to CPPFLAGS
+ #   PG_LIBS -- will be added to PROGRAM link line
+ #   SHLIB_LINK -- will be added to MODULE_big link line
+ #
+ # Better look at some of the existing uses for examples in contrib/
+ #
+ # isbn_issn type contribution:
+ #MODULES = isbn_issn
+ #DATA_built = isbn_issn.sql
+ #DOCS = README.isbn_issn
+ 
+ PGXS := $(shell pg_config --pgxs)
+ include $(PGXS)
+ 
+ # put here any specific rules.
*** ./src/port/Makefile.orig    Tue Jun  1 10:21:24 2004
--- ./src/port/Makefile Mon Jul  5 09:24:51 2004
***************
*** 15,20 ****
--- 15,22 ----
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
+ ins_dir       = $(DESTDIR)$(pgxsdir)/$(subdir)
+ 
  override CPPFLAGS := -I$(top_builddir)/src/port $(CPPFLAGS)
  LIBS += $(PTHREAD_LIBS)
  
***************
*** 40,42 ****
--- 42,53 ----
  
  clean distclean maintainer-clean:
        rm -f libpgport.a $(LIBOBJS) pg_config_paths.h
+ 
+ install-config-files: installdirs
+       $(INSTALL_STLIB) libpgport.a $(ins_dir)
+ 
+ installdirs:
+       $(mkinstalldirs) $(ins_dir)
+ 
+ uninstall:
+       $(RM) $(ins_dir)/libpgport.a
*** ./src/utils/Makefile.orig   Sat Nov 29 20:52:15 2003
--- ./src/utils/Makefile        Mon Jul  5 09:24:51 2004
***************
*** 12,18 ****
--- 12,30 ----
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
+ ins_dir       = $(DESTDIR)$(pgxsdir)/$(subdir)
+ 
  all:
  
  clean distclean maintainer-clean:
        rm -f dllinit.o
+ 
+ uninstall:
+       $(RM) $(ins_dir)/dllinit.o
+ 
+ install-config-files: installdirs
+       -[ -f dllinit.o ] && \
+               $(INSTALL_DATA) dllinit.o $(ins_dir)
+ 
+ installdirs:
+       $(mkinstalldirs) $(ins_dir)
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to