Add uninstall target to Makefile

From: Martin Atukunda <hidden>
Date: 2016-06-15 22:42:06
Subsystem: kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers: Nathan Chancellor, Nicolas Schier, Linus Torvalds

Add the uninstall target to the Makefile.

Signed-off-by: Martin Atukunda <redacted>
--- 
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -305,6 +305,15 @@ install-doc:
 	$(MAKE) -C Documentation install
 
 
+### Uninstallation rules
+
+uninstall:
+	-sh ./remove-cmd-rename.sh $(DESTDIR)$(bindir)
+	cd $(DESTDIR)$(bindir) && \
+	rm $(PROGRAMS) $(SCRIPTS) && \
+	rm git-cherry-pick && \
+	cd $(DESTDIR)$(GIT_PYTHON_DIR) && \
+	rm $(PYMODULES)
 
 
 ### Maintainer's dist rules
diff --git a/remove-cmd-rename.sh b/remove-cmd-rename.sh
new file mode 100644
--- /dev/null
+++ b/remove-cmd-rename.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+d="$1"
+test -d "$d" || exit
+
+while read name
+do
+	rm  -f "$d/$name"
+done <<\EOF
+git-add-script
+git-archimport-script
+git-bisect-script
+git-branch-script
+git-checkout-script
+git-cherry-pick-script
+git-clone-script
+git-commit-script
+git-count-objects-script
+git-cvsimport-script
+git-diff-script
+git-send-email-script
+git-fetch-script
+git-format-patch-script
+git-log-script
+git-ls-remote-script
+git-merge-one-file-script
+git-octopus-script
+git-parse-remote-script
+git-prune-script
+git-pull-script
+git-push-script
+git-rebase-script
+git-relink-script
+git-rename-script
+git-repack-script
+git-request-pull-script
+git-reset-script
+git-resolve-script
+git-revert-script
+git-sh-setup-script
+git-status-script
+git-tag-script
+git-verify-tag-script
+git-http-pull
+git-local-pull
+git-checkout-cache
+git-diff-cache
+git-merge-cache
+git-update-cache
+git-convert-cache
+git-fsck-cache
+EOF
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help