@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
# Copyright (c) 1998, Regents of the University of California
#
#
# IDENTIFICATION
# IDENTIFICATION
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.123 2009/08/28 20:26:18 petere Exp $
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.124 2010/07/05 18:54:37 tgl Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
@ -78,11 +78,8 @@ LINK.static = $(AR) $(AROPT)
# Insert -L from LDFLAGS after any -L already present in SHLIB_LINK
# Automatically append LDFLAGS and LDFLAGS_SL to SHLIB_LINK
SHLIB_LINK := $( filter -L%, $( SHLIB_LINK) ) $( filter -L%, $( LDFLAGS) ) $( filter-out -L%, $( SHLIB_LINK) )
SHLIB_LINK += $( LDFLAGS) $( LDFLAGS_SL)
# Need a -L-free version of LDFLAGS to use in combination with SHLIB_LINK
LDFLAGS_NO_L = $( filter-out -L%, $( LDFLAGS) )
i f d e f S O _ M A J O R _ V E R S I O N
i f d e f S O _ M A J O R _ V E R S I O N
# Default library naming convention used by the majority of platforms
# Default library naming convention used by the majority of platforms
@ -104,7 +101,7 @@ stlib = lib$(NAME).a
i f n d e f s o n a m e
i f n d e f s o n a m e
# additional flags for backend modules
# additional flags for backend modules
SHLIB_LINK := $( BE_DLLLIBS) $( SHLIB_LINK)
SHLIB_LINK += $( BE_DLLLIBS)
e n d i f
e n d i f
# For each platform we support shared libraries on, set shlib to the
# For each platform we support shared libraries on, set shlib to the
@ -208,17 +205,17 @@ ifeq ($(PORTNAME), hpux)
shlib = lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
shlib = lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
endif
endif
ifeq ( $( with_gnu_ld) , yes)
ifeq ( $( with_gnu_ld) , yes)
LINK.shared = $( CC) $( LDFLAGS_NO_L) -shared
LINK.shared = $( CC) -shared
ifdef soname
ifdef soname
LINK.shared += -Wl,-h -Wl,$( soname)
LINK.shared += -Wl,-h -Wl,$( soname)
endif
endif
else
else
# can't use the CC-syntax rpath pattern here
rpath =
LINK.shared = $( LD) -b
LINK.shared = $( LD) -b
ifdef soname
ifdef soname
LINK.shared += +h $( soname)
LINK.shared += +h $( soname)
endif
endif
# can't use the CC-syntax rpath pattern here, so instead:
rpath =
ifeq ( $( enable_rpath) , yes)
ifeq ( $( enable_rpath) , yes)
LINK.shared += +b '$(rpathdir)'
LINK.shared += +b '$(rpathdir)'
endif
endif
@ -227,10 +224,10 @@ ifeq ($(PORTNAME), hpux)
# ld can find the same libraries gcc does. Make sure it goes after any
# ld can find the same libraries gcc does. Make sure it goes after any
# -L switches provided explicitly.
# -L switches provided explicitly.
ifeq ( $( GCC) , yes)
ifeq ( $( GCC) , yes)
SHLIB_LINK := $( filter -L%, $( SHLIB_LINK) ) -L/usr/local/lib $( filter-out -L%, $( SHLIB_LINK) )
SHLIB_LINK += -L/usr/local/lib
endif
endif
endif
endif
# do this last so above filtering doesn't pull out -L switches in LDFLAGS
# And we need to link with libgcc, too
ifeq ( $( GCC) , yes)
ifeq ( $( GCC) , yes)
SHLIB_LINK += ` $( CC) $( LDFLAGS) -print-libgcc-file-name`
SHLIB_LINK += ` $( CC) $( LDFLAGS) -print-libgcc-file-name`
endif
endif
@ -327,10 +324,6 @@ ifeq ($(PORTNAME), win32)
haslibarule = yes
haslibarule = yes
e n d i f
e n d i f
i f e q ( $( enable_rpath ) , y e s )
SHLIB_LINK += $( rpath)
e n d i f
##
##
@ -362,7 +355,7 @@ ifneq ($(PORTNAME), aix)
# Normal case
# Normal case
$(shlib) : $( OBJS )
$(shlib) : $( OBJS )
$( LINK.shared) $( LDFLAGS_SL) $( OBJS) $( SHLIB_LINK) -o $@
$( LINK.shared) -o $@ $( OBJS) $( SHLIB_LINK)
i f d e f s h l i b _ m a j o r
i f d e f s h l i b _ m a j o r
# If we're using major and minor versions, then make a symlink to major-version-only.
# If we're using major and minor versions, then make a symlink to major-version-only.
i f n e q ( $( shlib ) , $( shlib_major ) )
i f n e q ( $( shlib ) , $( shlib_major ) )
@ -396,7 +389,7 @@ $(shlib) $(stlib): $(OBJS)
$( LINK.static) $( stlib) $^
$( LINK.static) $( stlib) $^
$( RANLIB) $( stlib)
$( RANLIB) $( stlib)
$( MKLDEXPORT) $( stlib) >$( exports_file)
$( MKLDEXPORT) $( stlib) >$( exports_file)
$( COMPILER) $( LDFLAGS_NO_L) $( LDFLAGS_SL) -o $( shlib) $( stlib) -Wl,-bE:$( exports_file) $( SHLIB_LINK)
$( COMPILER) -o $( shlib) $( stlib) -Wl,-bE:$( exports_file) $( SHLIB_LINK)
rm -f $( stlib)
rm -f $( stlib)
$( AR) $( AROPT) $( stlib) $( shlib)
$( AR) $( AROPT) $( stlib) $( shlib)
@ -419,7 +412,7 @@ DLL_DEFFILE = lib$(NAME)dll.def
e n d i f
e n d i f
$(shlib) : $( OBJS ) $( DLL_DEFFILE )
$(shlib) : $( OBJS ) $( DLL_DEFFILE )
$( DLLWRAP) $( LDFLAGS_SL) -o $@ --dllname $( shlib) $( DLLWRAP_FLAGS) --def $( DLL_DEFFILE) $( OBJS) $( SHLIB_LINK)
$( DLLWRAP) -o $@ --dllname $( shlib) $( DLLWRAP_FLAGS) --def $( DLL_DEFFILE) $( OBJS) $( SHLIB_LINK)
$(stlib) : $( shlib ) $( DLL_DEFFILE )
$(stlib) : $( shlib ) $( DLL_DEFFILE )
$( DLLTOOL) --dllname $( shlib) $( DLLTOOL_LIBFLAGS) --def $( DLL_DEFFILE) --output-lib $@
$( DLLTOOL) --dllname $( shlib) $( DLLTOOL_LIBFLAGS) --def $( DLL_DEFFILE) --output-lib $@