Le jeudi 16 mai 2013 18:53:19, Alvaro Herrera a écrit :
> Andrew Dunstan wrote:
> > On 05/16/2013 10:39 AM, Cédric Villemain wrote:
> > >Le jeudi 16 mai 2013 15:51:48, Tom Lane a écrit :
> > >>Andrew Dunstan <and...@dunslane.net> writes:
> > >>>On 05/16/2013 05:41 AM, Dimitri Fontaine wrote:
> > >>>>And VPATH building of extension is crucially important for me, as the
> > >>>>easiest way I've found to build and package a given extension against
> > >>>>all currently supported version of PostgreSQL.
> > >>>
> > >>>Is there documented support for VPATH builds?
> > >>
> > >>The core code certainly builds okay in VPATH mode, and I would agree
> > >>with Dimitri that pgxs builds should as well.  But this is more of an
> > >>autoconf+make feature than ours, so I'm not sure why you'd expect us
> > >>to document it.
> > >
> > >Extension does not support VPATH at 100% (well, pgxs.mk).
> > >There is a minor hack for some REGRESS files but that's all.
> > 
> > Right. My impression is that pgxs.mk actively works against vpath builds.
> 
> That's my experience, yes.  It would be great to get it fixed.

OK. I've reduce that to the attached (WIP) patch .
Problem is usage of $(srcdir) in the PGXS case. I try to remove it in favor of 
recipes for each case (DATA, DOCS, ...)

It's a quick hack... It does not handle some cases yet (for example it does 
not find .o when come the time to build .so if the .o was already in VPATH), 
this later issue is a separate one I think.

If it seems to be on the right way, I'll keep fixing EXTENSION building with 
VPATH.

Comments ?
-- 
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index bbcfe04..bc01e0c 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -112,32 +112,44 @@ all: all-lib
 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 installscript installscriptbuilt
 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
+
+installscript: $(SCRIPTS)
 ifdef SCRIPTS
-	$(INSTALL_SCRIPT) $(addprefix $(srcdir)/, $(SCRIPTS)) '$(DESTDIR)$(bindir)/'
+	$(INSTALL_SCRIPT) $^ '$(DESTDIR)$(bindir)/'
 endif # SCRIPTS
-ifdef SCRIPTS_built
-	$(INSTALL_SCRIPT) $(SCRIPTS_built) '$(DESTDIR)$(bindir)/'
+
+installscriptbuilt: $(SCRIPTS_built)
+ifdef SCRIPTS
+	$(INSTALL_SCRIPT) $^ '$(DESTDIR)$(bindir)/'
 endif # SCRIPTS_built
 
 ifdef MODULE_big

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to