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.

So after running configure file on source codes for different applications one enters make and make install to install the application. My question is what is the difference between make and make install?

share|improve this question

2 Answers 2

make looks for the first target in the Makefile. (GNU Make allows configuring this.)

make install looks for a target named exactly "install".

share|improve this answer
    
then why ones have to run both?! –  Naji Oct 24 '13 at 15:37
    
And then during "make" command process, no files then being copied anywhere, right? –  Naji Oct 24 '13 at 15:38
1  
@Naji Because some software developers just prefer it that way - one target to compile, and one to move the files to the destination on the file system ("install"). There's nothing saying you have to run both, or that everything that uses make must have an install target. There's absolutely no rules except what's defined in each specific Makefile, though there are general guidelines many developers follow. Normally guidelines are specific to smallish groups - there's an infinite number of ways to do things, many equally valid. –  Bob Oct 24 '13 at 15:38
    
@Bob The guideline that "building and installing should be separate" is followed by a huge majority, though. –  grawity Oct 24 '13 at 15:41
    
@Bob, so where are the files that are being compiled? –  Naji Oct 24 '13 at 15:41

Make install is one of various possible targets in a Makefile. As a simple example, the other very common one is clean: make clean, in general, cleans temporary files which are necessary/useful by-products of the compilation process, but which are no longer needed once the final executable has been produced.

Make install contains the instructions to insert the compiled product into the system, for instance by running the necessary depmod command which takes care of a module installation.

then why ones have to run both?!

Because the first one can be executed as a normal user, the second often requires system privileges.

If your next question is: then why not run both as sudo, then the answer is that not all installations are going to be used system-wide. For instance, if you do not have root privileges on a system you have access to, you may wish to compile and install a given package for your own exclusive use. In this case, you want to be able to compile it and pass it to the linker, but you cannot install it for use by all system users. In this case, the reason for the difference is obvious.

In other words, each stage of the installation process is organized so that it can be executed with the lowest possible privileges, which allows both system-wide and local installations, whenever this makes sense.

share|improve this answer

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.