gdb/gdbserver: fix uninstall makefile rules

Message ID 20211006110916.2491495-1-andrew.burgess@embecosm.com
State New
Headers show
Series
  • gdb/gdbserver: fix uninstall makefile rules
Related show

Commit Message

Andrew Burgess Oct. 6, 2021, 11:09 a.m.
I noticed that after running:

  $ make install-gdb install-gdbserver

and then:

  $ make -C gdb uninstall && make -C gdbserver uninstall

the install destination looks like:

  install
  |-- bin
  |   `-- gdb-add-index
  |-- include
  |   `-- gdb
  |       `-- jit-reader.h
  |-- lib
  |   `-- libinproctrace.so
  `-- share
      |-- gdb
      |-- info
      |   `-- dir
      `-- man
          |-- man1
          `-- man5

We've left 3 files behind.  This is because the uninstall rules in
gdb/ and gdbserver/ have gotten out of sync with the install rules.
This commit adds the missing commands to the uninstall rules to delete
the extra files.
---
 gdb/Makefile.in       | 9 +++++++++
 gdbserver/Makefile.in | 5 ++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

-- 
2.25.4

Comments

Tom Tromey Oct. 19, 2021, 6:56 p.m. | #1
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:


Andrew> We've left 3 files behind.  This is because the uninstall rules in
Andrew> gdb/ and gdbserver/ have gotten out of sync with the install rules.
Andrew> This commit adds the missing commands to the uninstall rules to delete
Andrew> the extra files.

Thanks.  I sent nearly the same patch today, oops.
I didn't read through the whole list before sending...

Anyway yours looks good to me.

Tom

Patch

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 5a3bb952279..889dbf2abc4 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1820,6 +1820,7 @@  uninstall: force $(CONFIG_UNINSTALL)
 		fi ; \
 		rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
 		      $(DESTDIR)$(man1dir)/$$transformed_name.1
+		rm -f $(DESTDIR)$(includedir)/gdb/jit-reader.h
 	if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
 	then \
 	  transformed_name=`t='$(program_transform_name)'; \
@@ -1831,6 +1832,14 @@  uninstall: force $(CONFIG_UNINSTALL)
 		  fi ; \
 		  rm -f $(DESTDIR)$(bindir)/$$transformed_name; \
 	fi
+	transformed_name=`t='$(program_transform_name)'; \
+			  echo gdb-add-index | sed -e "$$t"` ; \
+	if test "x$$transformed_name" = x; then \
+	  transformed_name=gdb-add-index ; \
+	else \
+	  true ; \
+	fi ; \
+	rm -f $(DESTDIR)$(bindir)/$$transformed_name
 	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
 
 # The C++ name parser can be built standalone for testing.
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index 12e9b2777ae..2de55e393d5 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -351,7 +351,10 @@  install-strip:
 uninstall: force
 	n=`echo gdbserver | sed '$(program_transform_name)'`; \
 	if [ x$$n = x ]; then n=gdbserver; else true; fi; \
-	rm -f $(DESTDIR)/$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(man1dir)/$$n.1
+	rm -f $(DESTDIR)/$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(man1dir)/$$n.1; \
+	if [ x"$(IPA_DEPFILES)" != x ]; then \
+		rm -f $(DESTDIR)$(libdir)/$(IPA_LIB); \
+	fi;
 
 installcheck:
 check: