# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
-# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.98 2005/10/28 17:32:22 tgl Exp $
+# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.109 2007/02/20 22:45:57 momjian Exp $
#
#-------------------------------------------------------------------------
# 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
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
shlib_major = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
soname = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
ifeq ($(PORTNAME), aix)
- shlib = lib$(NAME)$(DLSUFFIX)
-# SHLIB_LINK += -lc
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ haslibarule = yes
endif
ifeq ($(PORTNAME), darwin)
ifneq ($(SO_MAJOR_VERSION), 0)
- version_link := -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+ version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
endif
ifeq ($(DLTYPE), library)
# linkable library
- DLSUFFIX := .dylib
- LINK.shared = $(COMPILER) -dynamiclib -install_name $(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) $(version_link) -multiply_defined suppress
+ DLSUFFIX = .dylib
+ LINK.shared = $(COMPILER) -dynamiclib -install_name $(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) $(version_link) $(exported_symbols_list) -multiply_defined suppress
else
# loadable module (default case)
- DLSUFFIX := .so
- LINK.shared = $(COMPILER) -bundle
+ 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)
ifeq ($(PORTNAME), hpux)
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
ifeq ($(with_gnu_ld), yes)
- LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
+ LINK.shared = $(CC) $(LDFLAGS_NO_L) -shared -Wl,-h -Wl,$(soname)
else
# can't use the CC-syntax rpath pattern here
rpath =
ifeq ($(enable_rpath), yes)
- LINK.shared = $(LD) +h $(soname) -b +b $(rpathdir)
+ LINK.shared = $(LD) +h $(soname) -b +b '$(rpathdir)'
else
LINK.shared = $(LD) +h $(soname) -b
endif
endif
ifeq ($(PORTNAME), linux)
- LINK.shared = $(COMPILER) -shared -Wl,-soname,$(soname)
+ LINK.shared = $(COMPILER) -shared -Wl,-soname,$(soname) $(exported_symbols_list)
endif
ifeq ($(PORTNAME), solaris)
ifeq ($(GCC), yes)
- LINK.shared = $(CC) -shared
+ LINK.shared = $(COMPILER) -shared # $(COMPILER) needed for -m64
else
- LINK.shared = $(CC) -G
+# CFLAGS added for X86_64
+ LINK.shared = $(CC) -G $(CFLAGS)
endif
ifeq ($(with_gnu_ld), yes)
LINK.shared += -Wl,-soname,$(soname)
haslibarule = yes
endif
-ifeq ($(PORTNAME), beos)
- shlib = lib$(NAME)$(DLSUFFIX)
- LINK.shared = $(LD) -nostart
- SHLIB_LINK += -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
-endif
-
ifeq ($(enable_rpath), yes)
SHLIB_LINK += $(rpath)
endif
all-shared-lib: $(shlib)
-ifndef LORDER
-MK_NO_LORDER := true
-endif
-
ifndef haslibarule
lib$(NAME).a: $(OBJS)
-ifdef MK_NO_LORDER
$(LINK.static) $@ $^
-else
- $(LINK.static) $@ `$(LORDER) $^ | tsort`
-endif
$(RANLIB) $@
endif #haslibarule
ifneq ($(PORTNAME), win32)
ifneq ($(PORTNAME), cygwin)
-ifneq ($(PORTNAME), beos)
ifneq ($(PORTNAME), aix)
# Normal case
else # PORTNAME == aix
# AIX case
-$(shlib): lib$(NAME).a
+$(shlib) lib$(NAME).a: $(OBJS)
+ $(LINK.static) lib$(NAME).a $^
+ $(RANLIB) lib$(NAME).a
$(MKLDEXPORT) lib$(NAME).a > lib$(NAME)$(EXPSUFF)
- $(COMPILER) $(LDFLAGS) $(LDFLAGS_SL) -o $@ $< -Wl,-bE:lib$(NAME)$(EXPSUFF) $(SHLIB_LINK)
+ $(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) lib$(NAME).a -Wl,-bE:lib$(NAME)$(EXPSUFF) $(SHLIB_LINK)
+ rm -f lib$(NAME).a
+ $(AR) $(AROPT) lib$(NAME).a $(shlib)
endif # PORTNAME == aix
-else # PORTNAME == beos
-
-# BEOS case
-$(shlib): $(OBJS)
- ln -fs $(top_srcdir)/src/backend/postgres _APP_
- $(CC) -Xlinker -soname=$@ $(LDFLAGS_SL) -o $@ _APP_ $(OBJS) $(SHLIB_LINK)
-
-endif # PORTNAME == beos
-
else # PORTNAME == cygwin
# Cygwin case
install-lib: install-lib-static install-lib-shared
install-lib-static: lib$(NAME).a
- $(INSTALL_STLIB) $< $(DESTDIR)$(libdir)/lib$(NAME).a
+ $(INSTALL_STLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).a'
ifeq ($(PORTNAME), darwin)
- cd $(DESTDIR)$(libdir) && \
+ cd '$(DESTDIR)$(libdir)' && \
ranlib lib$(NAME).a
endif
ifeq ($(enable_shared), yes)
install-lib-shared: $(shlib)
- $(INSTALL_SHLIB) $< $(DESTDIR)$(libdir)/$(shlib)
+# we don't install $(shlib) on AIX
+ifneq ($(PORTNAME), aix)
+ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
ifneq ($(shlib), $(shlib_major))
- cd $(DESTDIR)$(libdir) && \
+ cd '$(DESTDIR)$(libdir)' && \
rm -f $(shlib_major) && \
$(LN_S) $(shlib) $(shlib_major)
endif
ifneq ($(shlib), $(shlib_bare))
- cd $(DESTDIR)$(libdir) && \
+ cd '$(DESTDIR)$(libdir)' && \
rm -f $(shlib_bare) && \
$(LN_S) $(shlib) $(shlib_bare)
endif
endif # not win32
endif # not cygwin
+endif # not aix
endif # enable_shared
.PHONY: uninstall-lib
uninstall-lib:
- rm -f $(DESTDIR)$(libdir)/lib$(NAME).a
+ rm -f '$(DESTDIR)$(libdir)/lib$(NAME).a'
ifeq ($(enable_shared), yes)
- rm -f $(DESTDIR)$(libdir)/$(shlib_bare) \
- $(DESTDIR)$(libdir)/$(shlib_major) \
- $(DESTDIR)$(libdir)/$(shlib)
+ rm -f '$(DESTDIR)$(libdir)/$(shlib_bare)' \
+ '$(DESTDIR)$(libdir)/$(shlib_major)' \
+ '$(DESTDIR)$(libdir)/$(shlib)'
endif # enable_shared