Automake
Encyclopedia
GNU Automake is a programming tool
Programming tool
A programming tool or software development tool is a program or application that software developers use to create, debug, maintain, or otherwise support other programs and applications...

 that produces portable makefiles for use by the make program, used in compiling software. It is made by the Free Software Foundation as one of GNU
GNU
GNU is a Unix-like computer operating system developed by the GNU project, ultimately aiming to be a "complete Unix-compatible software system"...

 programs, and is part of the GNU build system
GNU build system
The GNU build system, also known as the Autotools, is a suite of programming tools designed to assist in making source-code packages portable to many Unix-like systems....

. The makefiles produced follow the GNU Coding Standards
GNU Coding Standards
The GNU Coding Standards are a set of rules and guidelines for writing programs that work consistently within the GNU system. The GNU Coding Standards were written by Richard Stallman and other GNU Project volunteers. The standards document is part of the GNU Project and is available from the GNU...

.

It is written in the Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 and must be used with GNU autoconf
Autoconf
GNU Autoconf is a tool for producing configure scripts for building, installing and packaging software on computer systems where a Bourne shell is available....

. Automake contains the following commands:
  • aclocal
  • automake


aclocal, however, is a general-purpose program that can be useful to autoconf users. The GNU Compiler Collection
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

, for example, uses aclocal even though its makefile is hand written.

Like Autoconf, Automake used to be not entirely backwards compatible. For example, a project created with automake 1.4 will not necessarily work with automake 1.9. The situation however has improved noticeably with more recent releases.

Approach

Automake aims to allow the programmer to write a makefile in a higher-level language, rather than having to write the whole makefile manually. In simple cases, it suffices to give:
  • a line that declares the name of the program to build;
  • a list of source files;
  • a list of command-line options to be passed to the compiler
    Compiler
    A compiler is a computer program that transforms source code written in a programming language into another computer language...

     (for example, in which directories header files will be found);
  • a list of command-line options to be passed to the linker (which libraries the program needs and in what directories they are to be found).


From this information, Automake generates a makefile that allows the user to:
  • compile the program;
  • clean (i.e., remove the files resulting from the compilation);
  • install the program in standard directories;
  • uninstall the program from where it was installed;
  • create a source distribution archive (commonly called a tarball);
  • test that this archive is self-sufficient, and in particular that the program can be compiled in a directory other than the one where the sources are deployed.

Dependency generation

Automake also takes care of automatically generating the dependency
Coupling (computer science)
In computer science, coupling or dependency is the degree to which each program module relies on each one of the other modules.Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa...

 information, so that when a source file is modified, the next invocation of the make command will know which source files need to be recompiled. If the compiler allows it, Automake tries to make the dependency system dynamic: whenever a source file is compiled, that file's dependencies are updated by asking the compiler to regenerate the file's dependency list. In other words, dependency tracking is a side effect of the compilation process.

This attempts to avoid the problem with some static dependency systems, where the dependencies are detected only once when the programmer starts working on the project. In such a case, if a source file gains a new dependency (e.g., if the programmer adds a new #include directive in a C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 source file), then a discrepancy is introduced between the real dependencies and those that are used by the compilation system. The programmer should then regenerate the dependencies, but runs the risk of forgetting to do so.

In the general case, automake generates dependencies via the bundled depcomp script, which will invoke the compiler appropriately or fall back to makedepend
Makedepend
makedepend is a Unix tool used to generate dependencies of C source files.-History:makedepend was developed as part of MIT's Project Athena. It was used extensively in building X11 and ancillary packages, but has since become superseded by the dependency generation facilities of various compilers,...

. If the compiler is a sufficiently recent version of gcc
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

, however, automake will inline the dependency generation code to call gcc directly.

Libtool

Automake can also help with the compilation of libraries by automatically generating makefiles that will invoke GNU Libtool
Libtool
GNU Libtool is a GNU programming tool from the GNU build system used for creating portable compiled libraries. To quote the introduction in the :Libtool is typically used with Autoconf and Automake, two other tools of the GNU build system....

. The programmer is thus exempted from having to know how to call Libtool directly, and the project benefits from the use of a portable library creation tool.

External links


Tutorials

  • Tutorial for beginners "Autotools Tutorial" by Sarah George
  • The "Autotools Tutorial" by Alexandre Duret-Lutz introduces Autoconf
    Autoconf
    GNU Autoconf is a tool for producing configure scripts for building, installing and packaging software on computer systems where a Bourne shell is available....

    , Automake, Libtool
    Libtool
    GNU Libtool is a GNU programming tool from the GNU build system used for creating portable compiled libraries. To quote the introduction in the :Libtool is typically used with Autoconf and Automake, two other tools of the GNU build system....

    , and Gettext
    Gettext
    In computing, gettext is an internationalization and localization system commonly used for writing multilingual programs on Unix-like computer operating systems. The most commonly-used implementation of gettext is GNU gettext, released by the GNU Project in 1995.- History :gettext was originally...

    .
  • Learning the GNU Development tools
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK