Use of the Makefile automatic generation tool Autotools for Linux business Projects

Source: Internet
Author: User

We in peacetime study to compile our written source code generation executable file, we all know that with the GCC compiler tool can complete the task, more complicated, if we write more files, it is simple in the Linux environment to write the GCC command to compile it seems a little inefficient, At this time we certainly think of writing a makefile to complete such a slightly complicated compilation process, I think a lot of people are really doing so, so we go back to learn makefile syntax, in fact, if the amount of files compiled more, the dependencies between the files more complex, then we write a correct , the high efficiency of the makefile is not a very easy thing to do. In fact, I have experienced this scenario before, we install software under the Linux system, such as the third party's open source components, we downloaded the Open source component is also a bunch of source code, we need to execute the inside of the. config configuration script file, execute the Make command, and then execute the make The install can generate executable files that can be used, which we can use either statically or dynamically linked. In fact, as in commercial projects, we need to generate these tools in our source files, then package them, and then use the same process as above, and we'll show you how to use the Autotool tool to build.


Autotools Tool Set:


About these toolsets can be used in the official website to inquire about its use and role, the following main introduction if you use these tools:

1. First create our original file under Linux, hello.c:

2. Execute AutoScan, generate the Configure.scan file, and rename the file to Configure.ac


4. Execute aclocal generate ACLOCAL.M4 file, then call autoconf, Autoheader command, generate configure file, create a new file Makefile,am content as follows:


5. Execute the automake--add-missing command, in creating these files:


4. The makefile.in and configure files We need are now available in the catalogue.

5. Execute. Configure will generate the Mafile file in the current directory, now we can use make to compile the source code, use make install for the installation of the software, use make clean to do the anti-operation, made Dist Generate GZ packages for commercial release.


5. The entire process, as shown in:

Use of the Makefile automatic generation tool Autotools for Linux business Projects

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.