| 1 |
# Makefile for PL/Perl |
| 2 |
# src/pl/plperl/GNUmakefile |
| 3 |
|
| 4 |
subdir = src/pl/plperl |
| 5 |
top_builddir = ../../.. |
| 6 |
include $(top_builddir)/src/Makefile.global |
| 7 |
|
| 8 |
ifeq ($(PORTNAME), win32) |
| 9 |
override CPPFLAGS += -DPLPERL_HAVE_UID_GID |
| 10 |
# Perl on win32 contains /* within comment all over the header file, |
| 11 |
# so disable this warning. |
| 12 |
override CPPFLAGS += -Wno-comment |
| 13 |
endif |
| 14 |
|
| 15 |
# Note: we need to include the perl_includespec directory last, |
| 16 |
# probably because it sometimes contains some header files with names |
| 17 |
# that clash with some of ours, or with some that we include, notably on |
| 18 |
# Windows. |
| 19 |
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) $(perl_includespec) |
| 20 |
|
| 21 |
# this is often, but not always, the same directory named by perl_includespec |
| 22 |
rpathdir = $(perl_archlibexp)/CORE |
| 23 |
|
| 24 |
PGFILEDESC = "PL/Perl - procedural language" |
| 25 |
|
| 26 |
NAME = plperl |
| 27 |
|
| 28 |
OBJS = plperl.o SPI.o Util.o $(WIN32RES) |
| 29 |
|
| 30 |
DATA = plperl.control plperl--1.0.sql \ |
| 31 |
plperlu.control plperlu--1.0.sql |
| 32 |
|
| 33 |
PERLCHUNKS = plc_perlboot.pl plc_trusted.pl |
| 34 |
|
| 35 |
# Perl on win32 ships with import libraries only for Microsoft Visual C++, |
| 36 |
# which are not compatible with mingw gcc. Therefore we need to build a |
| 37 |
# new import library to link with. |
| 38 |
ifeq ($(PORTNAME), win32) |
| 39 |
|
| 40 |
perlwithver := $(subst -l,,$(filter -l%, $(perl_embed_ldflags))) |
| 41 |
PERLDLL := $(dir $(subst ',,$(PERL)))$(perlwithver).dll |
| 42 |
# we no longer want to include the original -l spec in SHLIB_LINK |
| 43 |
override perl_embed_ldflags := |
| 44 |
|
| 45 |
OBJS += lib$(perlwithver).a |
| 46 |
|
| 47 |
lib$(perlwithver).a: $(perlwithver).def |
| 48 |
dlltool --dllname $(perlwithver).dll --def $(perlwithver).def --output-lib lib$(perlwithver).a |
| 49 |
|
| 50 |
$(perlwithver).def: $(PERLDLL) |
| 51 |
gendef - $^ > $@ |
| 52 |
|
| 53 |
endif # win32 |
| 54 |
|
| 55 |
|
| 56 |
SHLIB_LINK = $(perl_embed_ldflags) |
| 57 |
|
| 58 |
# see https://www.postgresql.org/message-id/flat/8c4fcb72-2574-ff7c-4c25-1f032d4a2a57%40enterprisedb.com |
| 59 |
ifeq ($(PORTNAME), cygwin) |
| 60 |
SHLIB_LINK += -Wl,--export-all-symbols |
| 61 |
endif |
| 62 |
|
| 63 |
REGRESS_OPTS = --dbname=$(PL_TESTDB) --dlpath=$(top_builddir)/src/test/regress |
| 64 |
REGRESS = plperl_setup plperl plperl_lc plperl_trigger plperl_shared \ |
| 65 |
plperl_elog plperl_unicode plperl_util plperl_init plperlu plperl_array \ |
| 66 |
plperl_call plperl_transaction plperl_env |
| 67 |
# if Perl can support two interpreters in one backend, |
| 68 |
# test plperl-and-plperlu cases |
| 69 |
ifneq ($(PERL),) |
| 70 |
ifeq ($(shell $(PERL) -V:usemultiplicity), usemultiplicity='define';) |
| 71 |
REGRESS += plperl_plperlu |
| 72 |
endif |
| 73 |
endif |
| 74 |
|
| 75 |
# where to find xsubpp for building XS. |
| 76 |
XSUBPPDIR = $(shell $(PERL) -e 'use List::Util qw(first); print first { -r "$$_/ExtUtils/xsubpp" } @INC') |
| 77 |
|
| 78 |
include $(top_srcdir)/src/Makefile.shlib |
| 79 |
|
| 80 |
plperl.o: perlchunks.h plperl_opmask.h |
| 81 |
|
| 82 |
plperl_opmask.h: plperl_opmask.pl |
| 83 |
@if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi |
| 84 |
$(PERL) $< $@ |
| 85 |
|
| 86 |
perlchunks.h: $(PERLCHUNKS) |
| 87 |
@if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi |
| 88 |
$(PERL) $(srcdir)/text2macro.pl $^ > $@ |
| 89 |
|
| 90 |
all: all-lib |
| 91 |
|
| 92 |
%.c: %.xs |
| 93 |
@if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi |
| 94 |
# xsubpp -output option is required for coverage+vpath, but requires Perl 5.9.3 |
| 95 |
ifeq ($(enable_coverage)$(vpath_build),yesyes) |
| 96 |
$(PERL) $(XSUBPPDIR)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap -output $@ $< |
| 97 |
else |
| 98 |
$(PERL) $(XSUBPPDIR)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap $< >$@ |
| 99 |
endif |
| 100 |
|
| 101 |
|
| 102 |
install: all install-lib install-data |
| 103 |
|
| 104 |
installdirs: installdirs-lib |
| 105 |
$(MKDIR_P) '$(DESTDIR)$(datadir)/extension' '$(DESTDIR)$(includedir_server)' |
| 106 |
|
| 107 |
uninstall: uninstall-lib uninstall-data |
| 108 |
|
| 109 |
install-data: installdirs |
| 110 |
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/' |
| 111 |
$(INSTALL_DATA) $(srcdir)/plperl.h $(srcdir)/plperl_system.h $(srcdir)/ppport.h '$(DESTDIR)$(includedir_server)' |
| 112 |
|
| 113 |
uninstall-data: |
| 114 |
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA))) |
| 115 |
rm -f $(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.h plperl_system.h ppport.h) |
| 116 |
|
| 117 |
.PHONY: install-data uninstall-data |
| 118 |
|
| 119 |
|
| 120 |
check: submake |
| 121 |
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS) |
| 122 |
|
| 123 |
installcheck: submake |
| 124 |
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS) |
| 125 |
|
| 126 |
.PHONY: submake |
| 127 |
submake: |
| 128 |
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X) |
| 129 |
|
| 130 |
clean distclean: clean-lib |
| 131 |
rm -f SPI.c Util.c $(OBJS) perlchunks.h plperl_opmask.h |
| 132 |
rm -rf $(pg_regress_clean_files) |
| 133 |
ifeq ($(PORTNAME), win32) |
| 134 |
rm -f $(perlwithver).def |
| 135 |
endif |