1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
commit 6697aa2bc25c83b88d6165340348a31328c35de6
Author: Andrew Dunstan <andrew@dunslane.net>
Date: Mon Jul 1 12:53:05 2013 -0400
Improve support for building PGXS modules with VPATH.
A VPATH build will be performed when the module's make file path is not
the current directory or when USE_VPATH is set.
This will assist packagers and others who prefer to build without
polluting the source directories.
There is still a bit of work to do here, notably documentation, but it's
probably a good idea to commit what we have so far and let people test
it out on their modules.
Cédric Villemain, with an addition from me.
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -416,11 +416,22 @@
endif
+# If PGXS is not defined, build libpq and libpgport dependancies as required.
+# If the build is with PGXS, then these are supposed to be already built and
+# installed, and we just ensure that the expected files exist.
+ifndef PGXS
submake-libpq:
$(MAKE) -C $(libpq_builddir) all
+else
+submake-libpq: $(libdir)/libpq.so ;
+endif
+ifndef PGXS
submake-libpgport:
$(MAKE) -C $(top_builddir)/src/port all
+else
+submake-libpgport: $(libdir)/libpgport.a $(libdir)/libpgcommon.a ;
+endif
.PHONY: submake-libpq submake-libpgport
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -62,8 +62,20 @@
include $(top_builddir)/src/Makefile.global
top_srcdir = $(top_builddir)
+# If USE_VPATH is set or Makefile is not in current directory we are building
+# the extension with VPATH so we set the variable here
+ifdef USE_VPATH
+srcdir = $(USE_VPATH)
+VPATH = $(USE_VPATH)
+else
+ifeq ($(CURDIR),$(dir $(firstword $(MAKEFILE_LIST))))
srcdir = .
VPATH =
+else
+srcdir = $(dir $(firstword $(MAKEFILE_LIST)))
+VPATH = $(srcdir)
+endif
+endif
endif
@@ -102,33 +114,40 @@
endif # MODULE_big
-install: all installdirs
-ifneq (,$(EXTENSION))
- $(INSTALL_DATA) $(addprefix $(srcdir)/, $(addsuffix .control, $(EXTENSION))) '$(DESTDIR)$(datadir)/extension/'
-endif # EXTENSION
-ifneq (,$(DATA)$(DATA_built))
- $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) $(DATA_built) '$(DESTDIR)$(datadir)/$(datamoduledir)/'
-endif # DATA
-ifneq (,$(DATA_TSEARCH))
- $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA_TSEARCH)) '$(DESTDIR)$(datadir)/tsearch_data/'
-endif # DATA_TSEARCH
+install: all installdirs installcontrol installdata installdatatsearch installdocs installscripts
ifdef MODULES
$(INSTALL_SHLIB) $(addsuffix $(DLSUFFIX), $(MODULES)) '$(DESTDIR)$(pkglibdir)/'
endif # MODULES
+ifdef PROGRAM
+ $(INSTALL_PROGRAM) $(PROGRAM)$(X) '$(DESTDIR)$(bindir)'
+endif # PROGRAM
+
+installcontrol: $(addsuffix .control, $(EXTENSION))
+ifneq (,$(EXTENSION))
+ $(INSTALL_DATA) $< '$(DESTDIR)$(datadir)/extension/'
+endif
+
+installdata: $(DATA) $(DATA_built)
+ifneq (,$(DATA)$(DATA_built))
+ $(INSTALL_DATA) $^ '$(DESTDIR)$(datadir)/$(datamoduledir)/'
+endif
+
+installdatatsearch: $(DATA_TSEARCH)
+ifneq (,$(DATA_TSEARCH))
+ $(INSTALL_DATA) $^ '$(DESTDIR)$(datadir)/tsearch_data/'
+endif
+
+installdocs: $(DOCS)
ifdef DOCS
ifdef docdir
- $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DOCS)) '$(DESTDIR)$(docdir)/$(docmoduledir)/'
+ $(INSTALL_DATA) $^ '$(DESTDIR)$(docdir)/$(docmoduledir)/'
endif # docdir
endif # DOCS
-ifdef PROGRAM
- $(INSTALL_PROGRAM) $(PROGRAM)$(X) '$(DESTDIR)$(bindir)'
-endif # PROGRAM
+
+installscripts: $(SCRIPTS) $(SCRIPTS_built)
ifdef SCRIPTS
- $(INSTALL_SCRIPT) $(addprefix $(srcdir)/, $(SCRIPTS)) '$(DESTDIR)$(bindir)/'
+ $(INSTALL_SCRIPT) $^ '$(DESTDIR)$(bindir)/'
endif # SCRIPTS
-ifdef SCRIPTS_built
- $(INSTALL_SCRIPT) $(SCRIPTS_built) '$(DESTDIR)$(bindir)/'
-endif # SCRIPTS_built
ifdef MODULE_big
install: install-lib
@@ -253,6 +272,7 @@
all: $(test_files_build)
$(test_files_build): $(abs_builddir)/%: $(srcdir)/%
+ $(MKDIR_P) $(dir $@)
ln -s $< $@
endif # VPATH
|