Because each step does different things

Prepare(setup) environment for building

./configure

This script has lots of options that you should change. Like --prefix or --with-dir=/foo. That means every system has a different configuration. Also ./configure checks for missing libraries that should be installed. Anything wrong here causes not to build your application. That's why distros have packages that are installed on different places, because every distro thinks it's better to install certain libraries and files to certain directories. It is said to run ./configure, but in fact you should change it always.

For example have a look at the Arch Linux packages site. Here you'll see that any package uses a different configure parameter (assume they are using autotools for the build system).

Building the system

make

This is actually make all by default. And every make has different actions to do. Some do building, some do tests after building, some do checkout from external SCM repositories. Usually you don't have to give any parameters, but again some packages execute them differently.

Install to the system

make install

This installs the package in the place specified with configure. If you want you can specify ./configure to point to your home directory. However, lots of configure options are pointing to /usr or /usr/local. That means then you have to use actually sudo make install because only root can copy files to /usr and /usr/local.


Now you see that each step is a pre-requirement for next step. Each step is a preparation to make things work in a problemless flow. Distros use this metaphor to build packages (like RPM, deb, etc.).

Here you'll see that each step is actually a different state. That's why package managers have different wrappers. Below is an example of a wrapper that lets you build the whole package in one step. But remember that each application has a different wrapper (actually these wrappers have a name like spec, PKGBUILD, etc.):

def setup:
... #use ./configure if autotools is used

def build:
... #use make if autotools is used

def install:
... #use make all if autotools is used

Here one can use autotools, that means ./configure, make and make install. But another one can use SCons, Python related setup or something different.

As you see splitting each state makes things much easier for maintaining and deployment, especially for package maintainers and distros.

Answer from Fatih Arslan on Stack Overflow
🌐
Thoughtbot
thoughtbot.com › blog › the-magic-behind-configure-make-make-install
The magic behind configure, make, and make install
August 5, 2024 - A guide on how UNIX ./configure && make && make install utility works and where it comes from.
Top answer
1 of 4
130

Because each step does different things

Prepare(setup) environment for building

./configure

This script has lots of options that you should change. Like --prefix or --with-dir=/foo. That means every system has a different configuration. Also ./configure checks for missing libraries that should be installed. Anything wrong here causes not to build your application. That's why distros have packages that are installed on different places, because every distro thinks it's better to install certain libraries and files to certain directories. It is said to run ./configure, but in fact you should change it always.

For example have a look at the Arch Linux packages site. Here you'll see that any package uses a different configure parameter (assume they are using autotools for the build system).

Building the system

make

This is actually make all by default. And every make has different actions to do. Some do building, some do tests after building, some do checkout from external SCM repositories. Usually you don't have to give any parameters, but again some packages execute them differently.

Install to the system

make install

This installs the package in the place specified with configure. If you want you can specify ./configure to point to your home directory. However, lots of configure options are pointing to /usr or /usr/local. That means then you have to use actually sudo make install because only root can copy files to /usr and /usr/local.


Now you see that each step is a pre-requirement for next step. Each step is a preparation to make things work in a problemless flow. Distros use this metaphor to build packages (like RPM, deb, etc.).

Here you'll see that each step is actually a different state. That's why package managers have different wrappers. Below is an example of a wrapper that lets you build the whole package in one step. But remember that each application has a different wrapper (actually these wrappers have a name like spec, PKGBUILD, etc.):

def setup:
... #use ./configure if autotools is used

def build:
... #use make if autotools is used

def install:
... #use make all if autotools is used

Here one can use autotools, that means ./configure, make and make install. But another one can use SCons, Python related setup or something different.

As you see splitting each state makes things much easier for maintaining and deployment, especially for package maintainers and distros.

2 of 4
33

First, it should be ./configure && make && make install since each depends on the success of the former. Part of the reason is evolution and part of the reason is convenience for the development workflow.

Originally, most Makefiles would only contain the commands to compile a program and installation was left to the user. An extra rule allows make install to place the compiled output in a place that might be correct; there are still plenty of good reasons that you might not want to do this, including not being the system administrator, not want to install it at all. Moreover, if I am developing the software, I probably don't want to install it. I want to make some changes and test the version sitting in my directory. This becomes even more salient if I'm going to have multiple versions lying around.

./configure goes and detects what is available in the environment and/or is desired by the user to determine how to build the software. This is not something that needs to change very often and can often take some time. Again, if I am a developer, it's not worth the time to reconfigure constantly. More importantly, since make uses timestamps to rebuild modules, if I rerun configure there is a possibility that flags will change and now some of the components in my build will be compile with one set of flags and others with a different set of flags that might lead to different, incompatible behaviour. So long as I don't rerun configure, I know that my compilation environment remains the same even if I change my sources. If I rerun configure, I should make clean first, to remove any built sources to ensure things are built uniformly.

The only case where the three command are run in a row are when users install the program or a package is built (e.g., Debian's debuild or RedHat's rpmbuild). And that assumes that the package can be given a plain configure, which is not usually the case for packaging, where, at least, --prefix=/usr is desired. And pacakgers are like to have to deal with fake-roots when doing the make install part. Since there are lots of exceptions, making ./configure && make && make install the rule would be inconvenient for a lot of people who do it on a far more frequent basis!

Discussions

"configure && make && make install" cycle

Generally speaking ...

  1. "configure" (a) checks to make sure that your system meets whatever minimum requirements the program has; and (b) creates or customizes a compilation script (a "makefile") for your particular setup. It looks for things like what architecture you're running on, whether you have optional packages installed, whether your processor supports various extensions, etc. etc. Most large-scale programs can be compiled in various ways, and this is controlled by various flags passed to the compiler on your particular system. "Configure" figures out sensible defaults for these flags on your particular machine. (Often, they can be overridden by explicitly passing parameters to the "make" step if the "configure" script gets it wrong or you want to override its choices.)

  2. "Make" performs the actual compilation of the program. That is, it turns human-readable programming documents into machine-executable code. Often, the default options can be overridden by passing options explicitly on the command line.

  3. "Make install" puts the program binaries in sensible places where the system expects them to be. Often, this is the only place in the compilation cycle where you need administrative privileges (e.g., on Ubuntu and other Debian-based distributions, this is the only step you have to prefix with "sudo" to operate as the root user.)

EDIT: typo.

More on reddit.com
🌐 r/linuxquestions
6
10
January 31, 2015
software installation - What ./configure make and make install does - Unix & Linux Stack Exchange
I would like to know the exact background tasks that happen when you install an application from source. What happens when you run ./configure, make, and make install? I tried googling a bit about ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
February 27, 2015
Difference between configure/make/make install.
Hi, While installation of apache on linux, we perform the below tasks. 1) Untar 2) configure 3) make 4) make install. I wanted to understand the difference and working of configure/make/make install. Can any one help me understanding this? Thanks in advance. More on unix.com
🌐 unix.com
1
0
April 8, 2010
ELI5: Linux's 'configure', 'make', 'make install'
Configure finds all the libraries it needs, finds locations of compilers and system folders, discovers kernel version and so on. Make does the extremely long compiler lines for you, and make install (sudo make install normally) puts it into a system folder like /usr/bin/ Configure looks at the half built lego house you have, make makes the rest of the lego house separately and make install finishes the house off on top of the half built house. More on reddit.com
🌐 r/explainlikeimfive
15
46
September 24, 2012

Because each step does different things

Prepare(setup) environment for building

./configure

This script has lots of options that you should change. Like --prefix or --with-dir=/foo. That means every system has a different configuration. Also ./configure checks for missing libraries that should be installed. Anything wrong here causes not to build your application. That's why distros have packages that are installed on different places, because every distro thinks it's better to install certain libraries and files to certain directories. It is said to run ./configure, but in fact you should change it always.

For example have a look at the Arch Linux packages site. Here you'll see that any package uses a different configure parameter (assume they are using autotools for the build system).

Building the system

make

This is actually make all by default. And every make has different actions to do. Some do building, some do tests after building, some do checkout from external SCM repositories. Usually you don't have to give any parameters, but again some packages execute them differently.

Install to the system

make install

This installs the package in the place specified with configure. If you want you can specify ./configure to point to your home directory. However, lots of configure options are pointing to /usr or /usr/local. That means then you have to use actually sudo make install because only root can copy files to /usr and /usr/local.


Now you see that each step is a pre-requirement for next step. Each step is a preparation to make things work in a problemless flow. Distros use this metaphor to build packages (like RPM, deb, etc.).

Here you'll see that each step is actually a different state. That's why package managers have different wrappers. Below is an example of a wrapper that lets you build the whole package in one step. But remember that each application has a different wrapper (actually these wrappers have a name like spec, PKGBUILD, etc.):

def setup:
... #use ./configure if autotools is used

def build:
... #use make if autotools is used

def install:
... #use make all if autotools is used

Here one can use autotools, that means ./configure, make and make install. But another one can use SCons, Python related setup or something different.

As you see splitting each state makes things much easier for maintaining and deployment, especially for package maintainers and distros.

Answer from Fatih Arslan on Stack Overflow
Top answer
1 of 5
78

Make is a general purpose workflow program, usually used for compilation. But it can be used for anything.

