Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is something that has always bugged me. It seems like I always see build instructions for building and then installing something saying to do this:

make
sudo make install

Is there really any reason to call make? Doesn't sudo make install implicitly call make?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Technically, there is no reason why not - this really is based on how the makefile was set up. It is all designed around dependencies. If the 'install' target is made dependent on the rest of the product, then it would implicitly build the product as you are thinking.

The reason they are separated out is that you are usually going to do a 'make' as the unprivileged developer, and do the 'make install' with elevated privs. Usually you don't want to mix those actions.

share|improve this answer
add comment

The 2 commands do different things.

make - this reads the makefile for instructions on how to compile the sources. It builds the program and the end result is your binaries.

make install - this reads the makefile for the target install directory, and places the files created by make into their appropriate directories.

share|improve this answer
    
Isn't there at least one platform where make gets called by make install though? –  Jason Baker Nov 20 '09 at 2:07
    
You can call make with make install, make install looks for a label in the makefile called install and follows the directions below it. If you put make directives below it, you could do it all in one go. It's traditionally done the other way though, probably to prevent confusion so all software is installed the same. I don't know of any software I've built that allowed me to skip the make process. You'll also notice make install is prefixed with sudo because the make process can be done anywhere, make install moves files to directories that are usually write restricted from regular users. –  John T Nov 20 '09 at 2:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.