threads / discuss / 1827

Add uninstall target to Makefile

Subject: Add uninstall target to Makefile

## tl;dr

9 messages between Sep 16, 2005 and Sep 18, 2005.

replies: 8people: 5as markdown or json

Martin Atukunda· Sep 16, 2005, 12:58 UTC · lore
Add the uninstall target to the Makefile.
Signed-off-by: Martin Atukunda <matlads@dsmagic.com>
--- 
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
Junio C Hamano· Sep 16, 2005, 17:08 UTC · re: Martin Atukunda · lore

Re: Add uninstall target to Makefile

Martin Atukunda <matlads@dsmagic.com> writes:
> Add the uninstall target to the Makefile.

Sorry, I absolutely detest other peoples' Makefiles that has this target. Why would anybody want this?

John W. Linville· Sep 16, 2005, 17:54 UTC · re: Junio C Hamano · lore

Re: Add uninstall target to Makefile

On Fri, Sep 16, 2005 at 10:08:04AM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> Martin Atukunda <matlads@dsmagic.com> writes:
> 
> > Add the uninstall target to the Makefile.
> 
> Sorry, I absolutely detest other peoples' Makefiles that has
> this target.  Why would anybody want this?

Is this a serious question? To uninstall the binaries e.g. if you installed them in the wrong place?

-- 
John W. Linville
linville@tuxdriver.com
Chris Wright· Sep 16, 2005, 18:08 UTC · re: John W. Linville · lore

Re: Add uninstall target to Makefile

* John W. Linville (linville@tuxdriver.com) wrote:
Show 5 quoted lines
> > Sorry, I absolutely detest other peoples' Makefiles that has
> > this target.  Why would anybody want this?
> 
> Is this a serious question?  To uninstall the binaries e.g. if you
> installed them in the wrong place?

Of course package manager will do better at this, but it is useful to be able to uninstall. However, I don't think Martin's external script with all the filenames hardcoded is the right approach. There are $(PROG) and $(SCRIPTS) which already know all these filenames.

thanks, -chris

John W. Linville· Sep 16, 2005, 19:19 UTC · re: Chris Wright · lore

Re: Add uninstall target to Makefile

On Fri, Sep 16, 2005 at 11:08:10AM -0700, Chris Wright wrote:
> Of course package manager will do better at this, but it is useful to be
> able to uninstall.  However, I don't think Martin's external script with
> all the filenames hardcoded is the right approach.  There are $(PROG)
> and $(SCRIPTS) which already know all these filenames.

I would agree with that. Definitely better to use the same Makefile vars used for install to do the uninstall.

John
-- 
John W. Linville
linville@tuxdriver.com
Junio C Hamano· Sep 16, 2005, 23:05 UTC · re: John W. Linville · lore

Re: Add uninstall target to Makefile

"John W. Linville" <linville@tuxdriver.com> writes:
Show 9 quoted lines
> On Fri, Sep 16, 2005 at 11:08:10AM -0700, Chris Wright wrote:
>
>> Of course package manager will do better at this, but it is useful to be
>> able to uninstall.  However, I don't think Martin's external script with
>> all the filenames hardcoded is the right approach.  There are $(PROG)
>> and $(SCRIPTS) which already know all these filenames.
>
> I would agree with that.  Definitely better to use the same Makefile
> vars used for install to do the uninstall.
True.  That is something I could live with.
Johannes Schindelin· Sep 16, 2005, 23:37 UTC · re: Junio C Hamano · lore

Re: Add uninstall target to Makefile

Hi,
On Fri, 16 Sep 2005, Junio C Hamano wrote:
Show 13 quoted lines
> "John W. Linville" <linville@tuxdriver.com> writes:
> 
> > On Fri, Sep 16, 2005 at 11:08:10AM -0700, Chris Wright wrote:
> >
> >> Of course package manager will do better at this, but it is useful to be
> >> able to uninstall.  However, I don't think Martin's external script with
> >> all the filenames hardcoded is the right approach.  There are $(PROG)
> >> and $(SCRIPTS) which already know all these filenames.
> >
> > I would agree with that.  Definitely better to use the same Makefile
> > vars used for install to do the uninstall.
> 
> True.  That is something I could live with.

Well, IMHO a package manager beats an uninstall target any time of a second. I know that I chose to checkinstall all projects I compiled myself so that I can be sure that no old version keeps lying around taking space for nothin'.

Ciao, Dscho

Martin Atukunda· Sep 18, 2005, 10:03 UTC · re: Chris Wright · lore

Re: Add uninstall target to Makefile

On Fri, Sep 16, 2005 at 11:08:10AM -0700, Chris Wright wrote:
Show 11 quoted lines
> * John W. Linville (linville@tuxdriver.com) wrote:
> > > Sorry, I absolutely detest other peoples' Makefiles that has
> > > this target.  Why would anybody want this?
> > 
> > Is this a serious question?  To uninstall the binaries e.g. if you
> > installed them in the wrong place?
> 
> Of course package manager will do better at this, but it is useful to be
> able to uninstall.  However, I don't think Martin's external script with
> all the filenames hardcoded is the right approach.  There are $(PROG)
> and $(SCRIPTS) which already know all these filenames.
The external script only removes the symlinks created by ./cmd-rename.sh
- Martin -
Junio C Hamano· Sep 16, 2005, 18:01 UTC · lore

Re: Add uninstall target to Makefile

Tony Luck <tony.luck@gmail.com> writes:
Show 7 quoted lines
> Perhaps it would be easier[1] to support "make obsolete-uninstall"
> that would remove
> objects installed by previous generations of git?
>
> -Tony
>
> [1] easier, nicer, cleaner, less detestable, whatever.

And how far back a release should we keep track of the name of obsolete versions? /usr/bin/git-uninstall for each particular version that knows what that version ships _might_ make some sense, but I do not see much point in having uninstall target in the Makefile. Should one be allowed to run make uninstall with bindir or DESTDIR set to different values from the ones used when 'make install' was run the last time? What about things like "make WITH_SEND_MAIL=YesPlease install"?

Guys, packaged distributions know how to remove obsolete binaries. OTOH if you are building from the source and installing, you are the only one who knows what you are installing and where.

← back to recent threads