Search Postgresql Archives

Re: building a c function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stuart McGraw <smcg2297@xxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux