From b8c0ec27378d317f45645dc190bbadd17e83d3b9 Mon Sep 17 00:00:00 2001
From: Jim Kingdon <jkingdon@engr.sgi.com>
Date: Wed, 20 Oct 1993 17:15:45 +0000
Subject: [PATCH] 	* Makefile.in (INTERNAL_LDFLAGS): New macro.  The new
 part is 	that we use CFLAGS and PROFILE_CFLAGS to link. 	(gdb, rapp,
 kdb): Use INTERNAL_LDFLAGS instead of 	LDFLAGS and/or GLOBAL_CFLAGS.

---
 gdb/ChangeLog   |  7 +++++++
 gdb/Makefile.in | 14 +++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0ef1cc21808..4681d087fd0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+Wed Oct 20 11:35:43 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+	* Makefile.in (INTERNAL_LDFLAGS): New macro.  The new part is
+	that we use CFLAGS and PROFILE_CFLAGS to link.
+	(gdb, rapp, kdb): Use INTERNAL_LDFLAGS instead of
+	LDFLAGS and/or GLOBAL_CFLAGS.
+
 Wed Oct 20 09:29:55 1993  Stu Grossman  (grossman at cygnus.com)
 
 	* Makefile.in:  Add $(srcdir) to all refs to 29k-share
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 8ad387bcb0e..21094a847c5 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -154,6 +154,14 @@ INTERNAL_CFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
 	$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) \
 	$(BFD_CFLAGS) $(MMALLOC_CFLAGS) $(INCLUDE_CFLAGS)
 
+# LDFLAGS is specifically reserved for setting from the command line
+# when running make.
+
+# Profiling options need to go here to work.
+# I think it's perfectly reasonable for a user to set -pg in CFLAGS
+# and have it work; that's why CFLAGS is here.
+INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) $(LDFLAGS)
+
 # We are using our own version of REGEX now to be consistent across
 # machines.
 REGEX = regex.o
@@ -484,7 +492,7 @@ init.c: munch $(OBS) $(TSOBS)
 # Removing the old gdb first works better if it is running, at least on SunOS.
 gdb: $(OBS) $(TSOBS) $(ADD_DEPS) $(CDEPS) init.o
 	rm -f gdb
-	$(CC-LD) $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdb \
+	$(CC-LD) $(INTERNAL_LDFLAGS) -o gdb \
 	  init.o $(OBS) $(TSOBS) $(ADD_FILES) $(CLIBS) $(LOADLIBES)
 
 saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c
@@ -520,7 +528,7 @@ gdb1: gdb
 rapp: $(RAPP_OBS)
 	rm -f rapp_init.c
 	$(srcdir)/munch $(MUNCH_DEFINE) $(RAPP_OBS) > rapp_init.c
-	$(CC-LD) $(LDFLAGS) -o $@ rapp_init.c $(RAPP_OBS)
+	$(CC-LD) $(INTERNAL_LDFLAGS) -o $@ rapp_init.c $(RAPP_OBS)
 
 config.status:
 	@echo "You must configure gdb.  Look at the README file for details."
@@ -559,7 +567,7 @@ xm-vaxbsd.h: xm-vax.h
 kdb:	$(NTSSTART) $(OBS) $(NTSOBS) $(ADD_DEPS) $(CDEPS)
 	rm -f init.c
 	$(srcdir)/munch $(MUNCH_DEFINE) $(OBS) $(NTSOBS) > init.c
-	$(CC) $(LDFLAGS) -c init.c $(CLIBS) 
+	$(CC) $(INTERNAL_LDFLAGS) -c init.c $(CLIBS) 
 	ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o $(ADD_FILES) \
 	  -lc $(CLIBS)