From bbb639c5aa8a621dce5a280b14974529d1802142 Mon Sep 17 00:00:00 2001 From: Ansa89 Date: Fri, 3 Apr 2015 13:04:28 +0200 Subject: [PATCH] Makefile: add uninstall target --- cfg/targets/help.mk | 13 +++++++------ cfg/targets/uninstall.mk | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 cfg/targets/uninstall.mk diff --git a/cfg/targets/help.mk b/cfg/targets/help.mk index 7bca5bd..fba1c8f 100644 --- a/cfg/targets/help.mk +++ b/cfg/targets/help.mk @@ -1,12 +1,13 @@ # Help target help: @echo "-- Targets --" - @echo " all: Build toxic and documentation [DEFAULT]" - @echo " toxic: Build toxic" - @echo " doc: Build documentation" - @echo " install: Build toxic and install it in PREFIX (default PREFIX is \"$(abspath $(PREFIX))\")" - @echo " clean: Remove built files" - @echo " help: This help" + @echo " all: Build toxic and documentation [DEFAULT]" + @echo " toxic: Build toxic" + @echo " doc: Build documentation" + @echo " install: Build toxic and install it in PREFIX (default PREFIX is \"$(abspath $(PREFIX))\")" + @echo " uninstall: Remove toxic from PREFIX (default PREFIX is \"$(abspath $(PREFIX))\")" + @echo " clean: Remove built files" + @echo " help: This help" @echo @echo "-- Variables --" @echo " DISABLE_X11: Set to \"1\" to force building without X11 support" diff --git a/cfg/targets/uninstall.mk b/cfg/targets/uninstall.mk new file mode 100644 index 0000000..bc60ef8 --- /dev/null +++ b/cfg/targets/uninstall.mk @@ -0,0 +1,24 @@ +# Uninstall target +uninstall: + @echo "Removing toxic executable" + @rm -f $(abspath $(DESTDIR)/$(BINDIR)/toxic) + + @echo "Removing desktop file" + @rm -f $(abspath $(DESTDIR)/$(APPDIR)/$(DESKFILE)) + + @echo "Removing data files" + @for f in $(DATAFILES) ; do \ + rm -f $(abspath $(DESTDIR)/$(DATADIR)/$$f) ;\ + done + @for f in $(SNDFILES) ; do \ + rm -f $(abspath $(DESTDIR)/$(DATADIR)/sounds/$$f) ;\ + done + + @echo "Removing man pages" + @for f in $(MANFILES) ; do \ + section=$(abspath $(DESTDIR)/$(MANDIR))/man`echo $$f | rev | cut -d "." -f 1` ;\ + file=$$section/$$f ;\ + rm -f $$file $$file.gz ;\ + done + +.PHONY: uninstall