@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.26 2000/10/20 21:03:38 petere Exp $
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.27 2000/10/23 21:43:56 petere Exp $
#
#-------------------------------------------------------------------------
@ -51,154 +51,157 @@
#
# Got that? Look at src/interfaces/libpq/Makefile for an example.
i f n d e f c p l u s p l u s
COMPILER = $( CC)
e l s e
COMPILER = $( CXX)
e n d i f
# First, a few hacks for building *static* libraries.
LINK.static = $( AR) $( AROPT)
i f d e f c p l u s p l u s
# shlib is empty by default. If we know how to build a shared library
# it will contain the name of the file, otherwise it will remain
# empty. Thus `ifdef shlib' could be used in the containing make file
# to test whether shared libraries are available.
shlib :=
i f e q ( $( PORTNAME ) , i r i x 5 )
ifneq ( $( GXX) , yes)
LINK.static = $( CXX) -ar -o
endif
e n d i f
# For each platform we support shared libraries on, set shlib and
# update flags as needed to build a shared lib. Note we depend on
# Makefile.global (or really Makefile.port) to supply DLSUFFIX and
# other symbols.
i f e q ( $( PORTNAME ) , s o l a r i s )
ifneq ( $( GXX) , yes)
LINK.static = $( CXX) -xar -o
endif
e n d i f
e n d i f # cplusplus
i f e q ( $( enable_shared ) , y e s )
# For each platform we support shared libraries on, set shlib to the
# name of the library, LINK.shared to the command to link the library,
# and adjust SHLIB_LINK if necessary.
# Try to keep the sections in some kind of order, folks...
# XXX fix Makefile.aix
i f n e q ( $( PORTNAME ) , a i x )
ifndef cplusplus
override CFLAGS += $( CFLAGS_SL)
else
override CXXFLAGS += $( CFLAGS_SL)
endif
e n d i f
i f e q ( $( PORTNAME ) , a i x )
shlib := lib$( NAME) $( DLSUFFIX)
SHLIB_LINK += -lc
e n d i f
i f e q ( $( PORTNAME ) , o p e n b s d )
ifdef BSD_SHLIB
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
ifdef ELF_SYSTEM
LDFLAGS_SL := -x -Bshareable -soname $( shlib)
else
LDFLAGS_SL := -x -Bshareable -Bforcearchive
endif
override CFLAGS += $( CFLAGS_SL)
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
ifdef ELF_SYSTEM
LINK.shared = $( LD) -x -Bshareable -soname $( shlib)
else
LINK.shared = $( LD) -x -Bshareable -Bforcearchive
endif
e n d i f
i f e q ( $( PORTNAME ) , b s d i )
ifdef BSD_SHLIB
ifeq ( $( DLSUFFIX) , .so)
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LDFLAGS_SL += -shared -soname $( shlib)
override CFLAGS += $( CFLAGS_SL)
endif
ifeq ( $( DLSUFFIX) , .o)
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LD := shlicc
LDFLAGS_SL += -O $( LDREL)
override CFLAGS += $( CFLAGS_SL)
endif
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
ifeq ( $( DLSUFFIX) , .so)
LINK.shared = $( LD) -shared -soname $( shlib)
endif
ifeq ( $( DLSUFFIX) , .o)
LINK.shared = shlicc -O $( LDREL)
endif
e n d i f
i f e q ( $( PORTNAME ) , f r e e b s d )
ifdef BSD_SHLIB
ifdef ELF_SYSTEM
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
LDFLAGS_SL := -x -shared -soname $( shlib)
else
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LDFLAGS_SL := -x -Bshareable -Bforcearchive
endif
override CFLAGS += $( CFLAGS_SL)
ifdef ELF_SYSTEM
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
LINK.shared = $( LD) -x -shared -soname $( shlib)
else
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LINK.shared = $( LD) -x -Bshareable -Bforcearchive
endif
e n d i f
i f e q ( $( PORTNAME ) , n e t b s d )
ifdef BSD_SHLIB
soname := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
ifdef ELF_SYSTEM
LD := $( CC)
LDFLAGS_SL := -shared -Wl,-soname -Wl,$( soname)
ifneq ( $( SHLIB_LINK) ,)
LDFLAGS_SL += -Wl,-R$( libdir)
endif
else
LDFLAGS_SL := -x -Bshareable -Bforcearchive
soname := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
ifdef ELF_SYSTEM
LINK.shared = $( COMPILER) -shared -Wl,-soname -Wl,$( soname)
ifneq ( $( SHLIB_LINK) ,)
LINK.shared += -Wl,-R$( libdir)
endif
override CFLAGS += $( CFLAGS_SL)
else
LINK.shared = $( LD) -x -Bshareable -Bforcearchive
endif
e n d i f
i f e q ( $( PORTNAME ) , h p u x )
# HPUX doesn't believe in version numbers for shlibs
shlib := lib$( NAME) $( DLSUFFIX)
LDFLAGS_SL := -b
override CFLAGS += $( CFLAGS_SL)
LINK.shared = $( LD) -b
e n d i f
i f e q ( $( PORTNAME ) , i r i x 5 )
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
LDFLAGS_SL := -shared -rpath $( libdir) -set_version sgi$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
override CFLAGS += $( CFLAGS_SL)
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
LINK.shared := $( COMPILER) -shared -rpath $( libdir) -set_version sgi$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
e n d i f
i f e q ( $( PORTNAME ) , l i n u x )
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LD := $( CC)
LDFLAGS_SL := -shared -Wl,-soname,$( shlib)
LDFLAGS_ODBC := -lm
override CFLAGS += $( CFLAGS_SL)
LINK.shared = $( COMPILER) -shared -Wl,-soname,$( shlib)
e n d i f
i f e q ( $( PORTNAME ) , s o l a r i s )
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LDFLAGS_SL := -G
LINK.shared = $( COMPILER) -G
SHLIB_LINK += -ldl -lsocket -lresolv -lnsl -lm -lc
override CFLAGS += $( CFLAGS_SL)
e n d i f
i f e q ( $( PORTNAME ) , o s f )
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LDFLAGS_SL += -shared -expect_unresolved '*'
LINK.shared = $( LD) -shared -expect_unresolved '*'
e n d i f
i f e q ( $( PORTNAME ) , s v r 4 )
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LDFLAGS_SL := -G
override CFLAGS += $( CFLAGS_SL)
LINK.shared = $( LD) -G
e n d i f
i f e q ( $( PORTNAME ) , u n i v e l )
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LDFLAGS_SL := -G -z text
override CFLAGS += $( CFLAGS_SL)
ifeq ( $( CXX) , CC)
override CXXFLAGS += -Xw
COMPILE.cc = $( CXX) $( CXXFLAGS:ll,alloca= ll) $( CPPFLAGS) $( TARGET_ARCH) -c
endif
LINK.shared = $( LD) -G -z text
e n d i f
i f e q ( $( PORTNAME ) , u n i x w a r e )
shlib := lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
LDFLAGS_SL := -G -z text
override CFLAGS += $( CFLAGS_SL)
ifeq ( $( CXX) , CC)
override CXXFLAGS += -Xw
COMPILE.cc = $( CXX) $( CXXFLAGS:ll,alloca= ll) $( CPPFLAGS) $( TARGET_ARCH) -c
endif
LINK.shared = $( LD) -G -z text
e n d i f
i f e q ( $( PORTNAME ) , w i n )
shlib := $( NAME) $( DLSUFFIX)
ifdef cplusplus
SHLIB_LINK += --driver-name g++
endif
e n d i f
i f e q ( $( PORTNAME ) , b e o s )
install-shlib-dep := install-shlib
shlib := lib$( NAME) $( DLSUFFIX)
LDFLAGS_SL := -nostart -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
shlib := lib$( NAME) $( DLSUFFIX)
LINK.shared = $( LD) -nostart
SHLIB_LINK += -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
e n d i f
# Note that in what follows, shlib is empty when not building a shared
# library.
e n d i f # enable_ shared
##
@ -208,8 +211,6 @@ endif
.PHONY : all -lib
all-lib : lib $( NAME ) .a $( shlib )
# Rules to build regular and shared libraries
i f n e q ( $( PORTNAME ) , w i n )
i f n d e f L O R D E R
@ -218,22 +219,23 @@ endif
lib$(NAME).a : $( OBJS )
i f d e f M K _ N O _ L O R D E R
$( AR) $( AROPT ) $@ $^
$( LINK.static ) $@ $^
e l s e
$( AR) $( AROPT ) $@ ` $( LORDER) $^ | tsort`
$( LINK.static ) $@ ` $( LORDER) $^ | tsort`
e n d i f
$( RANLIB) $@
e n d i f # not win
i f d e f s h l i b
i f e q ( $( enable_shared ) , y e s )
i f n e q ( $( PORTNAME ) , b e o s )
i f n e q ( $( PORTNAME ) , w i n )
i f n e q ( $( PORTNAME ) , a i x )
# Normal case
$(shlib) : $( OBJS )
$( LD) $( LDFLAGS_SL ) -o $@ $( OBJS) $( SHLIB_LINK)
$( LINK.shared ) -o $@ $( OBJS) $( SHLIB_LINK)
# If we're using major and minor versions, then make a symlink to major-version-only.
i f n e q ( $( shlib ) , l i b $( NAME ) $( DLSUFFIX ) . $( SO_MAJOR_VERSION ) )
rm -f lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION)
@ -275,7 +277,8 @@ $(shlib): $(OBJS)
$( CC) -Xlinker -soname= $@ $( LDFLAGS_SL) -o $@ _APP_ $( OBJS) $( SHLIB_LINK)
e n d i f # PORTNAME == beos
e n d i f # shlib
e n d i f # enable_shared
##
@ -288,7 +291,7 @@ install-lib: install-lib-static install-lib-shared
install-lib-static : lib $( NAME ) .a
$( INSTALL_DATA) $< $( DESTDIR) $( libdir) /lib$( NAME) .a
i f d e f s h l i b
i f e q ( $( enable_shared ) , y e s )
install-lib-shared : $( shlib )
$( INSTALL_SHLIB) $< $( DESTDIR) $( libdir) /$( shlib)
i f n e q ( $( PORTNAME ) , w i n )
@ -304,7 +307,7 @@ ifneq ($(shlib), lib$(NAME)$(DLSUFFIX))
e n d i f
e n d i f # not win
e n d i f # shlib
e n d i f # enable_shared
##
@ -314,11 +317,11 @@ endif # shlib
.PHONY : uninstall -lib
uninstall-lib :
rm -f $( DESTDIR) $( libdir) /lib$( NAME) .a
i f d e f s h l i b
i f e q ( $( enable_shared ) , y e s )
rm -f $( DESTDIR) $( libdir) /lib$( NAME) $( DLSUFFIX) \
$( DESTDIR) $( libdir) /lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) \
$( DESTDIR) $( libdir) /lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) .$( SO_MINOR_VERSION)
e n d i f # shlib
e n d i f # enable_shared
##
@ -328,7 +331,9 @@ endif # shlib
.PHONY : clean -lib
clean-lib :
rm -f lib$( NAME) .a
i f e q ( $( enable_shared ) , y e s )
rm -f $( shlib) lib$( NAME) $( DLSUFFIX) .$( SO_MAJOR_VERSION) lib$( NAME) $( DLSUFFIX)
e n d i f
i f e q ( $( PORTNAME ) , w i n )
rm -rf $( NAME) .def
e n d i f