3

FYI I'm on Mac OS X El Capitan.

I compile things using CMake and make on my machine on a day to day basis, but without so far having understood CMake or make in any respectable depth at all (I have found it difficult to find good tutorials on them in the past).

The command sudo make install always makes me nervous because I'm not sure if I can uninstall it later if I choose to.

I know that make -n install will do a "fake install" whereby it tells me what it would do without actually doing it, thus allowing me to figure out what the install did and how to reverse it manually; but that's a pain ...

I understand that if I'm lucky, the developers of the software would have made uninstall instructions and make uninstall would work.

My question is, (given that I don't know anything about make,) how do I quickly check if make uninstall will work, before I do sudo make install?

Is it as simple as text-searching the term "uninstall" in the Makefile or something like that?

5
  • Yes it is... :-) In the Makefile there are different sections. (You can enumerate them in the shell by pressing tab after you write make and before you press enter). Search the one with uninstall and check if it is all as you think. More easy to say than to do even because the makefile of a big program can be rather complex. Use an editor that has syntax highlighting. It will help a lot. Good luck.
    – Hastur
    May 13, 2016 at 9:29
  • Oh good. So much for the long question! Thank you. Your comment should be an answer.
    – Ray
    May 13, 2016 at 9:32
  • "Yes it is..." should be the shorter answer of SuperUser history :-). I added some words more...
    – Hastur
    May 13, 2016 at 9:44
  • 1
    make -n uninstall will show an error if there is no uninstall target.
    – DavidPostill
    May 13, 2016 at 11:26
  • Ah yes. That would be the quickest way to check if there is uninstall. I should have thought of that given what I already knew.
    – Ray
    May 13, 2016 at 11:37

1 Answer 1

3

Yes it is...

In the Makefile there are different sections.
You can enumerate them by pressing tab after you write make (but before you press enter ;-)).
Search the one with uninstall and check if it is all as you think.

By the way it is often more easy to say than to do, even because the Makefile of a big program can be rather complex. On the other side if it is complex maybe they take good care of the unistall section too.

Suggestion: use an editor that has syntax highlighting. It will help a lot.

You can do your Makefile for your own purposes, i.e. to create a pdf file from the Latex source too.

# Makefile .
default:
        @echo
        @echo "Possible builds are:"
        @echo " all"
        @echo " pdf"
        @echo " ps"
        @echo " clean"
        @echo

all:
        latex lett.01.tex
        dvips lett.01.dvi
        dvipdf lett.01.dvi

pdf: 
        latex lett.01.tex
        dvipdf lett.01.dvi

ps: 
        latex lett.01.tex
        dvips lett.01.dvi

clean:
        rm -f lett.01.pdf lett.01.ps
        rm -f *.log *.dvi *.aux *.end

References

  • The gnu make guide. (I know you are not with gnu, just for reference).
  • The first example simple enough about a make tutorial popped out from internet.
  • An example more complex, with variables and so on..
1
  • You can check for Makefile examples on your own system too with wc -l $(locate Makefile | grep -v "\.") and see the one of the length that you feel ready to face today... In the OP specific case you can restrict the search with a grep ninstall ...
    – Hastur
    May 13, 2016 at 10:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .