From 46e76373ec6036a0a53206ef0ea87df75d082c48 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 7 Apr 2008 14:15:58 +0000 Subject: [PATCH] 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. --- src/Makefile.shlib | 208 +++++++++++++----- src/backend/snowball/Makefile | 18 +- src/backend/utils/mb/conversion_procs/proc.mk | 15 +- src/interfaces/ecpg/compatlib/Makefile | 6 +- src/interfaces/ecpg/ecpglib/Makefile | 6 +- src/interfaces/ecpg/pgtypeslib/Makefile | 6 +- src/interfaces/libpq/Makefile | 7 +- src/makefiles/pgxs.mk | 26 ++- src/pl/plperl/GNUmakefile | 21 +- src/pl/plpgsql/src/Makefile | 26 +-- src/pl/plpython/Makefile | 21 +- src/pl/tcl/Makefile | 24 +- src/test/regress/GNUmakefile | 13 +- src/tutorial/Makefile | 4 +- 14 files changed, 204 insertions(+), 197 deletions(-) diff --git a/src/Makefile.shlib b/src/Makefile.shlib index 7d219d8cfc..316b9d1642 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -6,7 +6,7 @@ # Copyright (c) 1998, Regents of the University of California # # IDENTIFICATION -# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.113 2008/02/26 14:26:16 petere Exp $ +# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.114 2008/04/07 14:15:58 petere Exp $ # #------------------------------------------------------------------------- @@ -19,13 +19,18 @@ # variables: # # NAME Name of library to build (no suffix nor "lib" prefix) -# SO_MAJOR_VERSION Major version number to use for shared library -# SO_MINOR_VERSION Minor version number to use for shared library # OBJS List of object files to include in library # SHLIB_LINK If shared library relies on other libraries, # additional stuff to put in its link command # SHLIB_EXPORTS (optional) Name of file containing list of symbols to # export +# +# When building a shared library, the following version information +# must also be set. It should be omitted when building a dynamically +# loadable module. +# +# SO_MAJOR_VERSION Major version number to use for shared library +# SO_MINOR_VERSION Minor version number to use for shared library # (If you want a patchlevel, include it in SO_MINOR_VERSION, e.g., "6.2".) # # Optional flags when building DLL's (only applicable to win32 and cygwin @@ -42,6 +47,7 @@ # # all-lib build the static and shared (if applicable) libraries # install-lib install the libraries into $(libdir) +# installdirs-lib create installation directory $(libdir) # uninstall-lib remove the libraries from $(libdir) # clean-lib delete the static and shared libraries from the build dir # maintainer-clean-lib delete .def files built for win32 @@ -72,18 +78,34 @@ LINK.static = $(AR) $(AROPT) -ifeq ($(enable_shared), yes) - # Insert -L from LDFLAGS after any -L already present in SHLIB_LINK SHLIB_LINK := $(filter -L%, $(SHLIB_LINK)) $(filter -L%, $(LDFLAGS)) $(filter-out -L%, $(SHLIB_LINK)) # Need a -L-free version of LDFLAGS to use in combination with SHLIB_LINK LDFLAGS_NO_L = $(filter-out -L%, $(LDFLAGS)) -# Default shlib naming convention used by the majority of platforms +ifdef SO_MAJOR_VERSION +# Default library naming convention used by the majority of platforms +ifeq ($(enable_shared), yes) shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) shlib_major = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) shlib_bare = lib$(NAME)$(DLSUFFIX) +endif +# Testing the soname variable is a reliable way to determine whether a +# linkable library is being built. +soname = $(shlib_major) +stlib = lib$(NAME).a +else +# Naming convention for dynamically loadable modules +ifeq ($(enable_shared), yes) +shlib = $(NAME)$(DLSUFFIX) +endif +endif + +ifndef soname +# additional flags for backend modules +SHLIB_LINK := $(BE_DLLLIBS) $(SHLIB_LINK) +endif # For each platform we support shared libraries on, set shlib to the # name of the library (if default above is not right), set @@ -94,29 +116,29 @@ shlib_bare = lib$(NAME)$(DLSUFFIX) override CFLAGS += $(CFLAGS_SL) -soname = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) - ifeq ($(PORTNAME), aix) - shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) + ifdef SO_MAJOR_VERSION + shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) + endif haslibarule = yes exports_file = lib$(NAME).exp endif ifeq ($(PORTNAME), darwin) - ifneq ($(SO_MAJOR_VERSION), 0) - version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) - endif - ifeq ($(DLTYPE), library) + ifdef soname # linkable library DLSUFFIX = .dylib + ifneq ($(SO_MAJOR_VERSION), 0) + version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) + endif LINK.shared = $(COMPILER) -dynamiclib -install_name $(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) $(version_link) $(exported_symbols_list) -multiply_defined suppress + shlib = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX) + shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) else - # loadable module (default case) + # loadable module DLSUFFIX = .so LINK.shared = $(COMPILER) -bundle -multiply_defined suppress endif - shlib = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX) - shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@ exports_file = $(SHLIB_EXPORTS:%.txt=%.list) ifneq (,$(exports_file)) @@ -126,7 +148,10 @@ endif ifeq ($(PORTNAME), openbsd) ifdef ELF_SYSTEM - LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname) + LINK.shared = $(COMPILER) -shared + ifdef soname + LINK.shared += -Wl,-x,-soname,$(soname) + endif SHLIB_LINK += -lc else LINK.shared = $(LD) -x -Bshareable -Bforcearchive @@ -135,7 +160,10 @@ endif ifeq ($(PORTNAME), bsdi) ifeq ($(DLSUFFIX), .so) - LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname) + LINK.shared = $(COMPILER) -shared + ifdef soname + LINK.shared += -Wl,-x,-soname,$(soname) + endif SHLIB_LINK += -lc endif ifeq ($(DLSUFFIX), .o) @@ -145,33 +173,50 @@ endif ifeq ($(PORTNAME), freebsd) ifdef ELF_SYSTEM - shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) - LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname) + ifdef SO_MAJOR_VERSION + shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) + endif + LINK.shared = $(COMPILER) -shared + ifdef soname + LINK.shared += -Wl,-x,-soname,$(soname) + endif else - shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) + ifdef SO_MAJOR_VERSION + shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) + endif LINK.shared = $(LD) -x -Bshareable -Bforcearchive endif endif ifeq ($(PORTNAME), netbsd) ifdef ELF_SYSTEM - LINK.shared = $(COMPILER) -shared -Wl,-x,-soname,$(soname) + LINK.shared = $(COMPILER) -shared + ifdef soname + LINK.shared += -Wl,-x,-soname,$(soname) + endif else LINK.shared = $(LD) -x -Bshareable -Bforcearchive endif endif ifeq ($(PORTNAME), hpux) - shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) + ifdef SO_MAJOR_VERSION + shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) + endif ifeq ($(with_gnu_ld), yes) - LINK.shared = $(CC) $(LDFLAGS_NO_L) -shared -Wl,-h -Wl,$(soname) + LINK.shared = $(CC) $(LDFLAGS_NO_L) -shared + ifdef soname + LINK.shared += -Wl,-h -Wl,$(soname) + endif else # can't use the CC-syntax rpath pattern here rpath = + LINK.shared = $(LD) -b + ifdef soname + LINK.shared += +h $(soname) + endif ifeq ($(enable_rpath), yes) - LINK.shared = $(LD) +h $(soname) -b +b '$(rpathdir)' - else - LINK.shared = $(LD) +h $(soname) -b + LINK.shared += +b '$(rpathdir)' endif # On HPUX platforms, gcc is usually configured to search for libraries # in /usr/local/lib, but ld won't do so. Add an explicit -L switch so @@ -188,12 +233,20 @@ ifeq ($(PORTNAME), hpux) endif ifeq ($(PORTNAME), irix) - shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) - LINK.shared = $(COMPILER) -shared -Wl,-set_version,sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) + ifdef SO_MAJOR_VERSION + shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) + endif + LINK.shared = $(COMPILER) -shared + ifdef soname + LINK.shared += -Wl,-set_version,sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) + endif endif ifeq ($(PORTNAME), linux) - LINK.shared = $(COMPILER) -shared -Wl,-soname,$(soname) + LINK.shared = $(COMPILER) -shared + ifdef soname + LINK.shared += -Wl,-soname,$(soname) + endif BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@ exports_file = $(SHLIB_EXPORTS:%.txt=%.list) ifneq (,$(exports_file)) @@ -208,10 +261,12 @@ ifeq ($(PORTNAME), solaris) # CFLAGS added for X86_64 LINK.shared = $(CC) -G $(CFLAGS) endif - ifeq ($(with_gnu_ld), yes) - LINK.shared += -Wl,-soname,$(soname) - else - LINK.shared += -h $(soname) + ifdef soname + ifeq ($(with_gnu_ld), yes) + LINK.shared += -Wl,-soname,$(soname) + else + LINK.shared += -h $(soname) + endif endif endif @@ -229,7 +284,10 @@ ifeq ($(PORTNAME), sco) else LINK.shared = $(CC) -G endif - LINK.shared += -Wl,-z,text -Wl,-h,$(soname) + LINK.shared += -Wl,-z,text + ifdef soname + LINK.shared += -Wl,-h,$(soname) + endif endif ifeq ($(PORTNAME), svr4) @@ -246,7 +304,10 @@ ifeq ($(PORTNAME), unixware) else LINK.shared = $(CC) -G endif - LINK.shared += -Wl,-z,text -Wl,-h,$(soname) + LINK.shared += -Wl,-z,text + ifdef soname + LINK.shared += -Wl,-h,$(soname) + endif endif ifeq ($(PORTNAME), cygwin) @@ -263,8 +324,6 @@ ifeq ($(enable_rpath), yes) SHLIB_LINK += $(rpath) endif -endif # enable_shared - ## @@ -273,14 +332,18 @@ endif # enable_shared .PHONY: all-lib all-static-lib all-shared-lib -all-lib: all-static-lib all-shared-lib +all-lib: all-shared-lib +ifdef soname +# no static library when building a dynamically loadable module +all-lib: all-static-lib +endif -all-static-lib: lib$(NAME).a +all-static-lib: $(stlib) all-shared-lib: $(shlib) ifndef haslibarule -lib$(NAME).a: $(OBJS) +$(stlib): $(OBJS) $(LINK.static) $@ $^ $(RANLIB) $@ endif #haslibarule @@ -293,6 +356,7 @@ ifneq ($(PORTNAME), aix) # Normal case $(shlib): $(OBJS) $(LINK.shared) $(LDFLAGS_SL) $(OBJS) $(SHLIB_LINK) -o $@ +ifdef shlib_major # If we're using major and minor versions, then make a symlink to major-version-only. ifneq ($(shlib), $(shlib_major)) rm -f $(shlib_major) @@ -303,6 +367,7 @@ ifneq ($(shlib), $(shlib_bare)) rm -f $(shlib_bare) $(LN_S) $(shlib) $(shlib_bare) endif +endif # shlib_major # Where possible, restrict the symbols exported by the library to just the # official list, so as to avoid unintentional ABI changes. On recent Darwin @@ -320,13 +385,13 @@ endif else # PORTNAME == aix # AIX case -$(shlib) lib$(NAME).a: $(OBJS) - $(LINK.static) lib$(NAME).a $^ - $(RANLIB) lib$(NAME).a - $(MKLDEXPORT) lib$(NAME).a >$(exports_file) - $(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) lib$(NAME).a -Wl,-bE:$(exports_file) $(SHLIB_LINK) - rm -f lib$(NAME).a - $(AR) $(AROPT) lib$(NAME).a $(shlib) +$(shlib) $(stlib): $(OBJS) + $(LINK.static) $(stlib) $^ + $(RANLIB) $(stlib) + $(MKLDEXPORT) $(stlib) >$(exports_file) + $(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(SHLIB_LINK) + rm -f $(stlib) + $(AR) $(AROPT) $(stlib) $(shlib) endif # PORTNAME == aix @@ -348,7 +413,7 @@ endif $(shlib): $(OBJS) $(DLL_DEFFILE) $(DLLWRAP) $(LDFLAGS_SL) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK) -lib$(NAME).a: $(shlib) $(DLL_DEFFILE) +$(stlib): $(shlib) $(DLL_DEFFILE) $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@ endif # PORTNAME == cygwin || PORTNAME == win32 @@ -394,18 +459,22 @@ endif # SHLIB_EXPORTS ## INSTALL ## -.PHONY: install-lib install-lib-static install-lib-shared -install-lib: install-lib-static install-lib-shared +.PHONY: install-lib install-lib-static install-lib-shared installdirs-lib +install-lib: install-lib-shared +ifdef soname +install-lib: install-lib-static +endif -install-lib-static: lib$(NAME).a - $(INSTALL_STLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).a' +install-lib-static: $(stlib) installdirs-lib + $(INSTALL_STLIB) $< '$(DESTDIR)$(libdir)/$(stlib)' ifeq ($(PORTNAME), darwin) cd '$(DESTDIR)$(libdir)' && \ - ranlib lib$(NAME).a + ranlib $(stlib) endif ifeq ($(enable_shared), yes) -install-lib-shared: $(shlib) +install-lib-shared: $(shlib) installdirs-lib +ifdef soname # we don't install $(shlib) on AIX ifneq ($(PORTNAME), aix) $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)' @@ -424,21 +493,43 @@ endif endif # not win32 endif # not cygwin endif # not aix +else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' +endif +else # not enable_shared +ifndef soname +install-lib-shared: + @echo "*****"; \ + echo "* Module $(NAME) was not installed due to lack of shared library support."; \ + echo "*****" +endif endif # enable_shared +installdirs-lib: +ifdef soname + $(mkinstalldirs) '$(DESTDIR)$(libdir)' +else + $(mkinstalldirs) '$(DESTDIR)$(pkglibdir)' +endif + + ## ## UNINSTALL ## .PHONY: uninstall-lib uninstall-lib: - rm -f '$(DESTDIR)$(libdir)/lib$(NAME).a' +ifdef soname + rm -f '$(DESTDIR)$(libdir)/$(stlib)' ifeq ($(enable_shared), yes) rm -f '$(DESTDIR)$(libdir)/$(shlib_bare)' \ '$(DESTDIR)$(libdir)/$(shlib_major)' \ '$(DESTDIR)$(libdir)/$(shlib)' endif # enable_shared +else # no soname + rm -f '$(DESTDIR)$(pkglibdir)/$(shlib)' +endif # no soname ## @@ -447,10 +538,7 @@ endif # enable_shared .PHONY: clean-lib clean-lib: - rm -f lib$(NAME).a -ifeq ($(enable_shared), yes) - rm -f $(shlib_bare) $(shlib_major) $(shlib) $(exports_file) -endif + rm -f $(shlib) $(shlib_bare) $(shlib_major) $(stlib) $(exports_file) ifneq (,$(SHLIB_EXPORTS)) maintainer-clean-lib: diff --git a/src/backend/snowball/Makefile b/src/backend/snowball/Makefile index 466a507c08..a1d22f24c6 100644 --- a/src/backend/snowball/Makefile +++ b/src/backend/snowball/Makefile @@ -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) ; \ diff --git a/src/backend/utils/mb/conversion_procs/proc.mk b/src/backend/utils/mb/conversion_procs/proc.mk index 05bc2a4a09..77322a452e 100644 --- a/src/backend/utils/mb/conversion_procs/proc.mk +++ b/src/backend/utils/mb/conversion_procs/proc.mk @@ -1,26 +1,17 @@ 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) diff --git a/src/interfaces/ecpg/compatlib/Makefile b/src/interfaces/ecpg/compatlib/Makefile index b8c17f0706..29f27ea35c 100644 --- a/src/interfaces/ecpg/compatlib/Makefile +++ b/src/interfaces/ecpg/compatlib/Makefile @@ -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 diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile index a6f8221ae7..d93be73b87 100644 --- a/src/interfaces/ecpg/ecpglib/Makefile +++ b/src/interfaces/ecpg/ecpglib/Makefile @@ -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 diff --git a/src/interfaces/ecpg/pgtypeslib/Makefile b/src/interfaces/ecpg/pgtypeslib/Makefile index 1397167bde..c255c013c1 100644 --- a/src/interfaces/ecpg/pgtypeslib/Makefile +++ b/src/interfaces/ecpg/pgtypeslib/Makefile @@ -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 diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index 63a4a1827e..fced907efa 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -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' diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk index 67eef5dd71..71bc7dce54 100644 --- a/src/makefiles/pgxs.mk +++ b/src/makefiles/pgxs.mk @@ -1,6 +1,6 @@ # 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 diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile index fbebe77b73..314b3b64c2 100644 --- a/src/pl/plperl/GNUmakefile +++ b/src/pl/plperl/GNUmakefile @@ -1,5 +1,5 @@ # 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) diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile index d6454a239b..e3c4f7b813 100644 --- a/src/pl/plpgsql/src/Makefile +++ b/src/pl/plpgsql/src/Makefile @@ -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 diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile index 0b52c3d238..295a60e688 100644 --- a/src/pl/plpython/Makefile +++ b/src/pl/plpython/Makefile @@ -1,4 +1,4 @@ -# $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) diff --git a/src/pl/tcl/Makefile b/src/pl/tcl/Makefile index 6fc6cc272f..84a103655f 100644 --- a/src/pl/tcl/Makefile +++ b/src/pl/tcl/Makefile @@ -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 diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 3920e3da21..f8eb07e8b7 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -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 diff --git a/src/tutorial/Makefile b/src/tutorial/Makefile index 19647df692..cbd721103c 100644 --- a/src/tutorial/Makefile +++ b/src/tutorial/Makefile @@ -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 = ../..