From a3578c13e60aa11bfea8508822655bb7f5caf7c8 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Sat, 7 Oct 2000 18:43:23 +0000
Subject: [PATCH] Separate -Wl,-E or equivalent into separate make variable,
 since it's only necessary for the postgres/postmaster link, not every link.

---
 src/backend/Makefile            | 6 +++---
 src/makefiles/Makefile.beos     | 2 +-
 src/makefiles/Makefile.bsdi     | 2 +-
 src/makefiles/Makefile.freebsd  | 2 +-
 src/makefiles/Makefile.hpux     | 3 ++-
 src/makefiles/Makefile.linux    | 2 +-
 src/makefiles/Makefile.netbsd   | 2 +-
 src/makefiles/Makefile.openbsd  | 2 +-
 src/makefiles/Makefile.sco      | 2 +-
 src/makefiles/Makefile.univel   | 3 ++-
 src/makefiles/Makefile.unixware | 2 +-
 src/template/hpux               | 2 +-
 12 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/backend/Makefile b/src/backend/Makefile
index f6965ef563e..3b29f52307b 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.65 2000/09/17 13:02:30 petere Exp $
+# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.66 2000/10/07 18:43:22 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -37,7 +37,7 @@ all: postgres $(POSTGRES_IMP)
 ifneq ($(PORTNAME), win)
 
 postgres: $(OBJS)
-	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(export_dynamic)
 
 else # win
 
@@ -192,7 +192,7 @@ maintainer-clean: distclean
 # are up to date.  It saves the time of doing all the submakes.
 .PHONY: quick
 quick: $(OBJS)
-	$(CC) -o postgres $(OBJS) $(LDFLAGS)
+	$(CC) -o postgres $(OBJS) $(LDFLAGS) $(export_dynamic)
 
 depend dep: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
 	for i in $(DIRS); do $(MAKE) -C $$i $@; done
diff --git a/src/makefiles/Makefile.beos b/src/makefiles/Makefile.beos
index d9ebb4dee7f..bc8e9124626 100644
--- a/src/makefiles/Makefile.beos
+++ b/src/makefiles/Makefile.beos
@@ -1,6 +1,6 @@
 MK_NO_LORDER=true
 ifdef ELF_SYSTEM
-LDFLAGS += -Wl,-E
+export_dynamic = -Wl,-E
 CPPFLAGS+= -I$(top_srcdir)/src/backend/port/beos
 endif
 %.so: %.o
diff --git a/src/makefiles/Makefile.bsdi b/src/makefiles/Makefile.bsdi
index b1da0004cb7..a990758f6d7 100644
--- a/src/makefiles/Makefile.bsdi
+++ b/src/makefiles/Makefile.bsdi
@@ -2,7 +2,7 @@
 # if we defined .so in template/bsdi_4.0
 
 ifeq ($(DLSUFFIX), .so)
-LDFLAGS+= -export-dynamic
+export_dynamic = -export-dynamic
 endif
 
 %.so: %.o
diff --git a/src/makefiles/Makefile.freebsd b/src/makefiles/Makefile.freebsd
index e242b54e596..cb73676c6ca 100644
--- a/src/makefiles/Makefile.freebsd
+++ b/src/makefiles/Makefile.freebsd
@@ -1,5 +1,5 @@
 ifdef ELF_SYSTEM
-LDFLAGS+=	-export-dynamic
+export_dynamic = -export-dynamic
 endif
 
 %.so: %.o
diff --git a/src/makefiles/Makefile.hpux b/src/makefiles/Makefile.hpux
index de2b87d6138..d93501e5d5f 100644
--- a/src/makefiles/Makefile.hpux
+++ b/src/makefiles/Makefile.hpux
@@ -23,7 +23,8 @@ endif
 # so that the executables don't need SHLIB_PATH to be set, specify -z
 # to catch null pointer dereferences, and specify -E to make all symbols
 # visible to dynamically linked shared libraries.
