1 \input texinfo @c -*-texinfo-*-
3 @setfilename automake.info
10 @c Yes, this appears in many Texinfo files. He's just a likeable guy.
12 @set Francois Franc,ois
15 @set Francois Fran\noexpand\ptexc cois
21 * automake: (automake). Making Makefile.in's
27 This file documents GNU automake @value{VERSION}
29 Copyright (C) 1995 Free Software Foundation, Inc.
31 Permission is granted to make and distribute verbatim copies of
32 this manual provided the copyright notice and this permission notice
33 are preserved on all copies.
36 Permission is granted to process this file through TeX and print the
37 results, provided the printed document carries copying permission
38 notice identical to this one except for the removal of this paragraph
42 Permission is granted to copy and distribute modified versions of this
43 manual under the conditions for verbatim copying, provided that the entire
44 resulting derived work is distributed under the terms of a permission
45 notice identical to this one.
47 Permission is granted to copy and distribute translations of this manual
48 into another language, under the above conditions for modified versions,
49 except that this permission notice may be stated in a translation approved
56 @subtitle For version @value{VERSION}, @value{UPDATED}
59 @vskip 0pt plus 1filll
60 Copyright @copyright{} 1995 Free Software Foundation, Inc.
62 This is the first edition of the GNU Automake documentation,@*
63 and is consistent with GNU Automake @value{VERSION}.@*
65 Published by the Free Software Foundation @*
66 675 Massachusetts Avenue, @*
67 Cambridge, MA 02139 USA @*
69 Permission is granted to make and distribute verbatim copies of
70 this manual provided the copyright notice and this permission notice
71 are preserved on all copies.
73 Permission is granted to copy and distribute modified versions of this
74 manual under the conditions for verbatim copying, provided that the entire
75 resulting derived work is distributed under the terms of a permission
76 notice identical to this one.
78 Permission is granted to copy and distribute translations of this manual
79 into another language, under the above conditions for modified versions,
80 except that this permission notice may be stated in a translation
81 approved by the Free Software Foundation.
84 @c Define an index of configure variables.
86 @c Define an index of options.
88 @c Define an index of targets.
92 @node Top, Introduction, (dir), (dir)
93 @comment node-name, next, previous, up
96 This file documents the GNU Automake package for creating GNU
97 Standards-compliant Makefiles from template files. This edition
98 documents version @value{VERSION}.
101 * Introduction:: Automake's purpose
102 * Invoking Automake:: Creating a Makefile.in
103 * Generalities:: General ideas
104 * configure:: Scanning configure.in
105 * Top level:: The top-level Makefile.am
106 * Programs:: Building programs and libraries
107 * Other objects:: Other derived objects
108 * Documentation:: Building documentation
109 * Install:: What gets installed
110 * Clean:: What gets cleaned
111 * Dist:: What goes in a distribution
112 * Tests:: Support for test suites
113 * Options:: Changing Automake's behavior
114 * Miscellaneous:: Miscellaneous rules
115 * Extending:: Extending Automake
116 * Distributing:: Distributing the Makefile.in
117 * Future:: Some ideas for the future.
118 * Variables:: Index of variables
119 * Configure variables:: Index of configure variables and macros
120 * Targets:: Index of targets
126 @chapter Introduction
128 Automake is a tool for automatically generating
129 @file{Makefile.in}s from files called @file{Makefile.am}. The
130 @file{Makefile.am} is basically a series of @code{make} macro
131 definitions (with rules being thrown in occasionally). The generated
132 @file{Makefile.in}s are compliant with the GNU Makefile standards.
134 The GNU Makefile Standards Document
135 (@pxref{Makefile Conventions, , , standards.info, The GNU Coding Standards})
136 is long, complicated, and subject to change. The goal of Automake is to
137 remove the burden of Makefile maintenance from the back of the
138 individual GNU maintainer (and put it on the back of the Automake
141 The typical Automake input files is simply a series of macro
142 definitions. Each such file is processed to create a
143 @file{Makefile.in}. There should generally be one @file{Makefile.am}
144 per directory of a project.
146 Automake does constrain a project in certain ways; for instance it
147 assumes that the project uses Autoconf
148 (@pxref{Top, , The Autoconf Manual, autoconf.info, The Autoconf Manual}),
149 and enforces certain restrictions on the @file{configure.in} contents.
151 @code{Automake} requires @code{perl} in order to generate the
152 @file{Makefile.in}s. However, the distributions created by Automake are
153 fully GNU standards-compliant, and do not require @code{perl} in order
156 Mail suggestions and bug reports for Automake to tromey@@cygnus.com.
159 @node Invoking Automake
160 @chapter Creating a @file{Makefile.in}
162 To create all the @file{Makefile.in}s for a package, run the
163 @code{automake} program in the top level directory, with no arguments.
164 @code{automake} will automatically find each appropriate
165 @file{Makefile.am} (by scanning @file{configure.in}; @pxref{configure})
166 and generate the corresponding @file{Makefile.in}.
168 You can optionally give @code{automake} an argument; @samp{.am} is
169 appended to the argument and the result is used as the name of the input
170 file. This feature is generally only used to automatically rebuild an
171 out-of-date @file{Makefile.in}.
173 @code{automake} accepts the following options:
176 @item --amdir=@var{dir}
177 Look for Automake data files in directory @var{dir} instead of in the
178 installation directory. This is typically used for debugging.
181 An alias for @samp{--strictness=foreign}.
184 An alias for @samp{--strictness=gnits}.
187 An alias for @samp{--strictness=gnu}.
190 Print a summary of the command line options and exit.
193 Include all automatically generated dependency information
194 (@pxref{Dependencies}) in the generated
195 @file{Makefile.in}. This is generally done when making a distribution;
199 Automake requires certain common files to exist in certain situations;
200 for instance @file{config.guess} is required if @file{configure.in} runs
201 @samp{AC_CANONICAL_HOST}. Automake is distributed with several of these
202 files; this option will cause the missing ones to be automatically added
203 to the package, whenever possible.
205 @item --output-dir=@var{dir}
206 Put the generated @file{Makefile.in} in the directory @var{dir}.
207 Ordinarily each @file{Makefile.in} is created in the directory of the
208 corresponding @file{Makefile.am}. This option is used when making
211 @item --strictness=@var{level}
212 Set the global strictness to @var{level}; this can be overridden in each
213 @file{Makefile.am} if required. @xref{Generalities} for more
217 Cause Automake to print information about which files are being read or
221 Print the version number of Automake and exit.
226 @chapter General ideas
229 @code{automake} supports three kinds of directory hierarchy: ``flat'',
230 ``shallow'', and ``deep''.
232 A flat package is one in which all the files are in a single directory.
233 The @file{Makefile.am} for such a package by definition lacks a
234 @samp{SUBDIRS} macro. An example of such a package is @code{termutils}.
237 A deep package is one in which all the source lies in subdirectories;
238 the top level directory contains mainly configuration information. GNU
239 cpio is a good example of such a package, as is GNU @code{tar}. The top
240 level @file{Makefile.am} for a deep package will contain a
241 @samp{SUBDIRS} macro, but no other macros to define objects which are
244 A shallow package is one in which the primary source resides in the
245 top-level directory, while various parts (typically libraries) reside in
246 subdirectories. @code{automake} is one such package (as is GNU
247 @code{make}, which does not currently use @code{automake}).
251 While Automake is intended to be used by maintainers of GNU packages, it
252 does make some effort to accomodate those who wish to use it, but do not
253 want to use all the GNU conventions.
255 To this end, Automake supports three levels of ``strictness'' -- the
256 strictness indicating how stringently Automake should check standards
259 The valid strictness levels are:
263 Automake will check for only those things which are absolutely
264 required for proper operations. For instance, whereas GNU standards
265 dictate the existence of a @file{NEWS} file, it will not be required in
266 this mode. The name comes from the fact that Automake is intended to be
267 used for GNU programs; these relaxed rules are not the standard mode of
271 Automake will check -- as much as possible -- for compliance to the GNU
272 standards for packages. This is the default.
275 Automake will check for compliance to the as-yet-unwritten GNITS
276 standards. These are based on the GNU standards, but are even more
277 detailed. Unless you are a GNITS standards contributor, it is
278 recommended that you avoid this option until such time as the GNITS
279 standard is actually published.
283 @section The Uniform Naming Scheme
284 Automake variables generally follow a uniform naming scheme that makes
285 it easy to decide how programs (and other derived objects) are built,
286 and how they are installed. This scheme also supports @code{configure}
287 time determination of what should be built.
289 At @code{make} time, certain variables are used to determine which
290 objects are to be built. These variables are called ``primary''
291 variables. For instance, the primary variable @samp{PROGRAMS} holds a
292 list of programs which are to be compiled and linked.
295 A different set of variables is used to decide where the built objects
296 should be installed. These variables are named after the primary
297 variables, but have a prefix indicating which standard directory should
298 be used as the installation directory. The standard directory names are
299 given in the GNU standards
300 (@pxref{Directory Variables, , , standards.info, The GNU Coding
302 @code{automake} extends this list with @samp{pkglibdir},
303 @samp{pkgincludedir}, and @samp{pkgdatadir}; these are the same as the
304 non-@samp{pkg} versions, but with @samp{@@PACKAGE@@} appended.
307 For each primary, there is one additional variable named by prepending
308 @samp{EXTRA_} to the primary name. This variable is used to list
309 objects which may or may not be built, depending on what
310 @code{configure} decides. This variable is required because Automake
311 must know the entire list of objects to be built in order to generate a
312 @file{Makefile.in} that will work in all cases.
314 For instance, @code{cpio} decides at configure time which programs are
315 built. Some of the programs are installed in @samp{bindir}, and some
316 are installed in @samp{sbindir}:
319 EXTRA_PROGRAMS = mt rmt
320 bin_PROGRAMS = cpio pax
321 sbin_PROGRAMS = @@PROGRAMS@@
324 Defining a primary variable is an error.
326 Note that the common @samp{dir} suffix is left off when constructing the
327 variable names; thus one writes @samp{bin_PROGRAMS} and not
328 @samp{bindir_PROGRAMS}.
330 Not every sort of object can be installed in every directory. Automake
331 will flag those attempts it finds in error. Automake will also diagnose
332 obvious misspellings in directory names.
334 Sometimes the standard directories -- even as augmented by Automake --
335 are not enough. In particular it is sometimes useful, for clarity, to
336 install objects in a subdirectory of some predefined directory. To this
337 end, Automake allows you to extend the list of possible installation
338 directories. A given prefix (eg @samp{zar}) is valid if a variable of
339 the same name with @samp{dir} appended is defined (eg @samp{zardir}).
341 For instance, until HTML support is part of Automake, you could use this
342 to install raw HTML documentation:
345 htmldir = $(prefix)/html
346 html_DATA = automake.html
349 The special prefix @samp{noinst} indicates that the objects in question
350 should not be installed at all.
352 Possible primary names are @samp{PROGRAMS}, @samp{LIBRARIES},
353 @samp{SCRIPTS}, @samp{DATA}, @samp{HEADERS}, @samp{MANS}, and
365 @chapter Scanning @file{configure.in}
367 Automake requires certain variables to be defined and certain macros to
368 be used in the package @file{configure.in}.
370 One such requirement is that @file{configure.in} must define the
371 variables @samp{PACKAGE} and @samp{VERSION} with @samp{AC_SUBST}.
374 @samp{PACKAGE} should be the name of the package as it appears when
375 bundled for distribution. For instance, Automake definees
376 @samp{PACKAGE} to be @samp{automake}. @samp{VERSION} should be the
377 version number of the release that is being developed. We recommend
378 that you make @file{configure.in} the only place in your package where
379 the version number is defined; this makes releases simpler.
381 Automake also requires the use of the macros @samp{AC_ARG_PROGRAM}
382 @cvindex AC_ARG_PROGRAM
384 If your package is not a flat distribution, Automake requires the use of
385 @samp{AC_PROG_MAKE_SET}.
386 @cvindex AC_PROG_MAKE_SET
388 Automake will also recognize the use of certain macros and tailor the
389 generated @file{Makefile.in} appropriately. Currently recognized macros
390 and their effects are:
393 @item AC_CONFIG_HEADER
394 Automake will generate rules to automatically regenerate the config
396 @cvindex AC_CONFIG_HEADER
399 Automake uses this to determine which files to create.
403 Automake will insert definitions for the variables defined by
404 @samp{AC_PATH_XTRA} into each @file{Makefile.in} that builds a C program
406 @cvindex AC_PATH_XTRA
408 @item AC_CANONICAL_HOST
409 @item AC_CANONICAL_SYSTEM
410 Automake will ensure that @file{config.guess} and @file{config.sub}
412 @cvindex AC_CANONICAL_HOST
413 @cvindex AC_CANONICAL_SYSTEM
416 @item AC_FUNC_GETLOADAVG
418 @item AC_STRUCT_ST_BLOCKS
419 @item fp_FUNC_FNMATCH
420 @item AC_REPLACE_FUNCS
421 Automake will ensure that the appropriate source files are part of the
422 distribution, and will ensure that the appropriate dependencies are
423 generated for these objects. @xref{A Library} for more
425 @cvindex AC_FUNC_ALLOCA
426 @cvindex AC_FUNC_GETLOADAVG
427 @cvindex AC_FUNC_MEMCMP
428 @cvindex AC_STRUCT_ST_BLOCKS
429 @cvindex fp_FUNC_FNMATCH
430 @cvindex AC_REPLACE_FUNCS
432 Automake will also detect statements which put @file{.o} files into
433 @samp{LIBOBJS}, and will treat these additional files in a similar way.
437 This is required if any libraries are built in the package.
438 @cvindex AC_PROG_RANLIB
440 @item AC_PROG_INSTALL
441 @item fp_PROG_INSTALL
442 @samp{fp_PROG_INSTALL} is required if any scripts (@pxref{Scripts}) are
443 installed by the package. Otherwise, @samp{AC_PROG_INSTALL} is
445 @cvindex AC_PROG_INSTALL
446 @cvindex fp_PROG_INSTALL
448 @item fp_C_PROTOTYPES
449 This is required when using automatic de-ANSI-fication, see @ref{ANSI}.
450 @cvindex fp_C_PROTOTYPES
453 This macro is required for packages which use GNU gettext (FIXME xref).
454 It is distributed with gettext. Automake uses this macro to ensure that
455 the package meets some of gettext's requirements.
456 @cvindex ud_GNU_GETTEXT
459 The ``fp_'' macros are from @value{Francois} Pinard, and are included
460 with Automake. @code{automake} will tell where the macros can be found
465 @chapter The top-level @file{Makefile.am}
467 In non-flat packages, the top level @file{Makefile.am} must tell
468 Automake which subdirectories are to be built. This is done via the
469 @samp{SUBDIRS} variable.
472 The @samp{SUBDIRS} macro holds a list of subdirectories in which
473 building of various sorts can occur. Many targets (eg @samp{all}) in
474 the generated @file{Makefile} will run both locally and in all specified
475 subdirectories. Note that the directories listed in @samp{SUBDIRS} are
476 not required to contain @file{Makefile.am}s; only @file{Makefile}s
477 (after configuration). This allows inclusion of libraries from packages
478 which do not use Automake (such as @code{gettext}).
480 In a deep package, the top-level @file{Makefile.am} is often very short.
481 For instance, here is the @file{Makefile.am} from the textutils
485 SUBDIRS = lib src doc man
486 DIST_OTHER = @@README_ALPHA@@
489 @samp{SUBDIRS} can contain configure substitutions (eg @samp{@@DIRS@@});
490 Automake itself does not actually examine the contents of this variable.
492 If @samp{SUBDIRS} is defined, then your @file{configure.in} must include
493 @code{AC_PROG_MAKE_SET}.
497 @chapter Building Programs and Libraries
499 A large part of Automake's functionality is dedicated to making it easy
500 to build C programs and libraries.
503 * A Program:: Building a program
504 * A Library:: Building a library
505 * ANSI:: Automatic de-ANSI-fication
506 * Dependencies:: Automatic dependency tracking
511 @section Building a program
513 In a directory containing source that gets built into a program (as
514 opposed to a library), the @samp{PROGRAMS} primary is used. Programs
515 can be installed in @samp{bindir}, @samp{sbindir}, @samp{libexecdir},
516 @samp{pkglibdir}, or not at all.
524 In this simple case, the resulting @file{Makefile.in} will contain code
525 to generate a program named @code{hello}. The variable
526 @samp{hello_SOURCES} is used to specify which source files get built
530 hello_SOURCES = hello.c
533 This causes @file{hello.c} to be compiled into @file{hello.o}, and then
534 linked to produce @file{hello}.
536 If @samp{prog_SOURCES} is needed, but not specified, then it defaults to
537 the single file @samp{prog.c}. Id est In the example above, the
538 definition of @samp{hello_SOURCES} is actually redundant.
542 Multiple programs can be built in a single directory. Multiple programs
543 can share a single source file. The source file must be listed in each
544 ``_SOURCES'' definition.
546 Header files listed in a ``_SOURCES'' definition will be ignored. Lex
547 (``.l'') and yacc (``.y'') files can also be listed; support for these
548 should work but is still preliminary.
549 @c lex & yacc should have a separate section
551 Sometimes it is useful to determine the programs that are to be built at
552 configure time. For instance, GNU @code{cpio} only builts @code{mt} and
553 @code{rmt} under special circumstances.
555 In this case, you must notify @code{Automake} of all the programs that
556 can possibly be built, but at the same time cause the generated
557 @file{Makefile.in} to use the programs specified by @code{configure}.
558 This is done by having @code{configure} substitute values into each
559 ``_PROGRAMS'' definition, while listing all optionally built programs in
560 @samp{EXTRA_PROGRAMS}.
561 @vindex EXTRA_PROGRAMS
563 If you need to link against libraries that are not found by
564 @code{configure}, you can use @samp{LDADD} to do so. This variable
565 actually can be used to add any options to the linker command line.
568 Sometimes, multiple programs are built in one directory but do not share
569 the same link-time requirements. In this case, you can use the
570 @samp{@var{prog}_LDADD} variable (where @var{PROG} is the name of the
571 program as it appears in some ``_PROGRAMS'' variable, and usually
572 written in lowercase) to override the global @samp{LDADD}. (If this
573 variable exists for a given program, then that program is not linked
577 For instance, in GNU cpio, @code{pax}, @code{cpio}, and @code{mt} are
578 linked against the library @file{libcpio.a}. However, @code{rmt} is
579 built in the same directory, and has no such link requirement. Also,
580 @code{mt} and @code{rmt} are only built on certain architectures. Here
581 is what cpio's @file{src/Makefile.am} looks like (abridged):
584 bin_PROGRAMS = cpio pax @@MT@@
585 libexec_PROGRAMS = @@RMT@@
586 EXTRA_PROGRAMS = mt rmt
588 LDADD = ../lib/libcpio.a @@INTLLIBS@@
591 cpio_SOURCES = @dots{}
592 pax_SOURCES = @dots{}
594 rmt_SOURCES = @dots{}
599 @section Building a library
601 Building a library is much like building a program. In this case, the
602 name of the primary is @samp{LIBRARIES}. Libraries can be installed in
603 @samp{libdir} or @samp{pkglibdir}.
605 Each @samp{where_LIBRARIES} variable is a list of the base names of
606 libraries to be built. For instance to create a library named
607 @file{libcpio.a}, but not install it, you would write:
610 noinst_LIBRARIES = cpio
613 The sources that go into a library are determined exactly as they are
614 for programs, via the ``_SOURCES'' variables. Note that programs and
615 libraries share a namespace, so one cannot have a program (``lob'') and
616 a library (``liblob.a'') with the same name in one directory.
618 Extra objects can be added to a library using the @samp{library_LIBADD}
619 variable. This should be used for objects determined by
620 @code{configure}. Again from cpio:
625 cpio_LIBADD = @@LIBOBJS@@ @@ALLOCA@@
628 Note that Automake explicitly recognizes the use of @samp{@@LIBOBJS@@}
629 and @samp{@@ALLOCA@@} in the above example, and uses this information,
630 plus the list of @samp{LIBOBJS} files derived from @file{configure.in}
631 to automatically include the appropriate source files in the
632 distribution (@pxref{Dist}). These source files are also automatically
633 handled in the dependency-tracking scheme, see @xref{Dependencies}.
637 @section Automatic de-ANSI-fication
639 Although the GNU standards prohibit it, some GNU programs are written in
640 ANSI C; see FIXME. This is possible because each source file can be
641 ``de-ANSI-fied'' before the actual compilation takes place.
643 If the @file{Makefile.am} variable @samp{AUTOMAKE_OPTIONS}
644 @vindex AUTOMAKE_OPTIONS
645 (@ref{Options}) contains the option @samp{ansi2knr}
647 then code to handle de-ANSI-fication is inserted into the generated
650 This causes each source file to be treated as ANSI C. If an ANSI C
651 compiler is available, it is used.
653 This support requires the source files @file{ansi2knr.c} and
654 @file{ansi2knr.1} to be in the same directory as the ANSI C source;
655 these files are distributed with Automake.
656 Also, the package @file{configure.in} must call the macro
657 @samp{fp_C_PROTOTYPES}.
658 @cvindex fp_C_PROTOTYPES
662 @section Automatic dependency tracking
664 As a developer it is often painful to continually update the
665 @file{Makefile.in} whenever the include-file dependencies change in a
666 project. @code{automake} supplies a way to automatically track
667 dependency changes, and distribute the dependencies in the generated
670 Currently this support requires the use of GNU @code{make} and
671 @code{gcc}. It might become possible in the future to supply a
672 different dependency generating program, if there is enough demand.
674 This mode is enabled by default if any C program or library is defined
675 in the current directory.
677 When you decide to make a distribution, the @samp{dist} target will
679 re-run @code{automake} with the @samp{--include-deps} option. This
681 causes the previously generated dependencies to be inserted into the
682 generated @file{Makefile.in}, and thus into the distribution.
683 @samp{--include-deps} also turns off inclusion of the dependency
686 This mode can be suppressed by putting @samp{no-dependencies} in the
687 variable @samp{AUTOMAKE_OPTIONS}.
688 @vindex AUTOMAKE_OPTIONS
689 @opindex no-dependencies
693 @chapter Other Derived Objects
695 Automake can handle derived objects which are not C programs. Sometimes
696 the support for actually building such objects must be explicitly
697 supplied, but Automake will still automatically handle installation and
701 * Scripts:: Executable scripts
702 * Headers:: Header files
703 * Data:: Architecture-independent data files
708 @section Executable Scripts
710 It is possible to define and install programs which are scripts. Such
711 programs are listed using the @samp{SCRIPTS} primary name.
712 @code{automake} doesn't define any dependencies for scripts; the
713 @file{Makefile.am} should include the appropriate rules.
716 @code{automake} does not assume that scripts are derived objects; such
717 objects are must be deleted by hand; see @ref{Clean} for more
720 @code{automake} itself is a script that is generated at configure time
721 from @file{automake.in}. Here is how this is handled:
724 bin_SCRIPTS = automake
727 Since @code{automake} appears in the @samp{AC_OUTPUT} macro,
728 dependencies for it are automatically generated.
730 Script objects can be installed in @samp{bindir}, @samp{sbindir},
731 @samp{libexecdir}, or @samp{pkgdatadir}.
735 @section Header files
737 Header files are specified by the @samp{HEADERS} family of variables.
738 Generally header files are not installed, so the @samp{noinst_HEADERS}
739 variable will be the most used.
742 All header files must be listed somewhere; missing ones will not appear
743 in the distribution. Often it is most convenient to list uninstalled
744 headers with the rest of the sources for a program. @xref{A Program}.
746 Headers can be installed in @code{includedir}, @code{oldincludedir}, or
747 @code{pkgincludedir}.
751 @section Architecture-independent data files
753 Automake supports the installation of miscellaneous data files using the
754 @samp{DATA} family of variables.
757 Such data can be installed in the directories @code{datadir},
758 @code{sysconfdir}, @code{sharedstatedir}, @code{localstatedir}, or
761 All such data files are included in the distribution.
763 Here is how @code{autoconf} installs its auxiliary data files:
766 pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \
767 compile.am data.am depend.am dist-subd-top.am dist-subd-vars.am \
768 dist-subd.am dist-vars.am dist.am footer.am header-vars.am header.am \
769 libscripts.am libprograms.am libraries-vars.am libraries.am library.am \
770 mans-vars.am mans.am packagedata.am program.am programs.am remake-hdr.am \
771 remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \
772 texinfos-vars.am texinfos.am hack-make.sed nl-remove.sed
777 @chapter Building documentation
779 Currently Automake provides support for Texinfo and man pages.
783 * Man pages:: Man pages
790 If the current directory contains Texinfo source, you must declare it
791 with the @samp{TEXINFOS} primary. Generally Texinfo files are converted
792 into info, and thus the @samp{info_TEXINFOS} macro is most commonly used
793 here. Note that any Texinfo source file must end in the @file{.texi}
794 extension (@file{.texinfo} won't work).
796 @vindex info_TEXINFOS
798 If the @file{.texi} file ``@@include''s @file{version.texi}, then that
799 file will be automatically generated. @file{version.texi} defines three
800 Texinfo macros you can reference: @samp{EDITION}, @samp{VERSION}, and
801 @samp{UPDATED}. The first two hold the version number of your package
802 (but are kept separate for clarity); the last is the date the primary
803 file was last modified. The @file{version.texi} support requires the
804 @code{mdate-sh} program; this program is supplied with Automake.
806 Sometimes an info file actually depends on more than one @file{.texi}
807 file. For instance, in the @samp{xdvik} distribution,
808 @file{kpathsea.texi} includes the files @file{install.texi},
809 @file{copying.texi}, and @file{freedom.texi}. You can tell Automake
810 about these dependencies using the @samp{texi_TEXINFOS} variable. Here
811 is how @samp{xdvik} could do it:
816 info_TEXINFOS = kpathsea.texi
817 kpathsea_TEXINFOS = install.texi copying.texi freedom.texi
820 Automake will warn if a directory containing Texinfo source does not
821 also contain the file @file{texinfo.tex}. This file is supplied with
828 A package can also include man pages. (Though see the GNU standards on
829 this matter, @ref{Man Pages, , , standards.info, The GNU Coding
830 Standards}.) Man pages are declared using the @samp{MANS} primary.
831 Generally the @samp{man_MANS} macro is used. Man pages are
832 automatically installed in the correct subdirectory of @code{mandir},
833 based on the file extension.
837 By default, man pages are installed by @code{make install}. However,
838 since the GNU project does not require man pages, many maintainers do
839 not expend effort to keep the man pages up to date. In these cases, the
840 @samp{no-installman} option will prevent the man pages from being
841 installed by default. The user can still explicitly install them via
842 @code{make install-man}.
843 @opindex no-installman
846 Here is how the documentation is handled in GNU @code{cpio} (which
847 includes both Texinfo documentation and man pages):
850 info_TEXINFOS = cpio.texi
851 man_MANS = cpio.1 mt.1
854 Texinfo source, info pages and man pages are all considered to be
855 ``source'' for the purposes of making a distribution.
859 @chapter What Gets Installed
861 Naturally, Automake handles the details of actually installing your
862 program once it has been built. All @code{PROGRAMS}, @code{SCRIPTS},
863 @code{LIBRARIES}, @code{DATA} and @code{HEADERS} are automatically
864 installed in the appropriate places.
866 Automake also handles installing any specified info and man pages.
868 Automake generates separate @samp{install-data} and @samp{install-exec}
869 targets, in case the installer is installing on multiple machines which
870 share directory structure -- these targets allow the machine-independent
871 parts to be installed only once. The @samp{install} target depends on
872 both of these targets.
873 @trindex install-data
874 @trindex install-exec
877 Automake also generates an @samp{uninstall} target, and an
878 @samp{installdirs} target.
882 It is possible to extend this mechanism by defining an
883 @samp{install-exec-local} or @samp{install-data-local} target. If these
884 targets exist, they will be run at @code{make install} time.
885 @trindex install-exec-local
886 @trindex install-data-local
890 @chapter What Gets Cleaned
892 The GNU Makefile Standards specify a number of different clean rules.
894 Generally the files that can cleaned are determined automatically by
895 Automake. Of course, Automake also recognizes some variables that can
896 be defined to specify additional files to clean. These variables are
897 @samp{MOSTLYCLEANFILES}, @samp{CLEANFILES}, @samp{DISTCLEANFILES}, and
898 @samp{MAINTAINERCLEANFILES}.
899 @vindex MOSTLYCLEANFILES
901 @vindex DISTCLEANFILES
902 @vindex MAINTAINERCLEANFILES
904 In Automake, the @code{automake} program is not automatically removed,
905 because it is an executable script. So this code in @file{Makefile.am}
906 causes it to be removed by @code{make clean}:
909 CLEANFILES = automake
914 @chapter What Goes in a Distribution
916 The @samp{dist} target in the generated @file{Makefile.in} can be used
917 to generate a gzip'd @code{tar} file for distribution. The tar file is
918 named based on the @var{PACKAGE} and @var{VERSION} variables.
923 For the most part, the files to distribute are automatically found by
924 Automake: all source files are automatically included in a distribution,
925 as are all @file{Makefile.am}s and @file{Makefile.in}s. Automake also
926 has a built-in list of commonly used files which, if present in the
927 current directory, are automatically included. This list is printed by
928 @code{automake --help}. Also, files which are read by @code{configure}
929 (ie, the source files corresponding to the files specified in the
930 @samp{AC_OUTPUT} invocation) are automatically distributed.
932 Still, sometimes there are files which must be distributed, but which
933 are not covered in the automatic rules. These files should be listed in
934 the @samp{DIST_OTHER} variable.
939 @chapter Support for test suites
941 Automake supports a simple form of test suite. If the variable
942 @samp{TESTS} is defined, its value is taken to be a list of programs to
943 run in order to do the testing. The programs can either be derived
944 objects or source objects; the generated rule will look both in
945 @var{srcdir} and @file{.}.
947 The testing is done via @code{make check}. The number of failures will
948 be printed at the end of the run.
950 In the future there will be some support for test suites which use
955 @chapter Changing Automake's Behavior
957 Various features of Automake can be controlled by options in the
958 @file{Makefile.am}. Such options are listed in a special variable named
959 @samp{AUTOMAKE_OPTIONS}. Currently understood options are:
960 @vindex AUTOMAKE_OPTIONS
965 @itemx @samp{foreign}
966 The same as the corresponding @samp{--strictness} option.
968 @item @samp{no-installman}
969 The generated @file{Makefile.in} will not cause man pages to be
970 installed by default. However, an @samp{install-man} target will still
971 be available for optional installation.
973 @item @samp{ansi2knr}
974 Turn on automatic de-ANSI-fication.
976 @item @samp{dist-shar}
977 Generate a @samp{dist-shar} target as well as the ordinary @samp{dist}
980 @item @samp{no-dependencies}
981 This is similar to using @samp{--include-deps} on the command line, but
982 is useful for those situations where you don't have the necessary bits
983 to make automatic dependency tracking work @xref{Dependencies}. In this
984 case the effect is to effectively disable automatic dependency tracking.
987 A version number (eg @samp{0.30}) can be specified. If Automake is not
988 newer than the version specified, creation of the @file{Makefile.in}
992 Unrecognized options are diagnosed by @code{automake}.
996 @chapter Miscellaneous Rules
998 There are a few rules and variables that didn't fit anywhere else.
1001 * Tags:: Interfacing to etags and mkid
1002 * Suffixes:: Handling new file extensions
1003 * Built:: Built sources
1008 @section Interfacing to @code{etags}
1010 @code{automake} will generate rules to generate @file{TAGS} files for
1011 use with GNU Emacs under some circumstances.
1013 If any C source code or headers are present, then a @samp{tags} target
1014 will be generated for the directory.
1017 At the topmost directory of a multi-directory package, a @samp{tags}
1018 target file will be generated which, when run, will generate a
1019 @file{TAGS} file that includes by reference all @file{TAGS} files from
1022 Also, if the variable @samp{ETAGS_ARGS} is defined, a @samp{tags} target
1023 will be generated. This variable is intended for use in directories
1024 which contain taggable source that @code{etags} does not understand.
1026 Here is how Automake generates tags for its source, and for nodes in its
1030 ETAGS_ARGS = automake.in --lang=none \
1031 --regex='/^@@node[ \t]+\([^,]+\)/\1/' automake.texi
1034 Automake will also generate an @samp{id} target which will run
1035 @code{mkid} on the source. This is only supported on a
1036 directory-by-directory basis.
1041 @section Handling new file extensions
1043 It is sometimes useful to introduce a new implicit rule to handle a file
1044 type that Automake does not know about. If this is done, you must
1045 notify GNU Make of the new suffixes. This can be done by putting a list
1046 of new suffixes in the @samp{SUFFIXES} variable.
1051 @section Built sources
1057 @chapter When Automake Isn't Enough
1059 Sometimes @code{automake} isn't enough. Then you just lose.
1061 Actually, @code{automake}s implicit copying semantics means that many
1062 problems can be worked around by simply adding some @code{make} targets
1063 and rules to @file{Makefile.in}. @code{automake} will ignore these
1066 There are some caveats to doing this. Although you can overload a
1067 target already used by @code{automake}, it is often inadvisable,
1068 particularly in the topmost directory of a non-flat package. However,
1069 various useful targets have a ``-local'' version you can specify in your
1070 @file{Makefile.in}. Automake will supplement the standard target with
1071 these user-supplied targets.
1073 The targets that support a local version are @samp{all}, @samp{info},
1074 @samp{dvi}, @samp{check}, @samp{install-data}, @samp{install-exec}, and
1080 @trindex install-data
1081 @trindex install-exec
1084 For instance, here is how to install a file in @file{/etc}:
1088 $(INSTALL_DATA) $(srcdir)/afile /etc/afile
1091 @c FIXME should include discussion of variables you can use in these
1096 @chapter Distributing @file{Makefile.in}s
1098 Automake places no restrictions on the distribution of the resulting
1099 @file{Makefile.in}s. We still encourage software authors to distribute
1100 their work under terms like those of the GPL, but doing so is not
1101 required to use Automake.
1103 Some of the files that can be automatically installed via the
1104 @samp{--add-missing} switch do fall under the GPL; examine each file
1109 @chapter Some ideas for the future
1111 Here are some things that might happen in the future:
1118 The output will be cleaned up. For instance, only variables which are
1119 actually used will appear in the generated @file{Makefile.in}.
1122 There will be support for automatically recoding a distribution. The
1123 intent is to allow a maintainer to use whatever character set is most
1124 convenient locally, but for all distributions to be Unicode or
1125 @w{ISO 10646} with the UTF-8 encoding.
1130 @unnumbered Index of Variables
1135 @node Configure variables
1136 @unnumbered Index of Configure Variables and Macros
1141 @unnumbered Index of Targets