]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Feat: Makefile: uninstall target (thanks to Spenser Truex <truex@equwal.com>)
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 9 Sep 2025 15:21:50 +0000 (12:21 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 9 Sep 2025 15:21:50 +0000 (12:21 -0300)
ChangeLog
Makefile

index 2805106f9193580a2fb57960f62fdf77ed94b672..9f079a513bba427eac6b8ae6e4a9d0a7f883e6fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2025-09-09 - unreleased - Silvio Rhatto <rhatto@riseup.net>
+
+       Makefile: uninstall targets (thanks Spenser Truex <truex@equwal.com>).
+
 2025-01-04 - 0.6.0 - Silvio Rhatto <rhatto@riseup.net>
 
        Fix: check action now exits with non-zero status if there are expiring keys
index 59b9bc6177f6115fca61724e51bd5fdc504ced13..157a6f903f72aec0fbfdc50256e5cd275263d0d7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,8 @@ MANDIR        ?=$(PREFIX)/share/man
 ARCHIVE ?= tarballs
 INSTALL  = /usr/bin/install
 
+.PHONY: clean install_lib install_bin install_doc install_man install_completion install build_man tarball release debian web web_deploy uninstall
+
 clean:
        find . -name *~ | xargs rm -f # clean local backups
 
@@ -31,23 +33,56 @@ install_lib:
        $(INSTALL) -D -m 0755 -d share/keyringer/editors $(DESTDIR)/$(PREFIX)/share/$(PACKAGE)/editors
        $(INSTALL) -D -m 0644 share/keyringer/editors/* $(DESTDIR)/$(PREFIX)/share/$(PACKAGE)/editors
 
+uninstall_lib:
+       rm -f $(DESTDIR)/$(PREFIX)/lib/$(PACKAGE)/functions
+       rm -f $(DESTDIR)/$(PREFIX)/lib/$(PACKAGE)/actions/*
+       rmdir $(DESTDIR)/$(PREFIX)/lib/$(PACKAGE)/actions 2> /dev/null || true
+       rmdir $(DESTDIR)/$(PREFIX)/lib/$(PACKAGE) 2> /dev/null || true
+       rm -f $(DESTDIR)/$(PREFIX)/share/$(PACKAGE)/editors/*
+       rmdir $(DESTDIR)/$(PREFIX)/share/$(PACKAGE)/editors 2> /dev/null || true
+       rmdir $(DESTDIR)/$(PREFIX)/share/$(PACKAGE) 2> /dev/null || true
+       rmdir -p $(DESTDIR)/$(PREFIX)/lib 2>/dev/null || true
+
 install_bin:
        $(INSTALL) -D -m 0755 keyringer $(DESTDIR)/$(PREFIX)/bin/keyringer
 
+uninstall_bin:
+       rm -f $(DESTDIR)/$(PREFIX)/bin/keyringer
+       rmdir -p $(DESTDIR)/$(PREFIX)/bin 2>/dev/null || true
+
 install_doc:
        $(INSTALL) -D -m 0644 index.md $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE)/README.md
        $(INSTALL) -D -m 0644 LICENSE $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE)/LICENSE
 
+uninstall_doc:
+       rm -f $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE)/LICENSE
+       rm -f $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE)/README.md
+       rmdir $(DESTDIR)/$(PREFIX)/share/doc/$(PACKAGE) 2>/dev/null || true
+       rmdir $(DESTDIR)/$(PREFIX)/share/doc 2>/dev/null || true
+
 install_man:
        $(INSTALL) -D -m 0644 share/man/keyringer.1 $(DESTDIR)/$(MANDIR)/man1/keyringer.1
 
+uninstall_man:
+       rm -f $(DESTDIR)/$(PREFIX)/share/man/man1/keyringer.1
+       rmdir -p $(DESTDIR)/$(PREFIX)/share/man/man1 2> /dev/null || true
+
 install_completion:
        $(INSTALL) -D -m 0644 lib/keyringer/completions/bash/keyringer $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/keyringer
        $(INSTALL) -D -m 0644 lib/keyringer/completions/zsh/_keyringer $(DESTDIR)/$(PREFIX)/share/zsh/site-functions/_keyringer
 
+uninstall_completion:
+       rm -f $(DESTDIR)/$(PREFIX)/share/zsh/site-functions/_keyringer
+       rm -f $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/keyringer
+       rmdir -p $(DESTDIR)/$(PREFIX)/share/zsh/site-functions 2> /dev/null || true
+       rmdir -p $(DESTDIR)/$(PREFIX)/share/bash-completion/completions 2> /dev/null || true
+
 install: clean
        @make install_lib install_bin install_doc install_man install_completion
 
+uninstall: uninstall_completion uninstall_man uninstall_doc uninstall_bin uninstall_lib
+       rmdir -p $(DESTDIR)/$(PREFIX)/share 2>/dev/null || true
+
 build_man:
        # Pipe output to sed to avoid http://lintian.debian.org/tags/hyphen-used-as-minus-sign.html
        # Fixed in http://johnmacfarlane.net/pandoc/releases.html#pandoc-1.10-2013-01-19