Fix obsolete comment regarding FSM truncation.
[PostgreSQL.git] / src / pl / plpython / Makefile
blob8682763a5c1a3eb294aaeb8b8fdad05f9e8753fe
1 # $PostgreSQL$
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
14 endif
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 =
22 endif
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 =
29 endif
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)
39 NAME = plpython
40 OBJS = plpython.o
43 # Python on win32 ships with import libraries only for Microsoft Visual C++,
44 # which are not compatible with mingw gcc. Therefore we need to build a
45 # new import library to link with.
46 ifeq ($(PORTNAME), win32)
47 pytverstr=$(subst .,,${python_version})
48 OBJS += libpython${pytverstr}.a
49 libpython${pytverstr}.a: python${pytverstr}.def
50 dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a
51 WD=$(subst \,/,$(WINDIR))
52 python${pytverstr}.def: $(WD)/system32/python${pytverstr}.dll
53 pexports $(WD)/system32/python${pytverstr}.dll > python${pytverstr}.def
54 endif
57 SHLIB_LINK = $(python_libspec) $(python_additional_libs)
59 REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plpythonu
60 REGRESS = plpython_schema plpython_populate plpython_function plpython_test plpython_error plpython_drop
61 # where to find psql for running the tests
62 PSQLDIR = $(bindir)
64 include $(top_srcdir)/src/Makefile.shlib
67 all: all-lib
69 install: all installdirs install-lib
71 installdirs: installdirs-lib
73 uninstall: uninstall-lib
75 installcheck: submake
76 $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir=$(PSQLDIR) $(REGRESS_OPTS) $(REGRESS)
78 .PHONY: submake
79 submake:
80 $(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
82 clean distclean maintainer-clean: clean-lib
83 rm -f $(OBJS)
84 rm -rf results
85 rm -f regression.diffs regression.out
86 ifeq ($(PORTNAME), win32)
87 rm -f python${pytverstr}.def
88 endif
90 else # can't build
92 all:
93 @echo ""; \
94 echo "*** Cannot build PL/Python because libpython is not a shared library." ; \
95 echo "*** You might have to rebuild your Python installation. Refer to"; \
96 echo "*** the documentation for details."; \
97 echo ""
99 endif # can't build