Configure Make Install

NB: The better you understand C++, Linux The easier it will be to deal with configure make install

Before installation

First, you probably need to download the archive with the program you want to install.

For example, command for downloading python3.7:

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

Then unpack the archive.

tar -xf Python-3.7.0.tgz

And go to the newly unpacked directory.

cd Python-3.7.0

This directory will most likely contain a configure script.

Configure

Configure is not a command linux but a script that usually lies in a folder. configure

Team.

configure --prefix=/usr

This means that the installation prefix is /usr.

Binari goes to usr/bin
libraries in usr/lib
Check the availability of all necessary
A file is created. MakeFile


Prefix=PREFIX is a folder to install the program, instead of /, for example, can be /usr/local/, Then all files will be distributed not on the main file system, but in /usr/local.

-bindir=DIR - folder for executable files should be located in PREFIX;

-libdir=DIR - folder for hosting and searching libraries by default, also in PREFIX;

-includedir=DIR - folder for placing man pages;

Disable-opportunity - to disable this possibility;

-enable-opportunity - to enable an opportunity;

-with-library - similarly enable activates the specified library or header file;

Without library – this disable disables the use of the library.

Make

.cpp files are compiled into .o files

One .h file can be used by multiple .cpp files.

makefile You need to print fewer file names and options manually.

You can only build files that have changed.

Make is a tool that calls the compiler. You can specify that compiler. The one you need.

With the help of instructions in makefile, you can specify which files you need. compile again.

Let us consider an example of C++ .

The directory has three .cpp file, two .h file .o Files left over from the previous compilation.

All of them are necessary for the project and can not be combined into one file.

It is known that Example.cpp includes the file Second.h It has no other dependencies.

We wish that when we change ourselves Example.cpp or dependency Second.h began a new compilation Example.cpp and then new Example.o hooked up with the old Second.o and Third.o

For this we will write Makefile. aomake

all: simple simple: Example.o Second.o Third.o g++ Example.o Second.o Third.o - Simple Example.o: Example.cpp Second.h g++ -c Example.cpp

Retreats should be tabulated.

Look at the last two lines:

If Second.h or Example.cpp included Second.h) You need to compile the file. Example.cpp Then you get an object file. Example.o And as you can see from the first two lines, after the update Example.o All object files link.

The gain in this situation is We didn’t need to recompile. Second.cpp and Third.cpp We just re-linked the existing ones. Second.o Third.o new Example.o

To start this file you need to command add the option f and file name

make -f aomake

The file. Second.cpp two dependencies: Second.h and Third.h

The file. Third.cpp There's only one dependency: Third.h

Let us consider these dependencies in our aomake

all: simple simple: Example.o Second.o Third.o g++ Example.o Second.o Third.o - Simple Second.o: Second.cpp Second.h Third.h g++ -c Second.cpp Third.o: Third.cpp Third.h g++ -c Third.cpp Example.o: Example.cpp Second.h g++ -c Example.cpp

Another useful option is j.

make -j

-j - jobs Determine the number of jobs (commands) that are launched simultaneously.

If more than one -j option is specified, the latter option will apply.

If -j is given without argument Make will not limit the number of works being run simultaneously. I mean, An unlimited amount of work can be done simultaneously.

More information on Makefile can be found in the article «makefile tutorial»

Install

install

Make is not the only way to install Linux software. In fact, For more than forty years of the existence of the utility make many of its versions.

ru.wikipedia.org

gnu.org

Before putting something in the old-fashioned way with make install - I advise you to study checkinstall

Sources: make

Article author: Andrei Olegovich