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

How to realize Automation Engineering in GNU-Tool

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

How to realize the automation project in GNU-Tool, aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

1.autoscan

Autoscan is used to check the source files in a given directory and its subdirectory tree, and to scan the source code directory to generate configure.scan files. Autoscan can take the directory name as a parameter, or you can omit it, and autoscan will take the current directory as a parameter.

The configure.scan file is very important, it is the prototype of the configure.in file, by modifying the configure.scan to get the configure.in file.

2.aclocal

Aclocal is a perl scripting program. Aclocal automatically generates configure.in files according to the contents of aclocal.m4 files. Aclocal is defined as "aclocal-create aclocal.m4 by scanning configure.ac"

3.autoconf

Autoconf is used to generate configure files. Configure is a script that can set up source programs to adapt to different operating system platforms and generate appropriate Makefile according to different systems, so that the source code can be compiled on different operating system platforms.

4.autoheader

Autoheader is responsible for generating config.h.in files. This tool typically copies symbol definitions that users add from acconfig.h files.

5.automake

Automake is one of the most important members in the toolset. It invokes the script file Makefile.am and eventually generates the configure file. We automatically generate makefile by calling the configure file.

Step 1: scan the local directory

Autoscan

The second step is to rename the ac file.

Mv configure.scan configure.ac

Part III Editor configure.ac

Step 4: configure.ac file macro description:

The autoconf version required by the AC_PRERREQ macro declaration file

AC_INIT macros are used to define information such as the name and version of the software.

Where FULL-PACKAGE-NAME represents the name of the software

VERSION is the version number of the software

BUG-REPORT-ADDRESS is generally the author's E-mail

Description of file macro order:

AC_INIT

Test program

Test function library

Test header file

Test type definition

Test structure

Test compiler features

Test library function

Test system call

AC_OUTPUT

Add the following two macros to the configure.ac file

AM_INIT_AUTOMAKE ([- Wall-Werror foreign]) generates make parameters

The AC_CONFIG_FILES ([Makefile]) macro is used to generate the corresponding Makefile file

Step 5 you might generate an aclocal.m4 here, which mainly deals with local macro definitions:

Aclocal

Step 6: generate the configure file

Autoconf

Step 7 generate the configuration header file

Autoheader

The eighth step is to create Makefile.am and add compiled object files and source files.

Makefile.am

Step 9: generate the Makefile file

Automake-add-missing

Step 10 compile configuration

. / configure-- prefix=$ (pwd) / install

Step 11

Make & & make install

Simple:

Makefile.am

SUBDIRS = srcdist_doc_DATA = README.md

README.md

Some doc.

Configure.ac

AC_INIT ([automake_hello_world], [bug-automake@gnu.org]) AM_INIT_AUTOMAKE ([- Wall-Werror foreign]) AC_PROG_CCAC_CONFIG_HEADERS ([config.h]) AC_CONFIG_FILES ([Makefile src/Makefile]) AC_OUTPUT

Src/Makefile.am

Bin_PROGRAMS = autotools_hello_worldautotools_hello_world_SOURCES = main.c

Src/main.c

# include # include int main (void) {puts ("Hello world from" PACKAGE_STRING); return 0;}

Usage

Autoreconf-installmkdir buildcd build../configuremakesudo make installautoconf_hello_worldsudo make uninstall

This outputs:

Hello world from automake_hello_world 1.0 on how to achieve automation in GNU-Tool engineering questions shared here, I hope the above content can be of some help to you, if you still have a lot of doubts to solve, you can follow the industry information channel to learn more related knowledge.

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

Servers

Wechat

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

12
Report