2009-08-14 15:42:16 +02:00
|
|
|
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.34 2009/08/14 13:42:16 petere Exp $
|
2001-05-09 21:54:38 +02:00
|
|
|
|
2001-05-12 03:30:30 +02:00
|
|
|
subdir = src/pl/plpython
|
|
|
|
top_builddir = ../../..
|
|
|
|
include $(top_builddir)/src/Makefile.global
|
2001-05-09 21:54:38 +02:00
|
|
|
|
|
|
|
|
2001-08-27 02:29:49 +02:00
|
|
|
# On some platforms we can only build PL/Python if libpython is a
|
2004-10-11 21:32:19 +02:00
|
|
|
# shared library. Since there is no official way to determine this
|
|
|
|
# (at least not in pre-2.3 Python), we see if there is a file that is
|
|
|
|
# named like a shared library.
|
2005-08-12 23:44:51 +02:00
|
|
|
ifneq (,$(wildcard $(python_libdir)/libpython*$(DLSUFFIX)*))
|
2001-08-27 02:29:49 +02:00
|
|
|
shared_libpython = yes
|
|
|
|
endif
|
|
|
|
|
2004-10-10 21:07:55 +02:00
|
|
|
# Windows needs to convert backslashed paths to normal slashes,
|
2004-10-11 21:32:19 +02:00
|
|
|
# and we have to remove -lpython from the link since we are building our own
|
2004-10-06 11:20:41 +02:00
|
|
|
ifeq ($(PORTNAME), win32)
|
|
|
|
shared_libpython = yes
|
2007-02-10 05:26:24 +01:00
|
|
|
python_includespec := $(subst \,/,$(python_includespec))
|
2007-02-09 16:56:00 +01:00
|
|
|
override python_libspec =
|
2004-10-06 11:20:41 +02:00
|
|
|
endif
|
|
|
|
|
2004-09-24 22:08:42 +02:00
|
|
|
# Darwin (OS X) has its own ideas about how to do this.
|
|
|
|
ifeq ($(PORTNAME), darwin)
|
|
|
|
shared_libpython = yes
|
2007-02-09 16:56:00 +01:00
|
|
|
override python_libspec = -framework Python
|
|
|
|
override python_additional_libs =
|
2004-09-24 22:08:42 +02:00
|
|
|
endif
|
|
|
|
|
2001-08-27 02:29:49 +02:00
|
|
|
# If we don't have a shared library and the platform doesn't allow it
|
|
|
|
# to work without, we have to skip it.
|
|
|
|
ifneq (,$(findstring yes, $(shared_libpython)$(allow_nonpic_in_shlib)))
|
|
|
|
|
2001-07-10 18:33:02 +02:00
|
|
|
override CPPFLAGS := -I$(srcdir) $(python_includespec) $(CPPFLAGS)
|
2004-11-19 20:23:01 +01:00
|
|
|
|
|
|
|
rpathdir = $(python_libdir)
|
2001-05-25 17:48:33 +02:00
|
|
|
|
2001-05-12 03:30:30 +02:00
|
|
|
NAME = plpython
|
|
|
|
OBJS = plpython.o
|
2001-05-09 21:54:38 +02:00
|
|
|
|
2004-10-06 11:20:41 +02:00
|
|
|
|
|
|
|
# Python on win32 ships with import libraries only for Microsoft Visual C++,
|
|
|
|
# which are not compatible with mingw gcc. Therefore we need to build a
|
|
|
|
# new import library to link with.
|
|
|
|
ifeq ($(PORTNAME), win32)
|
|
|
|
pytverstr=$(subst .,,${python_version})
|
|
|
|
OBJS += libpython${pytverstr}.a
|
|
|
|
libpython${pytverstr}.a: python${pytverstr}.def
|
|
|
|
dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a
|
|
|
|
WD=$(subst \,/,$(WINDIR))
|
|
|
|
python${pytverstr}.def: $(WD)/system32/python${pytverstr}.dll
|
|
|
|
pexports $(WD)/system32/python${pytverstr}.dll > python${pytverstr}.def
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2009-01-15 14:49:57 +01:00
|
|
|
SHLIB_LINK = $(python_libspec) $(python_additional_libs) $(filter -lintl,$(LIBS))
|
2001-05-12 19:49:32 +02:00
|
|
|
|
2005-05-17 20:26:23 +02:00
|
|
|
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plpythonu
|
2009-08-12 18:37:26 +02:00
|
|
|
REGRESS = \
|
|
|
|
plpython_schema \
|
|
|
|
plpython_populate \
|
|
|
|
plpython_test \
|
|
|
|
plpython_global \
|
|
|
|
plpython_import \
|
|
|
|
plpython_spi \
|
|
|
|
plpython_newline \
|
|
|
|
plpython_void \
|
|
|
|
plpython_params \
|
|
|
|
plpython_setof \
|
|
|
|
plpython_record \
|
|
|
|
plpython_trigger \
|
2009-08-14 15:42:16 +02:00
|
|
|
plpython_types \
|
2009-08-12 18:37:26 +02:00
|
|
|
plpython_error \
|
|
|
|
plpython_unicode \
|
|
|
|
plpython_drop
|
2006-07-21 02:24:04 +02:00
|
|
|
# where to find psql for running the tests
|
|
|
|
PSQLDIR = $(bindir)
|
2005-05-14 19:55:22 +02:00
|
|
|
|
2001-05-12 03:30:30 +02:00
|
|
|
include $(top_srcdir)/src/Makefile.shlib
|
2001-05-09 21:54:38 +02:00
|
|
|
|
|
|
|
|
2001-05-12 03:30:30 +02:00
|
|
|
all: all-lib
|
2001-05-09 21:54:38 +02:00
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
install: all installdirs install-lib
|
2001-05-09 21:54:38 +02:00
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
installdirs: installdirs-lib
|
2001-05-09 21:54:38 +02:00
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
uninstall: uninstall-lib
|
2001-05-09 21:54:38 +02:00
|
|
|
|
2005-05-14 19:55:22 +02:00
|
|
|
installcheck: submake
|
2008-10-02 10:11:11 +02:00
|
|
|
$(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir=$(PSQLDIR) $(REGRESS_OPTS) $(REGRESS)
|
2005-05-14 19:55:22 +02:00
|
|
|
|
|
|
|
.PHONY: submake
|
|
|
|
submake:
|
2006-07-19 04:37:00 +02:00
|
|
|
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
|
2005-05-14 19:55:22 +02:00
|
|
|
|
2001-05-12 03:30:30 +02:00
|
|
|
clean distclean maintainer-clean: clean-lib
|
|
|
|
rm -f $(OBJS)
|
2005-05-14 19:55:22 +02:00
|
|
|
rm -rf results
|
|
|
|
rm -f regression.diffs regression.out
|
2004-10-06 11:20:41 +02:00
|
|
|
ifeq ($(PORTNAME), win32)
|
|
|
|
rm -f python${pytverstr}.def
|
|
|
|
endif
|
2001-05-09 21:54:38 +02:00
|
|
|
|
2001-08-27 02:29:49 +02:00
|
|
|
else # can't build
|
|
|
|
|
|
|
|
all:
|
|
|
|
@echo ""; \
|
|
|
|
echo "*** Cannot build PL/Python because libpython is not a shared library." ; \
|
|
|
|
echo "*** You might have to rebuild your Python installation. Refer to"; \
|
|
|
|
echo "*** the documentation for details."; \
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
endif # can't build
|