</para>
<para>
You can select a separate directory prefix in which to install your
extension's files, by setting the <command>make</command> variable
<varname>prefix</varname> when executing <literal>make install</literal>
like so:
<programlisting>
make install prefix=/usr/local/postgresql
</programlisting>
This will install the extension control and SQL files into
<filename>/usr/local/postgresql/share</filename> and the shared modules into
<filename>/usr/local/postgresql/lib</filename>. If the prefix does not
include the strings <literal>postgres</literal> or
<literal>pgsql</literal>, such as
<programlisting>
make install prefix=/usr/local/extras
</programlisting>
then <literal>postgresql</literal> will be appended to the directory
names, installing the control and SQL files into
<filename>/usr/local/extras/share/postgresql/extension</filename> and the
shared modules into <filename>/usr/local/extras/lib/postgresql</filename>.
Either way, you'll need to set <xref
linkend="guc-extension-control-path"/> and <xref
linkend="guc-dynamic-library-path"/> to enable the
<productname>PostgreSQL</productname> server to find the files:
<programlisting>
extension_control_path = '/usr/local/extras/share/postgresql:$system'
dynamic_library_path = '/usr/local/extras/lib/postgresql:$libdir'
</programlisting>
</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:
<programlisting>
mkdir build_dir
cd build_dir
make -f /path/to/extension/source/tree/Makefile
make -f /path/to/extension/source/tree/Makefile install
</programlisting>
</para>
<para>
Alternatively, you can set up a directory for a VPATH build in a similar
way to how it is done for the core code. One way to do this is using the
core script <filename>config/prep_buildtree</filename>. Once this has been done
you can build by setting the <literal>make</literal> variable
<varname>VPATH</varname> like this:
<programlisting>
make VPATH=/path/to/extension/source/tree
make VPATH=/path/to/extension/source/tree install
</programlisting>
This procedure can work with a greater variety of directory layouts.
</para>
<para>
The scripts listed in the <varname>REGRESS</varname> variable are used for
regression testing of your module, which can be invoked by <literal>make
installcheck</literal> after doing <literal>make install</literal>. For this to
work you must have a running <productname>PostgreSQL</productname> server.
The script files listed in <varname>REGRESS</varname> must appear in a
subdirectory named <literal>sql/</literal> in your extension's directory.