EXTCOMMENT = examine and manage the os buffer cache
MODULES = $(EXTENSION)
-MODULE_DIR = $(EXTENSION)
+MODULEDIR = $(EXTENSION)
DOCS = README.rst
+DATA_built = $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION)--unpackaged--$(EXTVERSION).sql
+REGRESS = $(EXTENSION).ext
+EXTRA_CLEAN = $(EXTENSION).control
PG_CONFIG = pg_config
-BUILD_EXTENSION = $(shell $(PG_CONFIG) --version | grep -qE "8\.|9\.0" && echo no || echo yes)
-# Default (no Extension support)
-DATA = $(EXTENSION).sql uninstall_$(EXTENSION).sql
-REGRESS = $(EXTENSION)
-pgext_files := $(DOCS) $(DATA)
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
-# we need to build with Extension support:
-ifeq ($(BUILD_EXTENSION),yes)
-all: $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION)--unpackaged--$(EXTVERSION).sql
+# pgxs is included after variable definition and before targets, so the
+# PostgreSQL default target is used (all:)
+
+# build the extension--unpackaged--version.sql from extension.unpackaged.sql
+# this assumes that the extension was installed via sql script instead of
+# CREATE EXTENSION.
+# This won't upgrade from a previous version to the current one.
+$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION).unpackaged.sql
+ cp $< $@
# this copy the extension.sql to extension--version.sql
$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql
- cp $< $@
-
-# this build the extension--unpackaged--version.sql from uninstall_extension.sql
-$(EXTENSION)--unpackaged--$(EXTVERSION).sql: uninstall_$(EXTENSION).sql
- sed 's/DROP /ALTER EXTENSION $(EXTENSION) ADD /' $< > $@
+ cp $< $@
# this build extension.control from extension.control.in
$(EXTENSION).control: $(EXTENSION).control.in
- sed 's/EXTVERSION/$(EXTVERSION)/;s/EXTENSION/$(EXTENSION)/;s/EXTCOMMENT/$(EXTCOMMENT)/' $< > $@
-
-DATA = $(EXTENSION)--unpackaged--$(EXTVERSION).sql $(EXTENSION)--$(EXTVERSION).sql
-REGRESS = $(EXTENSION).ext
-EXTRA_CLEAN = $(DATA) $(EXTENSION).control
-pgext_files := $(DOCS)
-endif
-
-# Workaround for lack of good VPATH support in pgxs for extension/contrib
-ifdef VPATH
-pgext_files_build:= $(addprefix $(CURDIR)/, $(pgext_files))
-pgext_reg_files := $(addprefix $(CURDIR)/sql/, $(notdir $(wildcard $(VPATH)/sql/*.sql)))
-pgext_reg_exp := $(addprefix $(CURDIR)/expected/, $(notdir $(wildcard $(VPATH)/expected/*.out)))
-all: $(pgext_files_build) $(pgext_reg_files) $(pgext_reg_exp)
-$(pgext_files_build): $(CURDIR)/%: $(VPATH)/%
- cp $< $@
-$(pgext_reg_files): $(CURDIR)/sql/%: $(VPATH)/sql/%
- mkdir -p $(dir $(pgext_reg_files))
- cp $< $@
-$(pgext_reg_exp): $(CURDIR)/expected/%: $(VPATH)/expected/%
- mkdir -p $(dir $(pgext_reg_exp))
- cp $< $@
-endif # VPATH
-
-PGXS := $(shell $(PG_CONFIG) --pgxs)
-include $(PGXS)
+ sed 's/EXTVERSION/$(EXTVERSION)/;s/EXTENSION/$(EXTENSION)/;s/EXTCOMMENT/$(EXTCOMMENT)/' $< > $@
pgfoundry:
git archive --prefix=$(EXTENSION)-$(EXTVERSION)/ -o $(EXTENSION)-v$(EXTVERSION).tar.gz HEAD
--- /dev/null
+ALTER EXTENSION pgfincore ADD FUNCTION pgsysconf();
+ALTER EXTENSION pgfincore ADD FUNCTION pgsysconf_pretty();
+
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise(regclass, text, int);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_willneed(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_dontneed(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_normal(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_sequential(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_random(regclass);
+
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_loader(regclass, text, int, bool, bool, varbit);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_loader(regclass, int, bool, bool, varbit);
+
+ALTER EXTENSION pgfincore ADD FUNCTION pgfincore(regclass, text, bool);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfincore(regclass, bool);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfincore(regclass);
+++ /dev/null
-
-DROP FUNCTION pgsysconf_pretty();
-DROP FUNCTION pgsysconf();
-
-DROP FUNCTION pgfadvise_willneed(regclass);
-DROP FUNCTION pgfadvise_dontneed(regclass);
-DROP FUNCTION pgfadvise_normal(regclass);
-DROP FUNCTION pgfadvise_sequential(regclass);
-DROP FUNCTION pgfadvise_random(regclass);
-DROP FUNCTION pgfadvise(regclass, text, int);
-
-DROP FUNCTION pgfadvise_loader(regclass, text, int, bool, bool, varbit);
-DROP FUNCTION pgfadvise_loader(regclass, int, bool, bool, varbit);
-
-DROP FUNCTION pgfincore(regclass);
-DROP FUNCTION pgfincore(regclass, bool);
-DROP FUNCTION pgfincore(regclass, text, bool);
-