Re: building a c function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stuart McGraw <smcg2297(at)frii(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: building a c function
Date: 2010-03-17 19:34:42
Message-ID: 24434.1268854482@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stuart McGraw <smcg2297(at)frii(dot)com> writes:
> MODULES = my_func
> PG_CONFIG = pg_config
> PGXS := $(shell $(PG_CONFIG) --pgxs)
> include $(PGXS)
> OBJS = my_subs.o # Is this right?

Not entirely certain, but I think you need to set all the variables
*before* including $(PGXS), so ordering above is no good. Also I
believe you need to use MODULE_big not MODULES if you intend to link
additional .o files beyond the one corresponding to the module name.
Per the comments in pgxs.mk:

# Use the following layout for your Makefile:
#
# [variable assignments, see below]
# [custom rules, rarely necessary]
#
# PG_CONFIG = pg_config
# PGXS := $(shell $(PG_CONFIG) --pgxs)
# include $(PGXS)
#
# Set one of these three variables to specify what is built:
#
# MODULES -- list of shared objects to be built from source files with
# same stem (do not include suffix in this list)
# MODULE_big -- a shared object to build from multiple source files
# (list object files in OBJS)
# PROGRAM -- a binary program to build (list object files in OBJS)
#
# The following variables can also be set:
#
# MODULEDIR -- subdirectory into which DATA and DOCS files should be
# installed (if not set, default is "contrib")
# DATA -- random files to install into $PREFIX/share/$MODULEDIR
# DATA_built -- random files to install into $PREFIX/share/$MODULEDIR,
# which need to be built first
# DATA_TSEARCH -- random files to install into $PREFIX/share/tsearch_data
# DOCS -- random files to install under $PREFIX/doc/$MODULEDIR
# SCRIPTS -- script files (not binaries) to install into $PREFIX/bin
# SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin,
# which need to be built first
# REGRESS -- list of regression test cases (without suffix)
# EXTRA_CLEAN -- extra files to remove in 'make clean'
# PG_CPPFLAGS -- will be added to CPPFLAGS
# PG_LIBS -- will be added to PROGRAM link line
# SHLIB_LINK -- will be added to MODULE_big link line
# PG_CONFIG -- path to pg_config program for the PostgreSQL installation
# to build against (typically just "pg_config" to use the first one in
# your PATH)
#
# Better look at some of the existing uses for examples...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Szymon Guz 2010-03-17 19:52:06 Re: update ... set ... subquery
Previous Message John Smith 2010-03-17 19:13:26 update ... set ... subquery