Relationship between Configure. * And makefile. *

Source: Internet
Author: User
Tags perl script automake

Currently, many projects are using GUI compilers, such as kdevelop \ eclipse. It provides us with great convenience, but we still need to understand the compilation process. This article aims to briefly describe the source code (*. CPP &*. h) Compile the executable file and give a brief explanation of the generated intermediate file. An example is provided later.

Related Tips & explanations:

1. autoscan: scans source code to search for common portability problems, such as checking compilers, libraries, and header files to generate the file Configure. Scan, which is a prototype of Configure. ac.

Process: Your source files --> [autoscan *] --> [Configure. Scan] --> Configure. AC

2. aclocal: According to the macro installed, the macro in the User-Defined Macro and acinclude. M4 file defines the macro set required by the configure. AC file into the file aclocal. M4.

Aclocal is a Perl script program defined as "aclocal-create aclocal. M4 by scanning Configure. ac"

3. automake: automake creates the makefile. In structure defined in makefile. am.

The configure script then converts the generated makefile. In file to makefile. If some special macros are defined in Configure. AC, such as ac_prog_libtool, it will call libtoolize; otherwise, it will generate config. Guess and config. sub.

4. Autoconf: Expand the macro in Configure. AC to generate the configure script. The macro defined in aclocal. M4 may be used in this process.

5 ../configure Process

6. Make Process

[AutoConfig. H]-.
+ -----> Make * -----> Program

Never mind, that's not a problem ~, There is nothing to be afraid of, cause the following example I provided will show you the Guide. Perhaps you shoshould type the commands one by one for better understanding.

Example:

In the/home/panda/directory, VI is a hello. CPP file (of course, your [*. CPP &*. h] can be put here, but there must be no syntax errors), and complie it:

>>>> CD/home/panda/Hello/

>>>> VI hello. CPP/* write the source file hello. cpp */

[Code]

# Include <iostream>

Using namespace STD;

Int main ()

{

Cout <"Hello, RoboCup." <Endl;

Return 0;

}

[/Code]

>>>> Autoscan

>>>> MV Configure. Scan Configure. In

>>>> VI Configure. In

/* Configure. Scan, autoscan. Log have been generated */

/* Change Configure. Scan to configure. in. The last modification is as follows */

[Code]

#-*-Autoconf -*-

# Process this file with Autoconf to produce a configure script.

Ac_prereq (2.59)

Ac_init (full-package-name, version, bug-Report-address)

Ac_config_srcdir ([Hello. cpp])

# Ac_config_header ([config. H])

Am_init_automake (hello, 1.0)

# Checks for programs.

Ac_prog_cc

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

Ac_output (makefile)

[/Code]

>>>> Aclocal/* generate aclocal. M4 and autom4te. cache (Configure. In is involved when aclocal. M4 is generated )*/

>>>> Ls

>>>> Aclocal. M4 autom4te. cache autoscan. Log Configure. In hello. cpp

>>>> Antoconf/* generate configure (according to configure. In, and aclocal. M4 )*/

>>>> Ls

>>>> Aclocal. M4 autom4te. cache autoscan. Log configure Configure. In hello. cpp

>>>> VI makefile. AM/* write makefile. am */

>>>> VI makefile. AM

/* Write makefile. am */

[Code]

Automake_options = foreign

Bin_programs = Hello

Hello_sources = Hello. cpp

[/Code]

>>>> Automake

>>>> Automake -- add-missing/* generate makefile. In, depcomp, install-Sh, and missing (according to makefile. am, and aclocal. M4 )*/

>>>> Ls

>>>> Aclocal. M4 autom4te. cache autoscan. Log configure Configure. In depcomp hello. cpp install-SH makefile. Am makefile. In missing

>>>> Configure/* makefile, config. log, and config. Status */

/* Red indicates the command entered in the terminal, and italic indicates the source code */

This is a success.

I can't understand it now, or it doesn't matter if I am not clear enough. I just want to understand it. I can keep this article. As you study deeply, I will wait until the time is ripe for reference, the compilation process of C ++ in Linux will be more thorough.

Good luck!

Download link: http://download.csdn.net/detail/klcf0220/7703221

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.