66# Copyright (c) 1998, Regents of the University of California
77#
88# IDENTIFICATION
9- # $PostgreSQL: pgsql/src/Makefile.shlib,v 1.94 2005/07/13 02:11:57 momjian Exp $
9+ # $PostgreSQL: pgsql/src/Makefile.shlib,v 1.95 2005/07/13 17:00:44 tgl Exp $
1010#
1111#-------------------------------------------------------------------------
1212
@@ -73,6 +73,9 @@ LINK.static = $(AR) $(AROPT)
7373
7474ifeq ($(enable_shared), yes)
7575
76+ # Insert -L from LDFLAGS after any -L already present in SHLIB_LINK
77+ SHLIB_LINK := $(filter -L%, $(SHLIB_LINK)) $(filter -L%, $(LDFLAGS)) $(filter-out -L%, $(SHLIB_LINK))
78+
7679# Default shlib naming convention used by the majority of platforms
7780shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
7881shlib_major = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
@@ -150,9 +153,6 @@ endif
150153
151154ifeq ($(PORTNAME), hpux)
152155 shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
153- ifeq ($(GCC), yes)
154- SHLIB_LINK += `$(CC) $(LDFLAGS) -print-libgcc-file-name`
155- endif
156156 ifeq ($(with_gnu_ld), yes)
157157 LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
158158 else
@@ -168,9 +168,13 @@ ifeq ($(PORTNAME), hpux)
168168 # ld can find the same libraries gcc does. Make sure it goes after any
169169 # -L switches provided explicitly.
170170 ifeq ($(GCC), yes)
171- SHLIB_LINK += -L /usr/local/lib
171+ SHLIB_LINK := $(filter -L%, $(SHLIB_LINK)) -L /usr/local/lib $(filter-out -L%, $(SHLIB_LINK))
172172 endif
173173 endif
174+ # do this last so above filtering doesn't pull out -L switches in LDFLAGS
175+ ifeq ($(GCC), yes)
176+ SHLIB_LINK += `$(CC) $(LDFLAGS) -print-libgcc-file-name`
177+ endif
174178endif
175179
176180ifeq ($(PORTNAME), irix)
@@ -247,7 +251,6 @@ ifeq ($(PORTNAME), beos)
247251 SHLIB_LINK += -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
248252endif
249253
250- SHLIB_LINK := $(filter -L%, $(SHLIB_LINK)) $(filter -L%, $(LDFLAGS)) $(filter-out -L%, $(SHLIB_LINK))
251254ifeq ($(enable_rpath), yes)
252255SHLIB_LINK += $(rpath)
253256endif
0 commit comments