Do you know this?

$ curl -O https://foo.com/bar-1.23.112-alpha-RC0.1.tar.gz
$ tar xzf bar* && cd bar*
$ ./configure
$ make
$ sudo make install

Then, I guess, you also know this.

$ sudo make uninstall
make: *** No rule to make target `uninstall'.  Stop.

To prevent this, you could use fpm to create a package for your distribution which is way easier to manage.

After a

$ make install DESTDIR=/tmp/pkg

you can create a deb or rpm with a:

$ fpm -s dir \
    -t deb \
    -n "git" \
    -v 1.9.0 \
    --prefix /usr/local \
    -C /tmp/pkg \
    bin lib libexec share
Created deb package {:path=>"git_1.9.0_amd64.deb"}
  • "-s dir" defines the source as a directory.
  • "-t deb" defines the target as a debian package.
  • "-n 'git'" defines the name of the package.
  • "-v 1.9.0" defines the version of the package.
  • "--prefix /usr/local" defines a prefix for all files installed from the created package
  • "-C /tmp/pkg" defines a path to which fpm changes before searching for the folders at the end of the command.
  • "bin lib libexec share" defines the names of the directories to pack into the package.

This command creates a deb in your $PWD named git_1.9.0_amd64.deb. If you want a rpm, just change -t deb to -t rpm.

Thanks a lot to Jordan Sissel for this timesaver!