Still more third thoughts: when linking shared libraries, LDFLAGS probably

needs to appear before anything placed in SHLIB_LINK.  This is because
SHLIB_LINK is typically a subset of LIBS, and LIBS has to appear after
LDFLAGS on platforms that are sensitive to the relative order of -L and -l
switches.
This commit is contained in:
Tom Lane 2010-07-06 03:55:33 +00:00
parent 0a4ecfe77e
commit 8307b092b7
1 changed files with 4 additions and 7 deletions

View File

@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.124 2010/07/05 18:54:37 tgl Exp $
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.125 2010/07/06 03:55:33 tgl Exp $
#
#-------------------------------------------------------------------------
@ -78,9 +78,6 @@ LINK.static = $(AR) $(AROPT)
# Automatically append LDFLAGS and LDFLAGS_SL to SHLIB_LINK
SHLIB_LINK += $(LDFLAGS) $(LDFLAGS_SL)
ifdef SO_MAJOR_VERSION
# Default library naming convention used by the majority of platforms
ifeq ($(enable_shared), yes)
@ -355,7 +352,7 @@ ifneq ($(PORTNAME), aix)
# Normal case
$(shlib): $(OBJS)
$(LINK.shared) -o $@ $(OBJS) $(SHLIB_LINK)
$(LINK.shared) -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
ifdef shlib_major
# If we're using major and minor versions, then make a symlink to major-version-only.
ifneq ($(shlib), $(shlib_major))
@ -389,7 +386,7 @@ $(shlib) $(stlib): $(OBJS)
$(LINK.static) $(stlib) $^
$(RANLIB) $(stlib)
$(MKLDEXPORT) $(stlib) >$(exports_file)
$(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(SHLIB_LINK)
$(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
rm -f $(stlib)
$(AR) $(AROPT) $(stlib) $(shlib)
@ -412,7 +409,7 @@ DLL_DEFFILE = lib$(NAME)dll.def
endif
$(shlib): $(OBJS) $(DLL_DEFFILE)
$(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
$(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
$(stlib): $(shlib) $(DLL_DEFFILE)
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@