From 1380870e061362b871c375c25517005f82358dc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Villemain?= <cedric@2ndquadrant.fr>
Date: Fri, 12 Jul 2013 23:39:11 +0200
Subject: [PATCH] add documentation for commit 6697aa2

Document that PGXS offers VPATH build and add a sample like in
installation.sgml

Also update the part about the PGXS global makefile inclusion.
It was suggested to put it at the end, but if the Makefile contains
a target before the include of pgxs then the default all: target is
removed and the Makefile must define all: itself.
---
 doc/src/sgml/extend.sgml |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
index 60fa1a8..8f082e4 100644
--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -935,7 +935,7 @@ include $(PGXS)
     To use the <acronym>PGXS</acronym> infrastructure for your extension,
     you must write a simple makefile.
     In the makefile, you need to set some variables
-    and finally include the global <acronym>PGXS</acronym> makefile.
+    and include the global <acronym>PGXS</acronym> makefile.
     Here is an example that builds an extension module named
     <literal>isbn_issn</literal>, consisting of a shared library containing
     some C code, an extension control file, a SQL script, and a documentation
@@ -1161,6 +1161,19 @@ include $(PGXS)
     or on the <literal>make</literal> command line.
    </para>
 
+   <para>
+    You can also run <literal>make</literal> in a directory outside the source
+    tree of your extension, if you want to keep the build directory separate.
+    This procedure is also called a
+    <indexterm><primary>VPATH</primary></indexterm><firstterm>VPATH</firstterm>
+    build.  Here's how:
+    <screen>
+      <userinput>mkdir build_dir</userinput>
+      <userinput>cd build_dir</userinput>
+      <userinput>make -f /path/to/extension/source/tree/Makefile</userinput>
+      <userinput>make -f /path/to/extension/source/tree/Makefile install</userinput>
+    </screen>
+   </para>
    <caution>
     <para>
      Changing <varname>PG_CONFIG</varname> only works when building
-- 
1.7.10.4