Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the functions of configure, make and make install commands respectively

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the ". / configure, make, make install command what function", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in-depth, together to study and learn ". / configure, make, make install command what is the role of it?"

These are typical installation steps for programs generated by AUTOCONF and AUTOMAKE using GNU

I. basic information

1. / configure is used to detect the target characteristics of your installation platform. For example, it will check if you have CC or GCC, it doesn't need CC or GCC, it's a shell script.

2. Make is used to compile. It reads instructions from Makefile and then compiles.

3. Make install is used to install. It also reads instructions from Makefile and installs to the specified location.

Note: AUTOMAKE and AUTOCONF are very useful for publishing C programs.

Second, explain in detail

1. Configure command

This step is generally used to generate Makefile, in preparation for the next step of compilation, you can add parameters after the configure to control the installation, such as code:. / configure-prefix=/usr means to install the software under / usr, the execution file will be installed in / usr/bin (instead of the default / usr/local/bin), and the resource files will be installed in / usr/share (instead of the default / usr/local/share). At the same time, you can set some software configuration files by specifying the-sys-config= parameter. Some software can also add-with,-enable,-without,-disable and other parameters to control the compilation, you can help by allowing. / configure-help to see the detailed instructions.

. / configure-- prefix=/usr/local/python2.6 means to install to the / usr/local/python2.6 directory

2 、 make

This step is compilation, through which most source code packages are compiled (of course, some software written by perl or python needs to be compiled by calling perl or python). If error appears in the make process, you should write down the error code (not just the last line), and then you can submit the bugreport to the developer (usually there is a commit address in INSTALL), or your system lacks some dependent libraries, which require careful study of the error code yourself.

Error that may be encountered: make * does not specify a destination and cannot find makefile. Stop it. The question is very clear, what to do without Makefile? it turns out that we have to configure first, and then make.

3 、 make insatll

This command is used to install (of course, some software needs to run make check or make test to do some testing), which generally requires you to have root permissions (because you have to write files to the system).

III. Extended instructions

Linux users may know that when installing an application under Linux, it is common to run the script configure, then compile the source program with make, run make install, and finally run make clean to delete some temporary files. Using the above three automated tools, you can generate configure scripts. Run the configure script to generate the Makefile file, and then you can run make, make install, and make clean.

Configure is a shell script, which can automatically configure the source program to meet the characteristics of Unix systems on different platforms, and generate appropriate Makefile files or C header files (header file) according to system parameters and environment, so that source programs can be easily compiled and linked on these different platforms.

At this point, you can run the configure script and run the configure script to produce a Makefile file that conforms to the GNU specification: $. / configure

At this point, you can run make to compile, run make install to install, and finally run make clean to delete temporary files.

$make$ make install (Note: you need sufficient permissions to run this) $make clean

The Makefile file generated by configure has several preset targets available, several of which are briefly described as follows:

Make all: generate the goal we set, that is, the executable in this example. You can just type make, where you will start compiling the source code, then link it, and produce an executable file.

Make clean: clears the executable and object files (object file,*.o) generated by the compilation.

Make distclean: in addition to clearing executable and target files, erase the Makefile generated by configure.

Make install: install the program into the system. If the source code compiles correctly and the execution results are correct, you can install the program to the system's default executable storage path. If you use the bin_ Program macro, the program will be installed to the / usr/local/bin directory.

Make dist: packages the program and related files into a compressed file for distribution. After execution, a file with the name PACKAGE-VERSION.tar.gz is generated in the directory. The variables PACKAGE and VERSION are based on the definition of AM_INIT_AUTOMAKE (PACKAGE,VERSION) in the configure.in file. In this example, a file for test-1.0.tar.gz is generated.

Make distcheck: similar to make dist, but added to check whether the packaged compressed file is normal. In addition to packaging the program and related files as tar.gz files, this goal will automatically unpack the compressed file, execute configure, and perform the action of make all. After confirming that the compilation is correct, it will show that the tar.gz file is ready for release. This check is very useful, checking the package that passes can basically be recompiled by anyone with a GNU development environment.

Thank you for your reading, the above is the content of "what is the function of. / configure, make, make install commands respectively". After the study of this article, I believe you have a deeper understanding of the role of. / configure, make, and make install commands, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report