1
+ use ExtUtils::MakeMaker;
2
+ use ExtUtils::Embed;
1
3
use DynaLoader;
2
4
use Config;
3
- use ExtUtils::Embed;
4
-
5
- #
6
- # massage the ld options
7
- #
8
- my $ldopts = ldopts();
9
- chomp ($ldopts );
10
5
11
6
#
12
7
# get the location of the Opcode module
@@ -30,91 +25,29 @@ my $opcode = '';
30
25
31
26
}
32
27
33
- open (MAKEFILE, " >Makefile" );
34
-
35
- print MAKEFILE <<_STATIC_ ;
36
- #-------------------------------------------------------------------------
37
- #
38
- # Makefile
39
- # Makefile for the plperl shared object
40
- #
41
- # AUTOGENERATED Makefile.pl
42
- #
43
-
44
- #
45
- # Tell make where the postgresql sources live
46
- #
47
- SRCDIR= ../../../src
48
- include \$ (SRCDIR)/Makefile.global
49
-
50
- EXTDIR= $Config {privlib}/ExtUtils
51
-
52
- XSUBPP= \$ (EXTDIR)/xsubpp
53
-
54
- TYPEMAP= -typemap \$ (EXTDIR)/typemap
55
-
56
- # use the same compiler as perl did
57
- CC= $Config {cc}
58
-
59
- # use the same compiler options as perl did, too
60
- CFLAGS= @{[ccopts()]}
61
- # including the ones for dynamic loading
62
- CFLAGS+= $Config {cccdlflags}
63
-
64
- # now add the includes for postgreSQL
65
- CFLAGS+= -I\$ (LIBPQDIR) -I\$ (SRCDIR)/include -I\$ (SRCDIR)/backend
28
+ WriteMakefile( ' NAME' => ' plperl' ,
29
+ dynamic_lib => { ' OTHERLDFLAGS' => " $opcode -L\$ (LIBPQDIR) -lpq @{[ldopts()]}" } ,
30
+ INC => ' -I$(LIBPQDIR) -I$(SRCDIR)/include -I$(SRCDIR)/backend' ,
31
+ XS => { ' SPI.xs' => ' SPI.c' },
32
+ OBJECT => ' plperl.o eloglvl.o SPI.o' ,
33
+ );
66
34
67
- # add the postgreSQL libraries
68
- LDADD+= -L\$ (LIBPQDIR) -lpq
35
+ sub MY ::post_initialize {
69
36
70
- LDFLAGS+= $Config {lddlflags} \\
71
- $ldopts \\
72
- -lperl
37
+ q[
38
+ SRCDIR=../../../src
39
+ include $(SRCDIR)/Makefile.global
40
+ ] ;
73
41
74
- #
75
- # DLOBJS is the dynamically-loaded object file.
76
- #
77
- DLOBJS= plperl\$ (DLSUFFIX)
78
-
79
- INFILES= \$ (DLOBJS)
80
-
81
- SHLIB_EXTRA_LIBS+= $opcode
82
-
83
- #
84
- # plus exports files
85
- #
86
- ifdef EXPSUFF
87
- INFILES+= \$ (DLOBJS:.o=\$ (EXPSUFF))
88
- endif
89
-
90
- %.so: %.o
91
- \$ (CC) -o \$ @ \$ < \$ (LDFLAGS) \$ (SHLIB_EXTRA_LIBS) \$ (LDADD)
92
-
93
-
94
- #
95
- # Build the shared lib
96
- #
97
- all: plperl
98
-
99
- plperl : plperl.o SPI.o
100
- \$ (CC) -o plperl.so plperl.o SPI.o \$ (SHLIB_EXTRA_LIBS) \$ (LDADD) \$ (LDFLAGS)
101
-
102
- %.o : %.c
103
- \$ (CC) -c \$ (CFLAGS) \$ <
42
+ }
104
43
105
- %.o : %.xs
106
- \$ (XSUBPP) \$ (TYPEMAP) \$ < > xtmp.c
107
- \$ (CC) -c \$ (CFLAGS) -o \$ @ xtmp.c
44
+ sub MY ::install {
108
45
46
+ q[
47
+ install :: all
48
+ cp $(INST_DYNAMIC) $(LIBDIR)
49
+ ] ;
109
50
110
- #
111
- # Clean
112
- #
113
- clean:
114
- rm -f \$ (INFILES) *.o xtmp.c
115
- rm -rf .libs
116
- rm -f Makefile
51
+ }
117
52
118
- dep depend:
119
53
120
- _STATIC_
0 commit comments