Make

From LQWiki
Jump to: navigation, search

Make is a software tool that is generally used when compiling software from source. It allows the (re)compilation progress to be performed more efficiently and automates the construction of each software component into one, single program. Most software can be installed from a prepared package such as RPM or dpkg file, but many new software packages don't have someone maintaining a package for each system. This is where building software from source comes in, with Make automating the process, leaving the installation to be generally a three step process.

Make uses a special configuration file, called a Makefile, to tell it how to proceed.

Using make to install software

Make generally has two uses - using it to build software that you have written yourself, or to build and install software from others. Most users will want to use these instructions that cover how to install software from others, using the make tool.

Example install using make

Assuming that you don't need to specify any special configurations, when you install software from the source, you generally run it like this:

  $ ./configure
  $ make
  $ sudo make install

Unless you've set your permissions to allow your user to create directories in the various /usr directories, you will need to switch user (su) to root in order to run "make install".

Installing silently

Some folks like to see the whiz of configuration scripts and Makefiles buzzing by as their software installs. Others just want it to do it's jump and report back any errors. If you fall into the latter of these two groups, here's the magic parameters:

  $ ./configure -q
  $ make -s
  $ sudo make -s install

This will run each of the three steps silently and only report back what is needed. Generally, you'll just see a success message or an error message.

Stacking install commands into one line

One can use a shell feature to make sure that programs are executed in order - ie., if configure fails, the general process stops. The && command is used as such:

  # ./configure -q && make -s && make -s install

This will run the configure script, if it succeeds, it will run make, if that succeeds, it will finally run make install. Generally, you'll only want to do this on software that you know is going to install without a hitch. It's easier to track down problems when you're doing things one step at a time, but after the 10th installation on the same configuration, you should be clear to run all of the commands at once.

Find out what it does

If make fails, you might want to know what it was doing. To have make display all the commands it performs, use

make VERBOSE=1

See also