Add uninstall target to Makefile

Also removes leftover directories if there isn't anything else in them.

https://todo.sr.ht/~sircmpwn/aerc2/179
This commit is contained in:
Lyle Hanson 2019-06-11 14:11:15 -05:00 committed by Drew DeVault
parent e56ceb099e
commit d3b5a76b4a
1 changed files with 20 additions and 1 deletions

View File

@ -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