Automatic generation of makefile files using the Automake tool under Linux

Source: Internet
Author: User

Linux environment, when the project is very large, the process of compiling is very complex, so need to use make tool, automatic compilation installation, but the handwriting makefile file is more complex, fortunately in the GNU program, designed a tool called Autoconf/automake, Used to automatically generate makefile files, which provides a convenient and quick entry for compiling and installing programs.

First, check whether the Autotools tool is installed with the which command
Aclocal AutoScan autoconf Autoheader automake


Second, installation Autotools
Since the Linux distribution is the Red-hat series of Centos7, use Yum to install autoconf and Automake


Third, new source files, in order to be simple and rapid, only use the classic program hello.c



Iv. execute the AutoScan command to generate the Configure.scan file, and modify it to configure.ac, if there is no this. ac file, execution of the aclocal command will be error-free


V. Modification of CONFIGURE.AC Parameters

The above parameters will be the same, and you need to add the Am_init_automake entry, note that it is the start of AM and not the AC


Vi. execute the aclocal command to generate the Aclocal.m4 file


Vii. execute the autoconf command to generate the Configure file


Viii. using the Autoheader command to generate a config.h.in file


Ix. Manual creation of makefile.am files
The Automake tool converts makefile.am into makefile.in files according to the parameters in the config.in. Before using Automake, you should manually establish the makefile.am file.


Use the Automake command to generate the Makefile.in file add option--add-missing You can have the Automake tool automatically add the necessary script files


Xi. execute the./configure command to generate the final makefile file


12, finally make a click, and then execute the./hello Run the program


----------Tail Language: Open source is a kind of faith, continuous learning is the only way forward!

Automatic generation of makefile files using the Automake tool under Linux

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.