[2/3] sim: build: add uninstall support

Message ID 20221105082727.32094-2-vapier@gentoo.org
State Committed
Headers
Series [1/3] sim: build: move install steps to the top-level |

Commit Message

Mike Frysinger Nov. 5, 2022, 8:27 a.m. UTC
  This never worked before, but adding it to the common top-level dir
is pretty easy to do now that we're unified.
---
 sim/Makefile.am           |  8 +++++
 sim/Makefile.in           | 66 ++++++++++++++++++++++-----------------
 sim/common/Make-common.in |  1 +
 sim/erc32/local.mk        |  4 +++
 sim/ppc/Makefile.in       |  1 +
 5 files changed, 52 insertions(+), 28 deletions(-)
  

Patch

diff --git a/sim/Makefile.am b/sim/Makefile.am
index 523d8f8dec96..4e4068a3539f 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -63,6 +63,8 @@  SIM_ALL_RECURSIVE_DEPS =
 SIM_INSTALL_DATA_LOCAL_DEPS =
 ## Deps to add to the install-exec-local target.
 SIM_INSTALL_EXEC_LOCAL_DEPS =
+## Deps to add to the uninstall-local target.
+SIM_UNINSTALL_LOCAL_DEPS =
 
 # Generate target constants for newlib/libgloss from its source tree.
 # This file is shipped with distributions so we build in the source dir.
@@ -165,3 +167,9 @@  install-exec-local: installdirs $(SIM_INSTALL_EXEC_LOCAL_DEPS)
 			$(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
 		fi; \
 	done
+
+uninstall-local: $(SIM_UNINSTALL_LOCAL_DEPS)
+	rm -f $(DESTDIR)$(bindir)/run $(DESTDIR)$(libdir)/libsim.a
+	for d in $(SUBDIRS); do \
+		rm -f $(DESTDIR)$(bindir)/run-$$d $(DESTDIR)$(libdir)/libsim-$$d.a; \
+	done
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index bd50f052dae9..290fa2c171d9 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -322,6 +322,7 @@  stamp-modules: Makefile $(SIM_OBJS:.o=.c)
 
 install:
 installdirs:
+uninstall:
 
 check:
 
diff --git a/sim/erc32/local.mk b/sim/erc32/local.mk
index 3b858a671d80..36baeb96614c 100644
--- a/sim/erc32/local.mk
+++ b/sim/erc32/local.mk
@@ -23,3 +23,7 @@  sim-%D-install-exec-local: installdirs
 	$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
 	n=`echo sis | sed '$(program_transform_name)'`; \
 	$(INSTALL_PROGRAM) %D%/sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
+
+SIM_UNINSTALL_LOCAL_DEPS += sim-%D%-uninstall-local
+sim-%D%-uninstall-local:
+	rm -f $(DESTDIR)$(bindir)/sis
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 4fe4fd9597c0..d7b9df0819f4 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -845,3 +845,4 @@  install-pdf:
 
 install:
 installdirs:
+uninstall: