From d3b5a76b4a8ad839991cb686711a0c0d24536d5e Mon Sep 17 00:00:00 2001 From: Lyle Hanson Date: Tue, 11 Jun 2019 14:11:15 -0500 Subject: Add uninstall target to Makefile Also removes leftover directories if there isn't anything else in them. https://todo.sr.ht/~sircmpwn/aerc2/179 --- Makefile | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0ad13e0..a2f92f6 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,25 @@ install: all install -m755 contrib/html $(SHAREDIR)/filters/html install -m755 contrib/plaintext $(SHAREDIR)/filters/plaintext +RMDIR_IF_EMPTY:=sh -c '\ +if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \ + rmdir $$0; \ +fi' + +uninstall: + $(RM) $(BINDIR)/aerc + $(RM) $(MANDIR)/man1/aerc.1 + $(RM) $(MANDIR)/man5/aerc-config.5 + $(RM) $(MANDIR)/man5/aerc-imap.5 + $(RM) $(MANDIR)/man5/aerc-smtp.5 + $(RM) $(MANDIR)/man7/aerc-tutorial.7 + $(RM) -r $(SHAREDIR) + ${RMDIR_IF_EMPTY} $(BINDIR) + $(RMDIR_IF_EMPTY) $(MANDIR)/man1 + $(RMDIR_IF_EMPTY) $(MANDIR)/man5 + $(RMDIR_IF_EMPTY) $(MANDIR)/man7 + $(RMDIR_IF_EMPTY) $(MANDIR) + .DEFAULT_GOAL := all -.PHONY: all doc clean install +.PHONY: all doc clean install uninstall -- cgit v1.2.3