I know the process of installing from source are.
./configure
make
make install
But why "make" before /etc/cups/cupsd.conf, why not just do "make install"?
My understanding so far is "make" only compile the source into executable file, and "make install" actually place them into executable PATH folder, am I right?
If we want to install executable on the machine, can we just do
./configure
make install
Instead of 3 steps shown above.
When make is called with no parameters, it runs the first target, which usually simply compiles the project. make install maps to the install target, which usually does nothing more than copy binaries into their destinations.
The Makefile will normally be correct for your system, but you may occasionally be required to "tweak" it or correct errors manually. Installing the freshly built binaries into the appropriate system directories is usually a matter of running make install as root.
What does all of this do. The configure script is responsible for getting ready to build the software on your specific system. It makes sure all of the dependencies for the rest of the build and install process are available, and finds out whatever it needs to know to use those dependencies.
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.
When you run make
, you're instructing it to essentially follow a set of build steps for a particular target. When make
is called with no parameters, it runs the first target, which usually simply compiles the project. make install
maps to the install
target, which usually does nothing more than copy binaries into their destinations.
Frequently, the install
target depends upon the compilation target, so you can get the same results by just running make install
. However, I can see at least one good reason to do them in separate steps: privilege separation.
Ordinarily, when you install your software, it goes into locations for which ordinary users do not have write access (like /usr/bin
and /usr/local/bin
). Often, then, you end up actually having to run make
and then sudo make install
, as the install step requires a privilege escalation. This is a "Good Thing™", because it allows your software to be compiled as a normal user (which actually makes a difference for some projects), limiting the scope of potential damage for a badly-behaving build procedure, and only obtains root privileges for the install step.
make
without parameters takes the ./Makefile (or ./makefile) and builds the first target. By convention, this may be the all target, but not necessarily. make install
builds the special target, install. By convention, this takes the results of make all
, and installs them on the current computer.
Not everybody needs make install
. For example, if you build some a web app to be deployed on a different server, or if you use a cross-compiler (e.g. you build an Android application on a Linux machine), it makes no sense to run make install
.
In most cases, the single line ./configure && make all install
will be equivalent to the three-step process you describe, but this depends on the product, on your specific needs, and again, this is only by a convention.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With