~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/pl/plpython/Makefile

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.18 2004-11-19 19:23:01 tgl Exp $
 
2
 
 
3
subdir = src/pl/plpython
 
4
top_builddir = ../../..
 
5
include $(top_builddir)/src/Makefile.global
 
6
 
 
7
 
 
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
 
15
 
 
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
 
23
 
 
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
 
30
 
 
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)))
 
34
 
 
35
override CPPFLAGS := -I$(srcdir) $(python_includespec) $(CPPFLAGS)
 
36
 
 
37
rpathdir = $(python_libdir)
 
38
 
 
39
NAME = plpython
 
40
SO_MAJOR_VERSION = 0
 
41
SO_MINOR_VERSION = 0
 
42
OBJS = plpython.o
 
43
 
 
44
 
 
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
 
56
endif
 
57
 
 
58
 
 
59
SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) $(python_additional_libs)
 
60
 
 
61
include $(top_srcdir)/src/Makefile.shlib
 
62
 
 
63
 
 
64
all: all-lib
 
65
 
 
66
install: all installdirs
 
67
ifeq ($(enable_shared), yes)
 
68
        $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)
 
69
else
 
70
        @echo "*****"; \
 
71
         echo "* PL/Python was not installed due to lack of shared library support."; \
 
72
         echo "*****"
 
73
endif
 
74
 
 
75
installdirs:
 
76
        $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
 
77
 
 
78
uninstall:
 
79
        rm -f $(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)
 
80
 
 
81
clean distclean maintainer-clean: clean-lib
 
82
        rm -f $(OBJS)
 
83
        @rm -f error.diff feature.diff error.output feature.output test.log
 
84
ifeq ($(PORTNAME), win32)
 
85
        rm -f python${pytverstr}.def
 
86
endif
 
87
 
 
88
installcheck:
 
89
        PATH=$(bindir):$$PATH $(SHELL) $(srcdir)/test.sh
 
90
 
 
91
else # can't build
 
92
 
 
93
all:
 
94
        @echo ""; \
 
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."; \
 
98
         echo ""
 
99
 
 
100
endif # can't build