1# Makefile for PL/Perl 2# src/pl/plperl/GNUmakefile 3 4subdir = src/pl/plperl 5top_builddir = ../../.. 6include $(top_builddir)/src/Makefile.global 7 8ifeq ($(PORTNAME), win32) 9override CPPFLAGS += -DPLPERL_HAVE_UID_GID 10# Perl on win32 contains /* within comment all over the header file, 11# so disable this warning. 12override CPPFLAGS += -Wno-comment 13endif 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. 19override 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 22rpathdir = $(perl_archlibexp)/CORE 23 24PGFILEDESC = "PL/Perl - procedural language" 25 26NAME = plperl 27 28OBJS = plperl.o SPI.o Util.o $(WIN32RES) 29 30DATA = plperl.control plperl--1.0.sql plperl--unpackaged--1.0.sql \ 31 plperlu.control plperlu--1.0.sql plperlu--unpackaged--1.0.sql 32 33PERLCHUNKS = 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. 38ifeq ($(PORTNAME), win32) 39 40perlwithver := $(subst -l,,$(filter -l%, $(perl_embed_ldflags))) 41PERLDLL := $(dir $(subst ',,$(PERL)))$(perlwithver).dll 42# we no longer want to include the original -l spec in SHLIB_LINK 43override perl_embed_ldflags := 44 45OBJS += lib$(perlwithver).a 46 47lib$(perlwithver).a: $(perlwithver).def 48 dlltool --dllname $(perlwithver).dll --def $(perlwithver).def --output-lib lib$(perlwithver).a 49 50$(perlwithver).def: $(PERLDLL) 51 pexports $^ > $@ 52 53endif # win32 54 55 56SHLIB_LINK = $(perl_embed_ldflags) 57 58REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=plperl --load-extension=plperlu 59REGRESS = plperl plperl_lc plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu plperl_array plperl_call plperl_transaction 60# if Perl can support two interpreters in one backend, 61# test plperl-and-plperlu cases 62ifneq ($(PERL),) 63ifeq ($(shell $(PERL) -V:usemultiplicity), usemultiplicity='define';) 64 REGRESS += plperl_plperlu 65endif 66endif 67 68# where to find xsubpp for building XS. 69XSUBPPDIR = $(shell $(PERL) -e 'use List::Util qw(first); print first { -r "$$_/ExtUtils/xsubpp" } @INC') 70 71include $(top_srcdir)/src/Makefile.shlib 72 73plperl.o: perlchunks.h plperl_opmask.h plperl_helpers.h 74 75plperl_opmask.h: plperl_opmask.pl 76 @if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi 77 $(PERL) $< $@ 78 79perlchunks.h: $(PERLCHUNKS) 80 @if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi 81 $(PERL) $(srcdir)/text2macro.pl --strip='^(\#.*|\s*)$$' $^ > $@ 82 83all: all-lib 84 85%.c: %.xs 86 @if [ x"$(perl_privlibexp)" = x"" ]; then echo "configure switch --with-perl was not specified."; exit 1; fi 87# xsubpp -output option is required for coverage+vpath, but requires Perl 5.9.3 88ifeq ($(enable_coverage)$(vpath_build),yesyes) 89 $(PERL) $(XSUBPPDIR)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap -output $@ $< 90else 91 $(PERL) $(XSUBPPDIR)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap $< >$@ 92endif 93 94 95install: all install-lib install-data 96 97installdirs: installdirs-lib 98 $(MKDIR_P) '$(DESTDIR)$(datadir)/extension' '$(DESTDIR)$(includedir_server)' 99 100uninstall: uninstall-lib uninstall-data 101 102install-data: installdirs 103 $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/' 104 $(INSTALL_DATA) $(srcdir)/plperl.h $(srcdir)/ppport.h $(srcdir)/plperl_helpers.h '$(DESTDIR)$(includedir_server)' 105 106uninstall-data: 107 rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA))) 108 rm -f $(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.h ppport.h) 109 110.PHONY: install-data uninstall-data 111 112 113check: submake 114 $(pg_regress_check) $(REGRESS_OPTS) $(REGRESS) 115 116installcheck: submake 117 $(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS) 118 119.PHONY: submake 120submake: 121 $(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X) 122 123clean distclean maintainer-clean: clean-lib 124 rm -f SPI.c Util.c $(OBJS) perlchunks.h plperl_opmask.h 125 rm -rf $(pg_regress_clean_files) 126ifeq ($(PORTNAME), win32) 127 rm -f $(perlwithver).def 128endif 129