Config, make, make install

Source: Internet
Author: User

    • Config/configure/configure
      • This 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
      • This step is generally used to generate Makefile, to prepare for the next compilation, you can control the installation by adding parameters after the Configure, such as:
        • ./configure--PREFIX=/USR
        • The above means that the software is installed in/usr below
        • The execution file will be installed in/usr/bin (not the default/usr/local/bin)
        • The resource file will be 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
        • There are also such parameters as:--with 、--enable 、--without 、--disable and so on, you can control the compilation with the./configure--help to see detailed instructions to help

Make depend if necessary

    • Make
      • This step is compiled, it reads the instruction from the makefile, and then compiles the
      • This step is compiled, and most of the source code packages are compiled in this step
      • Of course, some perl or Python-written 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.
        • Something went wrong .
    • Make Test/make Check
      • As the name implies, this step is to check the previous make, to ensure there is no error, that is, this step of test, check to all OK, error 0
    • sudo make install
      • This step is for installation, it also reads instructions from makefile, installs to the specified location
      • This command to install, generally requires that you have root permissions (because you want to write to the system file), so the previous use of sudo

The difference between make, make clean, make depend

1 Make

Compile the c\c++ file into a *.o file according to the rules established by makefile, and then build the executable file further

2 Make Clean

Delete Source code (c\c++ code) generated execution file and all intermediate target files

3 Make Depend

A makefile rule that, through all the c\c++ code in a scanner directory, determines the dependencies between files, such as B.h called in a.cc files (as in the case of include<b.h>), If the a.cc file is later changed, then only the a.cc file needs to be recompiled and no b.h files need to be compiled. Otherwise, all files need to be recompiled

How make Works


1. Make will find the file named "Makefile" or "Makefile" in the current directory.
2, if found, it will find the file in the first target file (target), in the above example, he will find "edit" This file, and put this file as the final target file.
3, if the edit file does not exist, or edit depends on the file modification time of the. o file is newer than the edit file, then he will execute the command defined later to generate the edit file.
4. If edit depends on the. o file, then make will find the dependency of the. o file in the current file and, if found, then generate the. o file according to that rule. (This is a bit like a stack of process)
5. Of course, your C files and h files are there, so make generates. o files and then uses. o File the ultimate task of life make, which is to execute the file edit.

Config, make, make install

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.