|
| 1 | +# $Header: /cvsroot/pgsql/src/pl/plpython/Makefile,v 1.4 2001/05/12 01:30:30 petere Exp $ |
1 | 2 |
|
2 |
| -# cflags. pick your favorite |
3 |
| -# |
4 |
| -CC=gcc |
5 |
| -CFLAGS=-g -O0 -Wall -Wmissing-declarations -fPIC |
| 3 | +subdir = src/pl/plpython |
| 4 | +top_builddir = ../../.. |
| 5 | +include $(top_builddir)/src/Makefile.global |
6 | 6 |
|
7 |
| -# build info for python, alter as needed |
8 |
| -# |
| 7 | +# These things ought to go into $(top_srcdir)/config/python.m4 sometime. |
9 | 8 |
|
10 |
| -# python headers |
11 |
| -# |
12 |
| -#INCPYTHON=/usr/include/python1.5 |
13 |
| -INCPYTHON=/usr/include/python2.0 |
| 9 | +PYTHON_VERSION := $(shell $(PYTHON) -c 'import sys; print sys.version[:3]') |
| 10 | +PYTHON_INCLUDE := $(shell $(PYTHON) -c 'import sys; print sys.prefix')/include/python$(PYTHON_VERSION) |
14 | 11 |
|
15 |
| -# python shared library |
16 |
| -# |
17 |
| -#LIBPYTHON=python1.5 |
18 |
| -LIBPYTHON=python2.0 |
| 12 | +override CPPFLAGS := -I$(srcdir) -I$(PYTHON_INCLUDE) $(CPPFLAGS) |
19 | 13 |
|
20 |
| -# if python is someplace odd |
21 |
| -# |
22 |
| -LIBPYTHONPATH=/usr/lib |
| 14 | +PYTHON_LIB := $(shell $(PYTHON) -c 'import sys; print sys.exec_prefix')/lib/python$(PYTHON_VERSION) |
23 | 15 |
|
24 |
| -# python 2 seems to want libdb |
25 |
| -# various db libs are still messed on my system |
26 |
| -# |
27 |
| -#LIBPYTHONEXTRA=/usr/lib/libdb2.so.2.7.7 |
28 |
| -#LIBPYTHONEXTRA=-ldb2 |
| 16 | +NAME = plpython |
| 17 | +SO_MAJOR_VERSION = 0 |
| 18 | +SO_MINOR_VERSION = 0 |
| 19 | +OBJS = plpython.o |
29 | 20 |
|
30 |
| -LDPYTHON=-L$(LIBPYTHONPATH) -l$(LIBPYTHON) $(LIBPYTHONEXTRA) |
| 21 | +# This static version might work on most ELF systems... |
| 22 | +SHLIB_LINK += $(PYTHON_LIB)/config/libpython$(PYTHON_VERSION).a |
| 23 | +# ...otherwise you need a shared version, but you need to build that yourself. |
| 24 | +#SHLIB_LINK += -lpython$(PYTHON_VERSION) |
31 | 25 |
|
32 |
| -# build info for postgres |
33 |
| -# |
| 26 | +# Python uses this. Should become a configure check. |
| 27 | +SHLIB_LINK += -lpthread |
34 | 28 |
|
35 |
| -# postgres headers. the installed include directory doesn't work for me |
36 |
| -# |
37 |
| -#INCPOSTGRES=/usr/include/postgres |
38 |
| -INCPOSTGRES=/home/andrew/builds/postgresql/src/include |
| 29 | +# Python 2 seems to want libdb. |
| 30 | +#SHLIB_LINK += -ldb2 |
39 | 31 |
|
40 |
| -# hopefully you won't need this utter crap... |
41 |
| -# but if you can't patch the appropriate dynloader file, try this. you |
42 |
| -# may have to add other modules. |
43 |
| -# |
44 |
| -#DLDIR=/usr/lib/python1.5/lib-dynload |
45 |
| -#DLHACK=$(DLDIR)/arraymodule.so $(DLDIR)/timemodule.so $(DLDIR)/cmathmodule.so $(DLDIR)/errnomodule.so $(DLDIR)/mathmodule.so $(DLDIR)/md5module.so $(DLDIR)/operator.so |
46 |
| -# $(DLDIR)/shamodule.so |
47 | 32 |
|
48 |
| -# shouldn't need to alter anything below here |
| 33 | +# Hopefully you won't need this utter crap. But if you can't patch |
| 34 | +# the appropriate dynloader file, try this. You may have to add other |
| 35 | +# modules. |
49 | 36 | #
|
50 |
| -INCLUDES=-I$(INCPYTHON) -I$(INCPOSTGRES) -I./ |
| 37 | +#DLDIR=$(PYTHON_LIB)/lib-dynload |
| 38 | +#DLHACK=$(DLDIR)/arraymodule.so $(DLDIR)/timemodule.so $(DLDIR)/cmathmodule.so $(DLDIR)/errnomodule.so $(DLDIR)/mathmodule.so $(DLDIR)/md5module.so $(DLDIR)/operator.so $(DLDIR)/shamodule.so |
| 39 | +#SHLIB_LINK += $(DLDIR) |
| 40 | + |
| 41 | +include $(top_srcdir)/src/Makefile.shlib |
51 | 42 |
|
52 |
| -# dynamic linker flags. |
53 |
| -# |
54 |
| -#LDFLAGS=--shared -Wl,-Bshareable -Wl,-E -Wl,-soname,$@ |
55 |
| -LDFLAGS=--shared -Wl,-E -Wl,-soname,$@ |
56 | 43 |
|
57 |
| -.PHONY: clean |
| 44 | +all: all-lib |
58 | 45 |
|
59 |
| -all: plpython.so |
| 46 | +install: all installdirs |
| 47 | + $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(libdir)/plpython$(DLSUFFIX) |
60 | 48 |
|
61 |
| -plpython.o: plpython.c plpython.h |
62 |
| - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< |
| 49 | +installdirs: |
| 50 | + $(mkinstalldirs) $(DESTDIR)$(libdir) |
63 | 51 |
|
64 |
| -plpython.so: plpython.o |
65 |
| - $(CC) $(LDFLAGS) -o $@ $^ $(LDPYTHON) $(DLHACK) -ldl -lpthread -lm |
| 52 | +uninstall: |
| 53 | + rm -f $(DESTDIR)$(libdir)/plpython$(DLSUFFIX) |
66 | 54 |
|
67 |
| -clean: |
68 |
| - rm -f plpython.so *.o |
| 55 | +clean distclean maintainer-clean: clean-lib |
| 56 | + rm -f $(OBJS) |
| 57 | + @rm -f error.diff feature.diff error.output feature.output test.log |
69 | 58 |
|
| 59 | +installcheck: |
| 60 | + PATH=$(bindir):$$PATH $(SHELL) $(srcdir)/test.sh |
0 commit comments