aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/perl5/GNUmakefile
blob: 5bde2c05103edd784f965c5ea43bcdcbf387e041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# $Header: /cvsroot/pgsql/src/interfaces/perl5/Attic/GNUmakefile,v 1.8 2002/06/02 21:37:26 momjian Exp $

subdir = src/interfaces/perl5
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global

# This would allow a non-root install of the Perl module, but it's not
# quite implemented yet.
ifeq ($(mysterious_feature),yes)
perl_installsitearch	= $(pkglibdir)
perl_installsitelib	= $(pkglibdir)
perl_installman3dir	= $(mandir)/man3
endif

override CPPFLAGS := -I$(libpq_srcdir) -I$(top_srcdir)/src/include $(CPPFLAGS) -I$(perl_archlibexp)/CORE
override CFLAGS += $(CFLAGS_SL)
override CPPFLAGS += -DXS_VERSION=\"$(shell sed -n "s/\$$.*::VERSION.*=.*'\(.*\)';/\1/p" $(srcdir)/Pg.pm)\"

# The code isn't clean with regard to these warnings.
ifeq ($(GCC),yes)
override CFLAGS := $(filter-out -Wall -Wmissing-declarations -Wmissing-prototypes, $(CFLAGS))
endif

POD2MAN = pod2man


NAME = Pg
OBJS = Pg.o
SO_MAJOR_VERSION = 0
SO_MINOR_VERSION = 0
SHLIB_LINK = -L$(libpq_builddir) -lpq

include $(top_srcdir)/src/Makefile.shlib


all: all-lib Pg.pm Pg.bs auto/Pg/autosplit.ix Pg.$(perl_man3ext)

all-lib: libpq-all

.PHONY: libpq-all
libpq-all:
	$(MAKE) -C $(libpq_builddir) all

Pg.c: Pg.xs typemap
	$(PERL) $(perl_privlibexp)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap -typemap $(srcdir)/typemap $(srcdir)/Pg.xs >$@

auto/Pg/autosplit.ix: Pg.pm
	@$(mkinstalldirs) auto
	$(PERL) -MAutoSplit -e 'autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);' $< auto

Pg.bs:
	$(PERL) -MExtUtils::Mkbootstrap -e "Mkbootstrap('Pg', '');"
	touch $@

Pg.$(perl_man3ext): Pg.pm
	$(POD2MAN) --section=$(perl_man3ext) $< > Pg.$(perl_man3ext)


# During install, we must guard against the likelihood that we don't
# have permissions to install into the Perl module library.  It's not
# exactly fun to have to scan the build output, but...

install-warning-msg := { \
echo ""; \
echo "*** Skipping the installation of the Perl module for lack"; \
echo "*** of permissions.  To install it, change to the directory"; \
echo "***     `pwd`,"; \
echo "*** become the appropriate user, and enter '$(MAKE) install'."; \
echo ""; }

install: all installdirs
	@if test -w $(DESTDIR)$(perl_installsitearch); then \
	  $(INSTALL_DATA) Pg.pm $(DESTDIR)$(perl_installsitearch); \
	  $(INSTALL_DATA) Pg.bs $(DESTDIR)$(perl_installsitearch)/auto/Pg; \
	  $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(perl_installsitearch)/auto/Pg/Pg$(DLSUFFIX); \
	  $(INSTALL_DATA) auto/Pg/autosplit.ix $(DESTDIR)$(perl_installsitearch)/auto/Pg; \
	  $(INSTALL_DATA) $(srcdir)/Pg.$(perl_man3ext) $(DESTDIR)$(perl_installman3dir); \
	else \
	  $(install-warning-msg); \
	fi

installdirs:
	-$(mkinstalldirs) $(DESTDIR)$(perl_installsitearch)/auto/Pg $(DESTDIR)$(perl_installman3dir)

uninstall:
	rm -f $(addprefix $(DESTDIR)$(perl_installsitearch)/, Pg.pm auto/Pg/Pg.bs auto/Pg/Pg$(DLSUFFIX) auto/Pg/autosplit.ix) $(DESTDIR)$(perl_installman3dir)/Pg.$(perl_man3ext)


clean distclean maintainer-clean: clean-lib
	rm -f $(OBJS) Pg.c Pg.bs Pg.$(perl_man3ext)
	rm -rf auto