When you do something like "make all", the make program executes a rule named "all" from a file in current directory named "Makefile". This rule usually calls the compiler to compile some source code into binaries.

When you do "make install", the make program takes the binaries from the previous step and copies them into some appropriate locations so that they can be accessed. Unlike on Windows, installation just requires copying some libraries and executables and there is no registry requirement as such. In short, "make install" just copies compiled files into appropriate locations.

2 of 5
54

make install does whatever the Makefile author wants it to do. Typically, by this point, it is too late to change the install directory, as it is often known earlier, during the build, so help files and configuration files can be referenced with the correct pathnames.

Many projects use the GNU Autotools to try to improve their portability among hardware and operating system differences. (Different Unix variants use slightly different headers for declarations of functions that are slightly off the usual path -- except most programs need one or another of the ones declared in different locations.)

When a project does use the Autotools, the normal mantra to install it is:

./configure
make
make install

The ./configure typically allows you to use a command line option like --prefix /opt/apache or something similar to specify a different pathname. /usr/local/ is a common default prefix. It is far easier for locally built software to live in one place and distribution-provided software to live in the "main directories": /usr/ /bin/, and so on. (Packagers are very careful to never touch files in /usr/local/ -- they know it is exclusively for system administrators.)

Anyway, the ./configure --prefix /path/to/new/prefix will set a variable in the Makefile that is available when compiling the program, modifying the manual pages so they point to the correct locations for files, modifying configuration files, etc. So make will build the software specifically for the install location you want and make install will install it into that location.

Most programs can run even without the final make install step -- just ./program_name will often start them up. This is definitely a per-project thing -- some, like postfix, qmail, etc., are made up of many different moving pieces and rely on them all working together. Others, like ls or su might be self-contained enough to execute fine from the directory they were built in. (This is not often useful -- but sometimes very useful.)

However, not all projects use the Autotools -- they are huge, complicated, and miserable to maintain. Hand-written Makefiles are much simpler to write, and I personally think just distributing a simple Makefile with configuration variables available is a lot easier on developers and users both. (Though the ./configure ; make ; make install mantra is really easy on users when it works.)

🌐
Wikipedia
en.wikipedia.org › wiki › Configure_script
configure script - Wikipedia
2 weeks ago - Install the result to an accessible ... shell to the directory that contains the source code, the following commands are typically executed: ./configure make make install ·...
🌐
Reddit
reddit.com › r/linuxquestions › "configure && make && make install" cycle
r/linuxquestions on Reddit: "configure && make && make install" cycle
January 31, 2015 -

I have seen, and am vaguely aware of the "configure && make && make install" cycle, but I would like a bit more detailed description of what each step is and why it exists. Any additional descriptions would be appreciated!

Top answer
1 of 2
12

Generally speaking ...

  1. "configure" (a) checks to make sure that your system meets whatever minimum requirements the program has; and (b) creates or customizes a compilation script (a "makefile") for your particular setup. It looks for things like what architecture you're running on, whether you have optional packages installed, whether your processor supports various extensions, etc. etc. Most large-scale programs can be compiled in various ways, and this is controlled by various flags passed to the compiler on your particular system. "Configure" figures out sensible defaults for these flags on your particular machine. (Often, they can be overridden by explicitly passing parameters to the "make" step if the "configure" script gets it wrong or you want to override its choices.)

  2. "Make" performs the actual compilation of the program. That is, it turns human-readable programming documents into machine-executable code. Often, the default options can be overridden by passing options explicitly on the command line.

  3. "Make install" puts the program binaries in sensible places where the system expects them to be. Often, this is the only place in the compilation cycle where you need administrative privileges (e.g., on Ubuntu and other Debian-based distributions, this is the only step you have to prefix with "sudo" to operate as the root user.)

EDIT: typo.

2 of 2
3

I love when this question is asked. Building from source, while an interesting learning experience in the *nix ecosystem, is actually an extremely useful skill!

It's the same as a carpenter using a bubble level instead of a laser, or a mechanic being able to tell a burnt valve based on the sound coming from the exhaust instead of a diagnostic run.

I'm digressing, but even when using an Ansible/Chef/Puppet you still need to know how to manage using config and Make to build things the way you need them.

That being said, u/patrickbrianmooney's post is the answer.

