Linux c File Compilation Trilogy Understanding: Configure,make,make Install

Source: Internet
Author: User
Tags gz file automake

? The download requires the following steps to be run./configure,make,make Install role

Typical installation steps for programs that are generated using GNU autoconf and Automake.

The./configure is used to detect the target characteristics of your installation platform. For example, it detects if you have CC or GCC, does not need CC or GCC, it is a shell script.
Make is used to compile, it reads the instruction from the makefile, and then compiles.
The make install is used to install, and it also reads instructions from makefile and installs to the specified location.

Automake and autoconf are very useful things to publish C programs.

-----
1, configure, this step is generally used to generate Makefile, to prepare for the next compilation, you can add parameters to the Configure after the installation control, such as code:./CONFIGURE–PREFIX=/USR means to install the software on/ Below usr, the execution file is installed in/usr/bin (instead of the default/usr/local/bin), and the resource file is installed in/usr/share (not the default/usr/local/share). At the same time, some software configuration files can be set by specifying the –sys-config= parameter. Some software can also add –with, –enable, –without, –disable, and so on to control the compilation, you can see the detailed instructions by allowing./configure–help to help.

2, make, this step is compiled, most of the source code packages are compiled this step (of course, some perl or Python writing software needs to call Perl or Python to compile). If error occurs during the make process, you need to write down the error code (note that it is not just the last line), and then you can submit a bugreport to the developer (usually with a submit address in the INSTALL), or your system will have fewer dependent libraries, which requires careful study of the error code.

3, make insatll, this command to install (of course some software needs to run make check or do test to do some testing), this step generally requires you to have root permissions (because you want to write to the system file).

-----
Linux users may know that when installing an application under Linux, it is common to run the script configure, then use make to compile the source program, run make install, and then run make clean to delete some temporary files. Using the three automated tools above, you can generate configure scripts. Run the Configure script, you can generate the makefile file, and you will be able to run make, makes install, and do clean.

Configure is a shell script that automatically sets up the source program to match the characteristics of UNIX systems on various platforms, and produces the appropriate makefile file or C header file based on the number of systems and environment. Make it easy for the source program to be compiled and connected on these different platforms.

At this point, you can run the Configure script and run the Configure script to produce a makefile file that complies with the GNU specification:
$./configure

At this point, you can run make to compile, install it on run make install, and then run makes clean to delete the temporary file.
$ make
$ make Install (note: Run this to have sufficient permissions)
$ make clean

There are several preset targets for using the makefile file produced by configure, several of which are summarized below:

Make all: produces the target we set, that is, the executable file in this example. Just hit make, which starts compiling the original code, then connecting it and generating the executable file.

Make clean: Clears the executable file and the target file (object FILE,*.O) generated by the compilation.

Make Distclean: In addition to clearing the executable and target files, the makefile generated by configure is also cleared away.

Make install: Installs the program to the system. If the original code compiles correctly, and the result is correct, the program can be installed to the system preset executable file storage path. If the Bin_programs macro is used, the program will be installed to the/usr/local/bin directory. Or the library file is copied to the appropriate directory.

Make Dist: Wraps the program and related files into a compressed file for publishing. After execution, a file named package-version.tar.gz is generated in the directory. The two variables for package and VERSION are based on the definition of Am_init_automake (package,version) in the configure.in file. In this example, test-1.0.tar.gz files are generated.

Make Distcheck: Similar to make dist, but added check that the compressed file after packaging is normal. This goal in addition to the program and related files wrapped into tar.gz file, will automatically unpack the compressed file, execute configure, and make the action of all, confirm the compilation is correct, will show that the tar.gz file is available for publishing. This check is very useful, check the clearance of the package, basically can give any one with the GNU development Environment-the person to recompile.

Reference: http://blog.csdn.net/tao546377318/article/details/52316447

Linux c File Compilation Trilogy Understanding: Configure,make,make Install

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.