Commit 46e76373 authored by Peter Eisentraut's avatar Peter Eisentraut

Implement a few changes to how shared libraries and dynamically loadable

modules are built.  Foremost, it creates a solid distinction between these two
types of targets based on what had already been implemented and duplicated in
ad hoc ways before.  Specifically,

- Dynamically loadable modules no longer get a soname.  The numbers previously
set in the makefiles were dummy numbers anyway, and the presence of a soname
upset a few packaging tools, so it is nicer not to have one.

- The cumbersome detour taken on installation (build a libfoo.so.0.0.0 and
then override the rule to install foo.so instead) is removed.

- Lots of duplicated code simplified.
parent 8deafd6f
This diff is collapsed.
......@@ -2,7 +2,7 @@
#
# Makefile for src/backend/snowball
#
# $PostgreSQL: pgsql/src/backend/snowball/Makefile,v 1.5 2008/03/18 16:24:50 petere Exp $
# $PostgreSQL: pgsql/src/backend/snowball/Makefile,v 1.6 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -77,11 +77,7 @@ else
VPATH = $(srcdir)/libstemmer
endif
SHLIB_LINK := $(BE_DLLLIBS)
NAME := dict_snowball
SO_MAJOR_VERSION := 0
SO_MINOR_VERSION := 0
rpath =
all: all-shared-lib $(SQLSCRIPT)
......@@ -116,10 +112,7 @@ else
echo "-- No language-specific snowball dictionaries, for lack of shared library support" > $@
endif
install: all installdirs
ifeq ($(enable_shared), yes)
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
endif
install: all installdirs install-lib
$(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
@set -e; \
set $(LANGUAGES) ; \
......@@ -131,11 +124,10 @@ endif
fi \
done
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)' '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)'
installdirs: installdirs-lib
$(mkinstalldirs) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)'
uninstall:
rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
uninstall: uninstall-lib
rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)'
@set -e; \
set $(LANGUAGES) ; \
......
SRCS += $(NAME).c
OBJS += $(NAME).o
SHLIB_LINK := $(BE_DLLLIBS)
SO_MAJOR_VERSION := 0
SO_MINOR_VERSION := 0
rpath =
all: all-shared-lib
include $(top_srcdir)/src/Makefile.shlib
install: all installdirs
ifeq ($(enable_shared), yes)
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
endif
install: all installdirs install-lib
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
installdirs: installdirs-lib
uninstall:
rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
uninstall: uninstall-lib
clean distclean maintainer-clean: clean-lib
rm -f $(OBJS)
......@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.39 2008/02/26 06:41:23 petere Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.40 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -16,7 +16,6 @@ include $(top_builddir)/src/Makefile.global
NAME= ecpg_compat
SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 1
DLTYPE= library
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
......@@ -42,8 +41,7 @@ snprintf.c: % : $(top_srcdir)/src/port/%
install: all installdirs install-lib
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(libdir)'
installdirs: installdirs-lib
uninstall: uninstall-lib
......
......@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.58 2008/03/21 16:10:23 meskes Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.59 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -16,7 +16,6 @@ include $(top_builddir)/src/Makefile.global
NAME= ecpg
SO_MAJOR_VERSION= 6
SO_MINOR_VERSION= 1
DLTYPE= library
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
......@@ -63,8 +62,7 @@ $(top_builddir)/src/port/pg_config_paths.h:
install: all installdirs install-lib
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(libdir)'
installdirs: installdirs-lib
uninstall: uninstall-lib
......
......@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.41 2008/02/26 06:41:24 petere Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.42 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -16,7 +16,6 @@ include $(top_builddir)/src/Makefile.global
NAME= pgtypes
SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 1
DLTYPE= library
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS)
......@@ -48,8 +47,7 @@ pgstrcasecmp.c rint.c snprintf.c: % : $(top_srcdir)/src/port/%
install: all installdirs install-lib
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(libdir)'
installdirs: installdirs-lib
uninstall: uninstall-lib
......
......@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.164 2008/03/05 05:39:11 tgl Exp $
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.165 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -18,7 +18,6 @@ include $(top_builddir)/src/Makefile.global
NAME= pq
SO_MAJOR_VERSION= 5
SO_MINOR_VERSION= 2
DLTYPE= library
override CPPFLAGS := -DFRONTEND -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port
ifneq ($(PORTNAME), win32)
......@@ -111,8 +110,8 @@ install: all installdirs install-lib
$(INSTALL_DATA) $(srcdir)/pqexpbuffer.h '$(DESTDIR)$(includedir_internal)'
$(INSTALL_DATA) $(srcdir)/pg_service.conf.sample '$(DESTDIR)$(datadir)/pg_service.conf.sample'
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(libdir)' '$(DESTDIR)$(includedir)' '$(DESTDIR)$(includedir_internal)'
installdirs: installdirs-lib
$(mkinstalldirs) '$(DESTDIR)$(includedir)' '$(DESTDIR)$(includedir_internal)'
uninstall: uninstall-lib
rm -f '$(DESTDIR)$(includedir)/libpq-fe.h' '$(DESTDIR)$(includedir_internal)/libpq-int.h' '$(DESTDIR)$(includedir_internal)/pqexpbuffer.h' '$(DESTDIR)$(datadir)/pg_service.conf.sample'
......
# PGXS: PostgreSQL extensions makefile
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.11 2007/10/16 15:59:59 tgl Exp $
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.12 2008/04/07 14:15:58 petere Exp $
# This file contains generic rules to build many kinds of simple
# extension modules. You only need to set a few variables and include
......@@ -80,10 +80,6 @@ all: $(PROGRAM) $(DATA_built) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULE
ifdef MODULE_big
# shared library parameters
NAME = $(MODULE_big)
SO_MAJOR_VERSION= 0
SO_MINOR_VERSION= 0
SHLIB_LINK += $(BE_DLLLIBS)
include $(top_srcdir)/src/Makefile.shlib
......@@ -121,9 +117,6 @@ endif # DOCS
ifdef PROGRAM
$(INSTALL_PROGRAM) $(PROGRAM)$(X) '$(DESTDIR)$(bindir)'
endif # PROGRAM
ifdef MODULE_big
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)'
endif # MODULE_big
ifdef SCRIPTS
@for file in $(addprefix $(srcdir)/, $(SCRIPTS)); do \
echo "$(INSTALL_SCRIPT) $$file '$(DESTDIR)$(bindir)'"; \
......@@ -137,6 +130,10 @@ ifdef SCRIPTS_built
done
endif # SCRIPTS_built
ifdef MODULE_big
install: install-lib
endif # MODULE_big
installdirs:
ifneq (,$(DATA)$(DATA_built))
......@@ -145,7 +142,7 @@ endif
ifneq (,$(DATA_TSEARCH))
$(mkinstalldirs) '$(DESTDIR)$(datadir)/tsearch_data'
endif
ifneq (,$(MODULES)$(MODULE_big))
ifneq (,$(MODULES))
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
endif
ifdef DOCS
......@@ -157,6 +154,10 @@ ifneq (,$(PROGRAM)$(SCRIPTS)$(SCRIPTS_built))
$(mkinstalldirs) '$(DESTDIR)$(bindir)'
endif
ifdef MODULE_big
installdirs: installdirs-lib
endif # MODULE_big
uninstall:
ifneq (,$(DATA)$(DATA_built))
......@@ -174,9 +175,6 @@ endif
ifdef PROGRAM
rm -f '$(DESTDIR)$(bindir)/$(PROGRAM)$(X)'
endif
ifdef MODULE_big
rm -f '$(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)'
endif
ifdef SCRIPTS
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, $(SCRIPTS))
endif
......@@ -184,6 +182,10 @@ ifdef SCRIPTS_built
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, $(SCRIPTS_built))
endif
ifdef MODULE_big
uninstall: uninstall-lib
endif # MODULE_big
clean:
ifdef MODULES
......
# Makefile for PL/Perl
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.33 2007/12/01 15:30:09 adunstan Exp $
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.34 2008/04/07 14:15:58 petere Exp $
subdir = src/pl/plperl
top_builddir = ../../..
......@@ -32,12 +32,10 @@ rpathdir = $(perl_archlibexp)/CORE
NAME = plperl
SO_MAJOR_VERSION = 0
SO_MINOR_VERSION = 0
OBJS = plperl.o spi_internal.o SPI.o
SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
SHLIB_LINK = $(perl_embed_ldflags)
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plperl
REGRESS = plperl plperl_trigger plperl_shared plperl_elog
......@@ -73,20 +71,11 @@ $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
endif
install: all installdirs
ifeq ($(enable_shared), yes)
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
else
@echo "*****"; \
echo "* PL/Perl was not installed due to lack of shared library support."; \
echo "*****"
endif
install: all installdirs install-lib
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
installdirs: installdirs-lib
uninstall:
rm -f '$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
uninstall: uninstall-lib
installcheck: submake
$(top_builddir)/src/test/regress/pg_regress --psqldir=$(PSQLDIR) $(REGRESS_OPTS) $(REGRESS)
......
......@@ -2,7 +2,7 @@
#
# Makefile for the plpgsql shared object
#
# $PostgreSQL: pgsql/src/pl/plpgsql/src/Makefile,v 1.31 2007/07/15 22:18:24 tgl Exp $
# $PostgreSQL: pgsql/src/pl/plpgsql/src/Makefile,v 1.32 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -12,11 +12,9 @@ include $(top_builddir)/src/Makefile.global
# Shared library parameters
NAME= plpgsql
SO_MAJOR_VERSION= 1
SO_MINOR_VERSION= 0
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
SHLIB_LINK = $(filter -lintl, $(LIBS)) $(BE_DLLLIBS)
SHLIB_LINK = $(filter -lintl, $(LIBS))
rpath =
OBJS = pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o
......@@ -27,26 +25,12 @@ all: all-lib
include $(top_srcdir)/src/Makefile.shlib
# In order to use Makefile.shlib, we allow it to build a static
# library libplpgsql.a, which we just ignore, as well as a shared
# library that it will insist on naming $(shlib). We don't want to
# call it that when installed, however, so we ignore the install-shlib
# rule and do this instead:
install: installdirs all install-lib
install: installdirs all
ifeq ($(enable_shared), yes)
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/plpgsql$(DLSUFFIX)'
else
@echo "*****"; \
echo "* PL/pgSQL was not installed due to lack of shared library support."; \
echo "*****"
endif
installdirs: installdirs-lib
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
uninstall: uninstall-lib
uninstall:
rm -f '$(DESTDIR)$(pkglibdir)/plpgsql$(DLSUFFIX)'
# Force these dependencies to be known even without dependency info built:
pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o: plpgsql.h $(srcdir)/pl.tab.h
......
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.28 2007/02/10 04:26:24 tgl Exp $
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.29 2008/04/07 14:15:58 petere Exp $
subdir = src/pl/plpython
top_builddir = ../../..
......@@ -37,8 +37,6 @@ override CPPFLAGS := -I$(srcdir) $(python_includespec) $(CPPFLAGS)
rpathdir = $(python_libdir)
NAME = plpython
SO_MAJOR_VERSION = 0
SO_MINOR_VERSION = 0
OBJS = plpython.o
......@@ -56,7 +54,7 @@ python${pytverstr}.def: $(WD)/system32/python${pytverstr}.dll
endif
SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) $(python_additional_libs)
SHLIB_LINK = $(python_libspec) $(python_additional_libs)
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plpythonu
REGRESS = plpython_schema plpython_populate plpython_function plpython_test plpython_error plpython_drop
......@@ -89,20 +87,11 @@ $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
endif
install: all installdirs
ifeq ($(enable_shared), yes)
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)'
else
@echo "*****"; \
echo "* PL/Python was not installed due to lack of shared library support."; \
echo "*****"
endif
install: all installdirs install-lib
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
installdirs: installdirs-lib
uninstall:
rm -f '$(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)'
uninstall: uninstall-lib
installcheck: submake
$(top_builddir)/src/test/regress/pg_regress --psqldir=$(PSQLDIR) $(REGRESS_OPTS) $(REGRESS)
......
......@@ -2,7 +2,7 @@
#
# Makefile for the pltcl shared object
#
# $PostgreSQL: pgsql/src/pl/tcl/Makefile,v 1.50 2006/07/21 00:24:04 tgl Exp $
# $PostgreSQL: pgsql/src/pl/tcl/Makefile,v 1.51 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -29,15 +29,12 @@ endif
endif
SHLIB_LINK = $(TCL_LIB_SPEC)
ifneq ($(PORTNAME), win32)
SHLIB_LINK = $(BE_DLLLIBS) $(TCL_LIB_SPEC) $(TCL_LIBS) -lc
else
SHLIB_LINK = $(TCL_LIB_SPEC) $(BE_DLLLIBS)
SHLIB_LINK += $(TCL_LIBS) -lc
endif
NAME = pltcl
SO_MAJOR_VERSION = 2
SO_MINOR_VERSION = 0
OBJS = pltcl.o
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=pltcl
......@@ -73,22 +70,13 @@ $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
endif
install: all installdirs
ifeq ($(enable_shared), yes)
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
else
@echo "*****"; \
echo "* PL/Tcl was not installed due to lack of shared library support."; \
echo "*****"
endif
install: all installdirs install-lib
$(MAKE) -C modules $@
installdirs:
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
installdirs: installdirs-lib
$(MAKE) -C modules $@
uninstall:
rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
uninstall: uninstall-lib
$(MAKE) -C modules $@
installcheck: submake
......
......@@ -6,7 +6,7 @@
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.72 2008/03/18 16:24:50 petere Exp $
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.73 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -77,18 +77,11 @@ uninstall:
# Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
NAME = regress
SO_MAJOR_VERSION= 0
SO_MINOR_VERSION= 0
OBJS = regress.o
SHLIB_LINK = $(BE_DLLLIBS)
include $(top_srcdir)/src/Makefile.shlib
all: $(NAME)$(DLSUFFIX)
$(NAME)$(DLSUFFIX): $(shlib)
rm -f $(NAME)$(DLSUFFIX)
$(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
all: all-lib
# Test input and expected files. These are created by pg_regress itself, so we
# don't have a rule to create them. We do need rules to clean them however.
......@@ -169,7 +162,7 @@ bigcheck: all
clean distclean maintainer-clean: clean-lib
# things built by `all' target
rm -f $(NAME)$(DLSUFFIX) $(OBJS)
rm -f $(OBJS)
$(MAKE) -C $(contribdir)/spi clean
rm -f $(output_files) $(input_files) pg_regress_main.o pg_regress.o pg_regress$(X)
# things created by various check targets
......
......@@ -9,15 +9,13 @@
# to build using the surrounding source tree.
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/tutorial/Makefile,v 1.20 2007/06/26 22:05:04 tgl Exp $
# $PostgreSQL: pgsql/src/tutorial/Makefile,v 1.21 2008/04/07 14:15:58 petere Exp $
#
#-------------------------------------------------------------------------
MODULES = complex funcs
DATA_built = advanced.sql basics.sql complex.sql funcs.sql syscat.sql
SHLIB_LINK = $(BE_DLLLIBS)
ifdef NO_PGXS
subdir = src/tutorial
top_builddir = ../..
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment