Home Explore Blog CI



postgresql

26th chunk of `doc/src/sgml/extend.sgml`
385af10640a6dd072d9c09189b34ccb99dff18adea4f28d30000000100000fd6
 <literal>installcheck</literal> target, useful e.g., if tests require special configuration, or don't use <application>pg_regress</application>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-extra-clean">
      <term><varname>EXTRA_CLEAN</varname></term>
      <listitem>
       <para>
        extra files to remove in <literal>make clean</literal>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-pg-cppflags">
      <term><varname>PG_CPPFLAGS</varname></term>
      <listitem>
       <para>
        will be prepended to <varname>CPPFLAGS</varname>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-pg-cflags">
      <term><varname>PG_CFLAGS</varname></term>
      <listitem>
       <para>
        will be appended to <varname>CFLAGS</varname>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-pg-cxxflags">
      <term><varname>PG_CXXFLAGS</varname></term>
      <listitem>
       <para>
        will be appended to <varname>CXXFLAGS</varname>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-pg-ldflags">
      <term><varname>PG_LDFLAGS</varname></term>
      <listitem>
       <para>
        will be prepended to <varname>LDFLAGS</varname>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-pg-libs">
      <term><varname>PG_LIBS</varname></term>
      <listitem>
       <para>
        will be added to <varname>PROGRAM</varname> link line
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-shlib-link">
      <term><varname>SHLIB_LINK</varname></term>
      <listitem>
       <para>
        will be added to <varname>MODULE_big</varname> link line
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="extend-pgxs-pg-config">
      <term><varname>PG_CONFIG</varname></term>
      <listitem>
       <para>
        path to <application>pg_config</application> program for the
        <productname>PostgreSQL</productname> installation to build against
        (typically just <literal>pg_config</literal> to use the first one in your
        <varname>PATH</varname>)
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>

   <para>
    Put this makefile as <literal>Makefile</literal> in the directory
    which holds your extension. Then you can do
    <literal>make</literal> to compile, and then <literal>make
    install</literal> to install your module.  By default, the extension is
    compiled and installed for the
    <productname>PostgreSQL</productname> installation that
    corresponds to the first <command>pg_config</command> program
    found in your <varname>PATH</varname>.  You can use a different installation by
    setting <varname>PG_CONFIG</varname> to point to its
    <command>pg_config</command> program, either within the makefile
    or on the <literal>make</literal> command line.
   </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>.

Title: PGXS Extension Compilation and Installation Variables
Summary
This section details PGXS variables used for compiling and installing PostgreSQL extensions. It covers compilation flags like PG_CPPFLAGS, PG_CFLAGS, PG_CXXFLAGS, and PG_LDFLAGS, which modify the standard compilation flags. PG_LIBS and SHLIB_LINK are used for linking. PG_CONFIG specifies the path to the pg_config program for the target PostgreSQL installation. The makefile should be named 'Makefile' in the extension directory. Users can compile with 'make' and install with 'make install'. The installation directory can be customized using the 'prefix' variable during installation, with automatic adjustments made to subdirectory names based on the presence of 'postgres' or 'pgsql' in the prefix.