about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authorLyle Hanson <lyle2.0@gmail.com>2019-06-11 14:11:15 -0500
committerDrew DeVault <sir@cmpwn.com>2019-06-14 09:56:54 -0400
commitd3b5a76b4a8ad839991cb686711a0c0d24536d5e (patch)
tree7987766db72b56cafe59c885f407451de1eb365f /Makefile
parente56ceb099e23cf170750758c67f00713bff1cce1 (diff)
downloadaerc-d3b5a76b4a8ad839991cb686711a0c0d24536d5e.tar.gz
Add uninstall target to Makefile
Also removes leftover directories if there isn't anything else in them.

https://todo.sr.ht/~sircmpwn/aerc2/179
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 20 insertions, 1 deletions
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