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

What are the commands of Automake in Linux

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces what are the commands of Automake in Linux, which can be used for reference by interested friends. I hope you can learn a lot after reading this article.

1 、 autoscan

Autoscan is used to scan the source code directory to generate configure.scan files. Autoscan can take the directory name as a parameter, but if you don't use the parameter, then autoscan will assume that the current directory is being used. Autoscan will scan the source files in the directory you specified and create the configure.scan file.

2 、 configure.scan

Configure.scan contains the basic options for system configuration, which are all macro definitions. We need to rename it configure.in.

3 、 aclocal

Aclocal is a perl script. Aclocal automatically generates configure.in files according to the contents of aclocal.m4 files. Aclocal is defined as "aclocal-createaclocal.m4byscanningconfigure.ac".

4 、 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 your source code can be compiled on different operating system platforms.

The contents of the configure.in file are macros that are processed by autoconf and become shell scripts that check system features, environment variables, and parameters that the software must have. The order of macros in the configure.in file is not specified, but you must add AC_ int macros and AC_ output macros to the front and * * sides of all macros.

In configure.ini:

The # sign indicates a comment, and the rest of the macro will be ignored.

AC_INIT (FILE)

This macro is used to check the path of the source code.

AM_INIT_AUTOMAKE (PACKAGE,VERSION)

This macro is required and describes the name and version number of the package we are going to generate: PACKAGE is the name of the package and VERSION is the version number. When you use the makedist command, it will generate a helloworld-1.0.tar.gz-like software distribution with the name and version number of the corresponding package.

AC_PROG_CC

This macro will check the C compiler used by the system.

AC_OUTPUT (FILE)

This macro is the name of the Makefile we want to output.

When we use automake, we actually need to use some other macros, but we can use aclocal to help us generate automatically. After executing the aclocal, we will get the aclocal.m4 file.

Once the configure.in and aclocal.m4 macro files are generated, we can use autoconf to generate the configure file.

5 、 Makefile.am

Makefile.am is used to generate Makefile.in and requires you to write it by hand. Some things are defined in Makefile.am:

AUTOMAKE_OPTIONS

This is an option for automake. When executing automake, it checks the directory for the existence of various files that should be included in the standard GNU package, such as AUTHORS, ChangeLog, NEWS, and so on. When we set it to foreign, automake will be checked using the standard of the general software package.

Bin_PROGRAMS

This is the file name that specifies the executable we want to generate. If you want to generate multiple executables, separate the names with spaces.

Helloworld_SOURCES

This is the source code required to specify the generation of "helloworld". If it uses multiple source files, separate them with space symbols. For example, if you need helloworld.h,helloworld.c, please write it helloworld_SOURCES=helloworld.hhelloworld.c.

If you define multiple executables in bin_PROGRAMS, define a relative filename_SOURCES for each executable.

6 、 automake

We use automake--add-missing to generate Makefile.in.

Option-add-missing is defined as "addmissingstandardfilestopackage", which allows automake to add files necessary for a standard package.

The Makefile.in file we generated with automake conforms to the GNUMakefile convention, and then we just need to execute the shell script configure to produce the appropriate Makefile file.

7 、 Makefile

In Makefile, which conforms to GNUMakefiel conventions, some basic predefined operations are included:

Make

Compile source code according to Makefile, connect, generate object files, executable files.

Makeclean

Clears the object files (files with the suffix ".o") and executables generated by the last make command.

Makeinstall

Install the compiled executable file into the system directory, typically / usr/local/bin directory.

Makedist

Generate the release package file (that is, distributionpackage). This command will package the executable and related files into a tar.gz-compressed file that will be used as a package to distribute the software.

It generates a file with a name similar to "PACKAGE-VERSION.tar.gz" in the current directory. PACKAGE and VERSION are the AM_INIT_AUTOMAKE (PACKAGE,VERSION) that we defined in configure.in.

Makedistcheck

Generate and test the release package to determine the correctness of the release package. This operation will automatically unpack the compressed package file, then execute the configure command, and execute make to confirm that there is no error in the compilation, and * prompt you that the package is ready for release.

Helloworld-1.0.tar.gzisreadyfordistribution

Makedistclean

Similar to makeclean, but also removes all files generated by configure, including Makefile.

Thank you for reading this article carefully. I hope the article "what are the orders of Automake in Linux" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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