-LDFLAGS+= -Wl,+b -Wl,$(libdir) -Wl,-z -Wl,-E
+LDFLAGS+= -Wl,+b -Wl,$(libdir) -Wl,-z
+export_dynamic = -Wl,-E
 
 # Rule for building shared libs (currently used only for regression test
 # shlib ... should go away, since this is not really enough knowledge)
diff --git a/src/makefiles/Makefile.linux b/src/makefiles/Makefile.linux
index 91e50d672db..d7f20ea86b0 100644
--- a/src/makefiles/Makefile.linux
+++ b/src/makefiles/Makefile.linux
@@ -1,4 +1,4 @@
-LDFLAGS+= -export-dynamic
+export_dynamic = -export-dynamic
 MK_NO_LORDER= true
 
 %.so: %.o
diff --git a/src/makefiles/Makefile.netbsd b/src/makefiles/Makefile.netbsd
index 14ebbfecf33..ef9fbbee641 100644
--- a/src/makefiles/Makefile.netbsd
+++ b/src/makefiles/Makefile.netbsd
@@ -1,5 +1,5 @@
 ifdef ELF_SYSTEM
-LDFLAGS += -Wl,-E
+export_dynamic = -Wl,-E
 endif
 %.so: %.o
 ifdef ELF_SYSTEM
diff --git a/src/makefiles/Makefile.openbsd b/src/makefiles/Makefile.openbsd
index 14ebbfecf33..ef9fbbee641 100644
--- a/src/makefiles/Makefile.openbsd
+++ b/src/makefiles/Makefile.openbsd
@@ -1,5 +1,5 @@
 ifdef ELF_SYSTEM
-LDFLAGS += -Wl,-E
+export_dynamic = -Wl,-E
 endif
 %.so: %.o
 ifdef ELF_SYSTEM
diff --git a/src/makefiles/Makefile.sco b/src/makefiles/Makefile.sco
index 325c9516bdf..f2e6108a082 100644
--- a/src/makefiles/Makefile.sco
+++ b/src/makefiles/Makefile.sco
@@ -1,5 +1,5 @@
 CFLAGS += -dy
-LDFLAGS += -W l,-Bexport
+export_dynamic = -W l,-Bexport
 
 %.so: %.o
 	$(LD) -G -Bdynamic -o $@ $<
diff --git a/src/makefiles/Makefile.univel b/src/makefiles/Makefile.univel
index 4048f3977b5..1fc4ee65d8f 100644
--- a/src/makefiles/Makefile.univel
+++ b/src/makefiles/Makefile.univel
@@ -1,4 +1,5 @@
-LDFLAGS+= -lc89 -Wl,-Bexport
+LDFLAGS+= -lc89
+export_dynamic = -Wl,-Bexport
 
 %.so: %.o
 	$(LD) -G -Bdynamic -o $@ $<
diff --git a/src/makefiles/Makefile.unixware b/src/makefiles/Makefile.unixware
index 442994ca4f7..51ca500bb1d 100644
--- a/src/makefiles/Makefile.unixware
+++ b/src/makefiles/Makefile.unixware
@@ -1,4 +1,4 @@
-LDFLAGS+= -Wl,-Bexport
+export_dynamic = -Wl,-Bexport
 
 %.so: %.o
 	$(LD) -G -Bdynamic -o $@ $<
diff --git a/src/template/hpux b/src/template/hpux
index bc3ac1ced86..91057f3c91f 100644
--- a/src/template/hpux
+++ b/src/template/hpux
@@ -7,7 +7,7 @@ if test "$GCC" = yes ; then
   DL_LIB=/usr/lib/libdld.sl
   CCC=g++
 else
-  CFLAGS='-Wl,-E -Ae'
+  CFLAGS=-Ae
   SHARED_LIB=+z
   CPP='cc -E -Ae'
   CCC=aCC
-- 
GitLab