Find elsewhere
🌐
Pluralsight
pluralsight.com › blog › cloud
Troubleshooting ./configure, make and make install Tutorial | Pluralsight
Older releases generally use earlier version of the libraries / programs they depend upon.If the package that ./configure cannot find is a library (usually indicated by the package name being lib<something>), and you're sure you've got the right version installed, try to find the location where the library's files are located. If this directory is not included in your ld conf file (which is usually located at /etc/ld.conf or /etc/ld.so.conf) you should add it, and run ldconfig (usually located at /sbin/ldconfig). Please note that ldconfig should usually be executed with root permissions. If you don't know how to do that, have a look at the first point of Make install errors.Note: If you don't have access to the ld conf file, you can also add the directory to the LD_LIBRARY_PATH variable.
🌐
Baeldung
baeldung.com › home › installation › changing the install directory with make install
Changing the Install Directory with make install | Baeldung on Linux
March 18, 2024 - This path will be prepended to all installation directories. Let’s remove our previous installation and re-install diffutils using DESTDIR instead: $ rm -r /home/baeldung/diffutils $ make clean $ ./configure --prefix=/usr $ make $ make DESTDIR=/home/baeldung/diffutils install
🌐
The Linux Documentation Project
tldp.org › LDP › LG › current › smith.html
configure; make; make install - Linux Gazette
November 22, 2003 - Over and over I have heard people say that you just use the usual configure, make, make install sequence to get a program running. Unfortunately, most people using computers today have never used a compiler or written a line of program code. With the advent of graphical user interfaces and ...
🌐
SoByte
sobyte.net › post › 2021-11 › linux-configure-make-make-install
Linux software installation commands, CMMI process - SoByte
November 13, 2021 - The common targets for uninstallation are: make uninstall/distclean/veryclean, etc., but not every source package provides uninstallation, it is not a universal method, etc. By removing the separate directory set at compile time · If you set -prefix to a separate folder when compiling, just delete that folder, but if you compile and install to something like /usr, find a temporary directory and reinstall it, e.g. . /configure -prefix=/tmp/to_remove && make install
🌐
Earthly
earthly.dev › blog › autoconf
Using Autotools to Configure, Make, and Install a Program - Earthly Blog
July 11, 2023 - At its base, Autotools can help make your application more portable, give it the versatility to be installed on many different systems, and can automatically procure scripts to check where elements are, like the compiler for your program. In this article, you will learn how to use Autotools to package up an application and ship it. ... Using these tools, you will create two files, configure and Makefile.in.
🌐
University of Utah
math.utah.edu › docs › info › configure_3.html
Cygnus Configure - Using Configure
Install Locations: Where to install things once they are built ... Using the default configuration, make install creates a single tree of files, some of which are programs. The location of this tree is determined by the value of the variable prefix.
🌐
Unix.com
unix.com › unix for beginners q & a › unix for dummies questions & answers
Difference between configure/make/make install. - UNIX for Dummies Questions & Answers - Unix Linux Community
April 8, 2010 - Hi, While installation of apache on linux, we perform the below tasks. 1) Untar 2) configure 3) make 4) make install. I wanted to understand the difference and working of configure/make/make install. Can any one help me understanding this? Thanks in advance.
🌐
Arch Linux Forums
bbs.archlinux.org › viewtopic.php
configure make make install / Newbie Corner / Arch Linux Forums
May 4, 2005 - Those are tools for pacman to create packages that aren't available in any of the repo's. Instead of running "./configure && make && make install", you should make a PKGBUILD for the program you want to install and have pacman handle things: this way it's a lot easier to maintain installed programs.
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
Help using configure; make; make install - Linux Mint Forums
August 30, 2014 - Why compile from source when you can install from Synaptic? No need to make it difficult. “If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan ... cd path_to_the_unzipped_directory ./configure make sudo make install But it will only work when there is a file named "configure" in the extracted folder.
🌐
Reddit
reddit.com › r/explainlikeimfive › eli5: linux's 'configure', 'make', 'make install'
r/explainlikeimfive on Reddit: ELI5: Linux's 'configure', 'make', 'make install'
September 24, 2012 -

I just finished up installing ruby on a CentOS system and I can't for the life of me understand why I had to do these three steps. I googled around and it seems that this is the build system that all linux applications use. How does it work? And why execute three steps, why not just do 'make install'?

(I'm a java developer so I have very limited linux knowledge)

🌐
A Cloud Guru
acloudguru.com › blog › engineering › troubleshooting-configure-make-and-make-install-tutorial
Blog | Pluralsight
September 6, 2012 - Stay ahead with expert perspectives on AI, cloud, cybersecurity, software engineering, IT operations, and tech workforce trends from Pluralsight leaders and practitioners.
🌐
Iamhippo
iamhippo.com › home › the magic behind configure, make, make install
The magic behind configure, make, make install - 河马的深度解析
August 3, 2016 - If you’ve used any flavour of Unix for development, you’ve probably installed software from source with this magic incantation: ./configure make make install I know I’ve typed it a lot, but in my early days using Linux I didn’t really understand what it meant, I just knew that if I wanted to install software this…