| 1 |
# src/pl/plpython/Makefile |
| 2 |
|
| 3 |
subdir = src/pl/plpython |
| 4 |
top_builddir = ../../.. |
| 5 |
include $(top_builddir)/src/Makefile.global |
| 6 |
|
| 7 |
|
| 8 |
# On Windows we have to remove -lpython from the link since we are |
| 9 |
# building our own |
| 10 |
ifeq ($(PORTNAME), win32) |
| 11 |
override python_libspec = |
| 12 |
endif |
| 13 |
|
| 14 |
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(python_includespec) |
| 15 |
|
| 16 |
rpathdir = $(python_libdir) |
| 17 |
|
| 18 |
PGFILEDESC = "PL/Python - procedural language" |
| 19 |
|
| 20 |
NAME = plpython$(python_majorversion) |
| 21 |
|
| 22 |
OBJS = \ |
| 23 |
$(WIN32RES) \ |
| 24 |
plpy_cursorobject.o \ |
| 25 |
plpy_elog.o \ |
| 26 |
plpy_exec.o \ |
| 27 |
plpy_main.o \ |
| 28 |
plpy_planobject.o \ |
| 29 |
plpy_plpymodule.o \ |
| 30 |
plpy_procedure.o \ |
| 31 |
plpy_resultobject.o \ |
| 32 |
plpy_spi.o \ |
| 33 |
plpy_subxactobject.o \ |
| 34 |
plpy_typeio.o \ |
| 35 |
plpy_util.o |
| 36 |
|
| 37 |
DATA = $(NAME)u.control $(NAME)u--1.0.sql |
| 38 |
|
| 39 |
# header files to install - it's not clear which of these might be needed |
| 40 |
# so install them all. |
| 41 |
INCS = plpython.h \ |
| 42 |
plpython_system.h \ |
| 43 |
plpy_cursorobject.h \ |
| 44 |
plpy_elog.h \ |
| 45 |
plpy_exec.h \ |
| 46 |
plpy_main.h \ |
| 47 |
plpy_planobject.h \ |
| 48 |
plpy_plpymodule.h \ |
| 49 |
plpy_procedure.h \ |
| 50 |
plpy_resultobject.h \ |
| 51 |
plpy_spi.h \ |
| 52 |
plpy_subxactobject.h \ |
| 53 |
plpy_typeio.h \ |
| 54 |
plpy_util.h |
| 55 |
|
| 56 |
# Python on win32 ships with import libraries only for Microsoft Visual C++, |
| 57 |
# which are not compatible with mingw gcc. Therefore we need to build a |
| 58 |
# new import library to link with. |
| 59 |
ifeq ($(PORTNAME), win32) |
| 60 |
|
| 61 |
pytverstr=$(subst .,,${python_version}) |
| 62 |
PYTHONDLL=$(subst \,/,$(WINDIR))/system32/python${pytverstr}.dll |
| 63 |
|
| 64 |
OBJS += libpython${pytverstr}.a |
| 65 |
|
| 66 |
libpython${pytverstr}.a: python${pytverstr}.def |
| 67 |
dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a |
| 68 |
|
| 69 |
python${pytverstr}.def: |
| 70 |
gendef - $(PYTHONDLL) > $@ |
| 71 |
|
| 72 |
endif # win32 |
| 73 |
|
| 74 |
|
| 75 |
SHLIB_LINK = $(python_libspec) $(python_additional_libs) $(filter -lintl,$(LIBS)) |
| 76 |
|
| 77 |
REGRESS_OPTS = --dbname=$(PL_TESTDB) |
| 78 |
|
| 79 |
REGRESS = \ |
| 80 |
plpython_schema \ |
| 81 |
plpython_populate \ |
| 82 |
plpython_test \ |
| 83 |
plpython_do \ |
| 84 |
plpython_global \ |
| 85 |
plpython_import \ |
| 86 |
plpython_spi \ |
| 87 |
plpython_newline \ |
| 88 |
plpython_void \ |
| 89 |
plpython_call \ |
| 90 |
plpython_params \ |
| 91 |
plpython_setof \ |
| 92 |
plpython_record \ |
| 93 |
plpython_trigger \ |
| 94 |
plpython_types \ |
| 95 |
plpython_error \ |
| 96 |
plpython_ereport \ |
| 97 |
plpython_unicode \ |
| 98 |
plpython_quote \ |
| 99 |
plpython_composite \ |
| 100 |
plpython_subtransaction \ |
| 101 |
plpython_transaction \ |
| 102 |
plpython_drop |
| 103 |
|
| 104 |
include $(top_srcdir)/src/Makefile.shlib |
| 105 |
|
| 106 |
all: all-lib |
| 107 |
|
| 108 |
# Ensure parallel safety if a build is started in this directory |
| 109 |
$(OBJS): | submake-generated-headers |
| 110 |
|
| 111 |
install: all install-lib install-data |
| 112 |
|
| 113 |
installdirs: installdirs-lib |
| 114 |
$(MKDIR_P) '$(DESTDIR)$(datadir)/extension' '$(DESTDIR)$(includedir_server)' |
| 115 |
|
| 116 |
uninstall: uninstall-lib uninstall-data |
| 117 |
|
| 118 |
install-data: installdirs |
| 119 |
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/' |
| 120 |
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(INCS)) '$(DESTDIR)$(includedir_server)' |
| 121 |
|
| 122 |
uninstall-data: |
| 123 |
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA))) |
| 124 |
rm -f $(addprefix '$(DESTDIR)$(includedir_server)'/, $(INCS)) |
| 125 |
|
| 126 |
.PHONY: install-data uninstall-data |
| 127 |
|
| 128 |
|
| 129 |
check: submake-pg-regress |
| 130 |
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS) |
| 131 |
|
| 132 |
installcheck: submake-pg-regress |
| 133 |
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS) |
| 134 |
|
| 135 |
|
| 136 |
.PHONY: submake-pg-regress |
| 137 |
submake-pg-regress: | submake-generated-headers |
| 138 |
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X) |
| 139 |
|
| 140 |
clean distclean: clean-lib |
| 141 |
rm -f $(OBJS) |
| 142 |
rm -rf $(pg_regress_clean_files) |
| 143 |
ifeq ($(PORTNAME), win32) |
| 144 |
rm -f python${pytverstr}.def |
| 145 |
endif |
| 146 |
rm -f spiexceptions.h |
| 147 |
|
| 148 |
|
| 149 |
# Force this dependency to be known even without dependency info built: |
| 150 |
plpy_plpymodule.o: spiexceptions.h |
| 151 |
|
| 152 |
spiexceptions.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-spiexceptions.pl |
| 153 |
$(PERL) $(srcdir)/generate-spiexceptions.pl $< > $@ |