From 22e7c0650634037388f1858ae3c97a51f6b3f1ac Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 20 Jan 2000 22:31:23 +0000 Subject: Update plperl makefile. --- src/pl/Makefile | 28 +++++++++++- src/pl/plperl/Makefile.PL | 113 ++++++++++++++++++++++++++++++++++++++++++++++ src/pl/plperl/Makefile.pl | 113 ---------------------------------------------- 3 files changed, 140 insertions(+), 114 deletions(-) create mode 100644 src/pl/plperl/Makefile.PL delete mode 100644 src/pl/plperl/Makefile.pl (limited to 'src') diff --git a/src/pl/Makefile b/src/pl/Makefile index 019da866f11..467623cf3d5 100644 --- a/src/pl/Makefile +++ b/src/pl/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/pl/Makefile,v 1.1 1998/10/01 03:38:30 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/pl/Makefile,v 1.2 2000/01/20 22:31:22 momjian Exp $ # #------------------------------------------------------------------------- @@ -20,4 +20,30 @@ include $(SRCDIR)/Makefile.global ifeq ($(USE_TCL), true) $(MAKE) -C tcl $@ endif +ifeq ($(USE_PERL), true) + if [ "$@" = "install" ]; then \ + $(MAKE) $(MFLAGS) install-plperl; \ + else \ + $(MAKE) $(MFLAGS) plperl/Makefile; \ + $(MAKE) $(MFLAGS) -C plperl $@; \ + fi +endif + +plperl/Makefile: plperl/Makefile.PL + cd plperl && $(PERL) Makefile.PL + +install-plperl: plperl/Makefile + $(MAKE) -C plperl clean + cd plperl && POSTGRES_HOME="$(POSTGRESDIR)" $(PERL) Makefile.PL + $(MAKE) -C plperl all + -@if [ -w `sed -n -e 's/^ *INSTALLSITELIB *= *//p' plperl/Makefile` ]; then \ + $(MAKE) $(MFLAGS) -C plperl install; \ + rm -f plperl/Makefile; \ + else \ + echo "Skipping install of Perl module for lack of permissions."; \ + echo "To install it, cd into interfaces/plperl, su to become the"; \ + echo "appropriate user, and do '$(MAKE) install'."; \ + fi + +.PHONY: install-plperl diff --git a/src/pl/plperl/Makefile.PL b/src/pl/plperl/Makefile.PL new file mode 100644 index 00000000000..6e1d5699126 --- /dev/null +++ b/src/pl/plperl/Makefile.PL @@ -0,0 +1,113 @@ +use DynaLoader; +use Config; +use ExtUtils::Embed; + +# +# massage the ld options +# +my $ldopts = ldopts(); +chomp($ldopts); + +# +# get the location of the Opcode module +# +my $opcode = ''; +{ + + $modname = 'Opcode'; + + my $dir; + foreach (@INC) { + if (-d "$_/auto/$modname") { + $dir = "$_/auto/$modname"; + last; + } + } + + if (defined $dir) { + $opcode = DynaLoader::dl_findfile("-L$dir", $modname); + } + +} + +open(MAKEFILE, ">Makefile"); + +print MAKEFILE <<_STATIC_; +#------------------------------------------------------------------------- +# +# Makefile +# Makefile for the plperl shared object +# +# AUTOGENERATED Makefile.pl +# + +# +# Tell make where the postgresql sources live +# +SRCDIR= ../../../src +include \$(SRCDIR)/Makefile.global + + +# use the same compiler as perl did +CC= $Config{cc} + +# get the compiler options that perl wants. +CFLAGS+= @{[ccopts()]} +# including the ones for dynamic loading +CFLAGS+= $Config{cccdlflags} + +# add the includes for postgreSQL +CFLAGS+= -I\$(LIBPQDIR) -I\$(SRCDIR)/include + +# For fmgr.h +CFLAGS+= -I\$(SRCDIR)/backend + + +# add the postgreSQL libraries +LDADD+= -L\$(LIBPQDIR) -lpq + +LDFLAGS+= $Config{lddlflags} \\ + $ldopts \\ + -lperl + +# +# DLOBJS is the dynamically-loaded object file. +# +DLOBJS= plperl\$(DLSUFFIX) + +INFILES= \$(DLOBJS) + +SHLIB_EXTRA_LIBS+= $opcode + +# +# plus exports files +# +ifdef EXPSUFF +INFILES+= \$(DLOBJS:.o=\$(EXPSUFF)) +endif + +%.so: %.o + \$(CC) -o \$@ \$< \$(LDFLAGS) \$(SHLIB_EXTRA_LIBS) \$(LDADD) + + +# +# Build the shared lib +# +plperl : plperl.lo + libtool \$(CC) -o plperl.so plperl.lo \$(SHLIB_EXTRA_LIBS) \$(LDADD) \$(LDFLAGS) + +%.lo : %.c + libtool \$(CC) -c \$(CFLAGS) \$< + + +# +# Clean +# +clean: + rm -f \$(INFILES) *.o *.lo + rm -rf .libs + rm -f Makefile + +dep depend: + +_STATIC_ diff --git a/src/pl/plperl/Makefile.pl b/src/pl/plperl/Makefile.pl deleted file mode 100644 index 6e1d5699126..00000000000 --- a/src/pl/plperl/Makefile.pl +++ /dev/null @@ -1,113 +0,0 @@ -use DynaLoader; -use Config; -use ExtUtils::Embed; - -# -# massage the ld options -# -my $ldopts = ldopts(); -chomp($ldopts); - -# -# get the location of the Opcode module -# -my $opcode = ''; -{ - - $modname = 'Opcode'; - - my $dir; - foreach (@INC) { - if (-d "$_/auto/$modname") { - $dir = "$_/auto/$modname"; - last; - } - } - - if (defined $dir) { - $opcode = DynaLoader::dl_findfile("-L$dir", $modname); - } - -} - -open(MAKEFILE, ">Makefile"); - -print MAKEFILE <<_STATIC_; -#------------------------------------------------------------------------- -# -# Makefile -# Makefile for the plperl shared object -# -# AUTOGENERATED Makefile.pl -# - -# -# Tell make where the postgresql sources live -# -SRCDIR= ../../../src -include \$(SRCDIR)/Makefile.global - - -# use the same compiler as perl did -CC= $Config{cc} - -# get the compiler options that perl wants. -CFLAGS+= @{[ccopts()]} -# including the ones for dynamic loading -CFLAGS+= $Config{cccdlflags} - -# add the includes for postgreSQL -CFLAGS+= -I\$(LIBPQDIR) -I\$(SRCDIR)/include - -# For fmgr.h -CFLAGS+= -I\$(SRCDIR)/backend - - -# add the postgreSQL libraries -LDADD+= -L\$(LIBPQDIR) -lpq - -LDFLAGS+= $Config{lddlflags} \\ - $ldopts \\ - -lperl - -# -# DLOBJS is the dynamically-loaded object file. -# -DLOBJS= plperl\$(DLSUFFIX) - -INFILES= \$(DLOBJS) - -SHLIB_EXTRA_LIBS+= $opcode - -# -# plus exports files -# -ifdef EXPSUFF -INFILES+= \$(DLOBJS:.o=\$(EXPSUFF)) -endif - -%.so: %.o - \$(CC) -o \$@ \$< \$(LDFLAGS) \$(SHLIB_EXTRA_LIBS) \$(LDADD) - - -# -# Build the shared lib -# -plperl : plperl.lo - libtool \$(CC) -o plperl.so plperl.lo \$(SHLIB_EXTRA_LIBS) \$(LDADD) \$(LDFLAGS) - -%.lo : %.c - libtool \$(CC) -c \$(CFLAGS) \$< - - -# -# Clean -# -clean: - rm -f \$(INFILES) *.o *.lo - rm -rf .libs - rm -f Makefile - -dep depend: - -_STATIC_ -- cgit v1.2.3