1
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.18 2004-11-19 19:23:01 tgl Exp $
3
subdir = src/pl/plpython
4
top_builddir = ../../..
5
include $(top_builddir)/src/Makefile.global
8
# On some platforms we can only build PL/Python if libpython is a
9
# shared library. Since there is no official way to determine this
10
# (at least not in pre-2.3 Python), we see if there is a file that is
11
# named like a shared library.
12
ifneq (,$(wildcard $(python_libdir)/libpython*$(DLSUFFIX)*))
13
shared_libpython = yes
16
# Windows needs to convert backslashed paths to normal slashes,
17
# and we have to remove -lpython from the link since we are building our own
18
ifeq ($(PORTNAME), win32)
19
shared_libpython = yes
20
python_includespec := $(subst \,/,$(python_includespec))
21
override python_libspec :=
24
# Darwin (OS X) has its own ideas about how to do this.
25
ifeq ($(PORTNAME), darwin)
26
shared_libpython = yes
27
override python_libspec := -framework Python
28
override python_additional_libs :=
31
# If we don't have a shared library and the platform doesn't allow it
32
# to work without, we have to skip it.
33
ifneq (,$(findstring yes, $(shared_libpython)$(allow_nonpic_in_shlib)))
35
override CPPFLAGS := -I$(srcdir) $(python_includespec) $(CPPFLAGS)
37
rpathdir = $(python_libdir)
45
# Python on win32 ships with import libraries only for Microsoft Visual C++,
46
# which are not compatible with mingw gcc. Therefore we need to build a
47
# new import library to link with.
48
ifeq ($(PORTNAME), win32)
49
pytverstr=$(subst .,,${python_version})
50
OBJS += libpython${pytverstr}.a
51
libpython${pytverstr}.a: python${pytverstr}.def
52
dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a
53
WD=$(subst \,/,$(WINDIR))
54
python${pytverstr}.def: $(WD)/system32/python${pytverstr}.dll
55
pexports $(WD)/system32/python${pytverstr}.dll > python${pytverstr}.def
59
SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) $(python_additional_libs)
61
include $(top_srcdir)/src/Makefile.shlib
66
install: all installdirs
67
ifeq ($(enable_shared), yes)
68
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)
71
echo "* PL/Python was not installed due to lack of shared library support."; \
76
$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
79
rm -f $(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)
81
clean distclean maintainer-clean: clean-lib
83
@rm -f error.diff feature.diff error.output feature.output test.log
84
ifeq ($(PORTNAME), win32)
85
rm -f python${pytverstr}.def
89
PATH=$(bindir):$$PATH $(SHELL) $(srcdir)/test.sh
95
echo "*** Cannot build PL/Python because libpython is not a shared library." ; \
96
echo "*** You might have to rebuild your Python installation. Refer to"; \
97
echo "*** the documentation for details."; \