]> granicus.if.org Git - postgresql/blob - src/pl/plperl/GNUmakefile
1831f9ddf8a7c4da056c95e2e5048d807b272722
[postgresql] / src / pl / plperl / GNUmakefile
1 # Makefile for PL/Perl
2 # $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.26 2005/12/09 21:19:36 petere Exp $
3
4 subdir = src/pl/plperl
5 top_builddir = ../../..
6 include $(top_builddir)/src/Makefile.global
7
8 ifeq ($(perl_useshrplib),true)
9 shared_libperl = yes
10 endif
11 ifeq ($(perl_useshrplib),yes)
12 shared_libperl = yes
13 endif
14
15 # If we don't have a shared library and the platform doesn't allow it
16 # to work without, we have to skip it.
17 ifneq (,$(findstring yes, $(shared_libperl)$(allow_nonpic_in_shlib)))
18
19 ifeq ($(PORTNAME), win32)
20 perl_archlibexp := $(subst \,/,$(perl_archlibexp))
21 perl_privlibexp := $(subst \,/,$(perl_privlibexp))
22 perl_embed_ldflags := -L$(perl_archlibexp)/CORE -lperl58
23 override CPPFLAGS += -DPLPERL_HAVE_UID_GID
24 endif
25
26 override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE
27
28 rpathdir = $(perl_archlibexp)/CORE
29
30
31 NAME = plperl
32 SO_MAJOR_VERSION = 0
33 SO_MINOR_VERSION = 0
34
35 OBJS = plperl.o spi_internal.o SPI.o
36
37 SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
38
39 REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plperl
40 REGRESS = plperl plperl_trigger plperl_shared plperl_elog
41
42 include $(top_srcdir)/src/Makefile.shlib
43
44
45 all: all-lib
46
47 SPI.c: SPI.xs
48         $(PERL) $(perl_privlibexp)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap $< >$@
49
50 # When doing a VPATH build, copy over the .sql and .out files so that the
51 # test script can find them.  See comments in src/test/regress/GNUmakefile.
52 ifdef VPATH
53
54 ifneq ($(PORTNAME),win32)
55 abs_srcdir := $(shell cd $(srcdir) && pwd)
56 abs_builddir := $(shell pwd)
57 else
58 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
59 abs_builddir := $(shell pwd -W)
60 endif
61
62 test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out)
63 test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
64
65 all: $(test_files_build)
66 $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
67         ln -s $< $@
68
69 endif
70
71 install: all installdirs
72 ifeq ($(enable_shared), yes)
73         $(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
74 else
75         @echo "*****"; \
76          echo "* PL/Perl was not installed due to lack of shared library support."; \
77          echo "*****"
78 endif
79
80 installdirs:
81         $(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
82
83 uninstall:
84         rm -f '$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
85
86 installcheck: submake
87         $(SHELL) $(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
88
89 .PHONY: submake
90 submake:
91         $(MAKE) -C $(top_builddir)/src/test/regress pg_regress
92
93 clean distclean maintainer-clean: clean-lib
94         rm -f SPI.c $(OBJS)
95         rm -rf results
96         rm -f regression.diffs regression.out
97
98 else # can't build
99
100 all:
101         @echo ""; \
102          echo "*** Cannot build PL/Perl because libperl is not a shared library."; \
103          echo "*** You might have to rebuild your Perl installation.  Refer to"; \
104          echo "*** the documentation for details."; \
105          echo ""
106
107 endif # can't build