Linux 命令./configure、make、make install

https://www.linuxidc.com/Linux/2011-02/32211.htm

These program steps are typical to install the GNU AUTOCONF and AUTOMAKE generated.

./configure is used to detect the target feature your installation platform. For example, it will detect that you are not a CC or GCC, CC is not needed or GCC, it is a shell script.
is used to make compiled, it reads instructions from the Makefile, then compiled.
make install is used to install, it also reads instructions from the Makefile, mounted to the specified location.

AUTOMAKE and AUTOCONF is something very useful to publish a C program.

-----
. 1, configure, this step is generally used to generate the Makefile, to prepare for the next compilation, you can be controlled by adding a parameter after installation configure, such as code: ./ configure -prefix = / usr means that the software is installed in / usr below, the executable file will be installed in / usr / bin (instead of the default / usr / local / bin), the resource file will be installed in / usr / share (instead of the default / usr / local / share). Meanwhile, some software configuration file you can set by specifying -sys-config = parameter. Some software can also add -with, -enable, -without, -disable etc. to control parameters to the compiler, you can help explain the detailed view by allowing ./configure -help.

2, make, this step is to compile the source code for most of the packages have been compiling this step (of course, some written in perl or python perl or python software needs to be called to compile). If the error occurs in the make process, you have to write down the error code (note not just the last line), then you can submit a bugreport to the developer (generally submitted to the address in the INSTALL years), or your system less dependent on a number of libraries, which require careful study of their own error code.

3, make insatll, this command to install (of course, some software you need to run make check or make test carried out some tests), this step generally requires you to have root privileges (because want to write to the file system).

-----
Linux users may know, when you install an application on Linux, usually the first to run the script configure, and then make to compile the source code, running make install, and finally run make clean to delete some temporary files. Using the above three automatic tool, you can generate the configure script. Run the configure script, you can generate the Makefile, you can then run make, make install and make clean.

configure is a shell script that can be set automatically to match the characteristics of the source code on a variety of platforms Unix systems, and generate the appropriate Makefile file, or C header file (header file) according to triple the number of systems and the environment, so that the source programs can be compiled easily connected to these different platforms.

At this point, you can run the configure script, run the configure script, you can generate a GNU Makefile file conforms to the specifications:
$ ./configure

By this time, we are ready to run make to compile, install a running make install, and finally run make clean to delete temporary files.
The make $
$ the make install (Note: this must have sufficient permissions to run)
$ Clean the make

Use the Makefile generated by configure There are several preset target is available, a few important summarized as follows:

make all: to generate the target we have set, that is, the executable file of this example. Can only make playing at this time will begin to compile the source code, and then link, and produce an executable file.

make clean: remove the compiler to generate the executable file and the target file (object file, * o.).

make distclean: In addition to removing the executable file and the target file, the Makefile configure the generated also removed.

make install: Setup to the system. If the source code to compile correctly, and correct the results, you can install the program to the system default executable file storage path. If bin_PROGRAMS macros, the program will be installed to / usr / local / bin directory.

make dist: program and related files packaged as a compressed file for publication. In executing the directory will have a PACKAGE-VERSION.tar.gz to the name of the file. PACKAGE and VERSION these two variables is defined configure.in file AM_INIT_AUTOMAKE (PACKAGE, VERSION) based. In this example, generates test-1.0.tar.gz file.

make distcheck: and make dist similar, but the compressed file after the added check the packaging is normal. In addition to this goal packing procedures and related documents into tar.gz file, it will also automatically unlock the compressed file, execute configure, operate and make all of confirming compile correct, this will be displayed tar.gz files available published. This check is useful, check the clearance of the bag, basically to anyone with a GNU development environment - people go to recompile.

Published 46 original articles · won praise 6 · views 7183

Guess you like

Origin blog.csdn.net/qq_35413770/article/details/105221605