@matheusbsbs / matheus-bagliano / commits / 042f53c569
Fork 0

git-gui: Provide 'uninstall' Makefile target to undo an installation

Several users have requested a "make uninstall" target be provided in the stock git-gui Makefile so that they can undo an install if git-gui goes to the wrong place during the initial install, or if they are unhappy with the tool and want to remove it from their system. We currently assume that the complete set of files we need to delete are those defined by our Makefile and current source directory. This could differ from what the user actually has installed if they installed one version then attempt to use another to perform the uninstall. Right now I'm just going to say that is "pilot error". Users should uninstall git-gui using the same version of source that they used to make the installation. Perhaps in the future we could read tclIndex and base our uninstall decisions on its contents. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Sep 13, 2007 at 19:50 UTC 042f53c569c92b40e63c6993c8998d2aac22e383
1 file changed +27 -1
Makefile
+27 -1
@@ -31,6 +31,9 @@ ifndef INSTALL
31 INSTALL = install
32 endif
33
34 +RM_F ?= rm -f
35 +RMDIR ?= rmdir
36 +
37 INSTALL_D0 = $(INSTALL) -d -m755 # space is required here
38 INSTALL_D1 =
39 INSTALL_R0 = $(INSTALL) -m644 # space is required here
@@ -42,6 +45,12 @@ INSTALL_L1 = && ln # space is required here
45 INSTALL_L2 =
46 INSTALL_L3 =
47
48 +REMOVE_D0 = $(RMDIR) # space is required here
49 +REMOVE_D1 = || true
50 +REMOVE_F0 = $(RM_F) # space is required here
51 +REMOVE_F1 =
52 +CLEAN_DST = true
53 +
54 ifndef V
55 QUIET = @
56 QUIET_GEN = $(QUIET)echo ' ' GEN $@ &&
@@ -60,6 +69,12 @@ ifndef V
69 INSTALL_L1 = && src=
70 INSTALL_L2 = && dst=
71 INSTALL_L3 = && echo ' ' 'LINK ' `basename "$$dst"` '->' `basename "$$src"` && rm -f "$$dst" && ln "$$src" "$$dst"
72 +
73 + CLEAN_DST = echo ' ' UNINSTALL
74 + REMOVE_D0 = dir=
75 + REMOVE_D1 = && echo ' ' REMOVE $$dir && test -d "$$dir" && $(RMDIR) "$$dir" || true
76 + REMOVE_F0 = dst=
77 + REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_F) "$$dst"
78 endif
79
80 TCL_PATH ?= tclsh
@@ -146,6 +161,17 @@ install: all
161 $(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)'
162 $(QUIET)$(foreach p,$(ALL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true
163
164 +uninstall:
165 + $(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
166 + $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
167 + $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
168 + $(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(libdir_SQ)'
169 + $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/tclIndex $(REMOVE_F1)
170 + $(QUIET)$(foreach p,$(ALL_LIBFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
171 + $(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(REMOVE_D1)
172 + $(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(REMOVE_D1)
173 + $(QUIET)$(REMOVE_D0)`dirname '$(DESTDIR_SQ)$(libdir_SQ)'` $(REMOVE_D1)
174 +
175 dist-version:
176 @mkdir -p $(TARDIR)
177 @echo $(GITGUI_VERSION) > $(TARDIR)/version
@@ -154,6 +180,6 @@ clean::
180 rm -f $(ALL_PROGRAMS) lib/tclIndex
181 rm -f GIT-VERSION-FILE GIT-GUI-VARS
182
157 -.PHONY: all install dist-version clean
183 +.PHONY: all install uninstall dist-version clean
184 .PHONY: .FORCE-GIT-VERSION-FILE
185 .PHONY: .FORCE-GIT-GUI-VARS