Can't use 'true' in Makefiles
[automake.git] / automake.texi
blob955b379c04ba9f7fa52f5099c9587860008cb980
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename automake.info
4 @settitle automake
5 @setchapternewpage off
6 @c %**end of header
8 @include version.texi
10 @ifinfo
11 @format
12 START-INFO-DIR-ENTRY
13 * automake: (automake).         Making Makefile.in's
14 END-INFO-DIR-ENTRY
15 @end format
16 @end ifinfo
18 @ifinfo
19 This file documents GNU automake @value{VERSION}
21 Copyright (C) 1995 Free Software Foundation, Inc.
23 Permission is granted to make and distribute verbatim copies of
24 this manual provided the copyright notice and this permission notice
25 are preserved on all copies.
27 @ignore
28 Permission is granted to process this file through TeX and print the
29 results, provided the printed document carries copying permission
30 notice identical to this one except for the removal of this paragraph
33 @end ignore
34 Permission is granted to copy and distribute modified versions of this
35 manual under the conditions for verbatim copying, provided that the entire
36 resulting derived work is distributed under the terms of a permission
37 notice identical to this one.
39 Permission is granted to copy and distribute translations of this manual
40 into another language, under the above conditions for modified versions,
41 except that this permission notice may be stated in a translation approved
42 by the Foundation.
43 @end ifinfo
46 @titlepage
47 @title GNU Automake
48 @subtitle For version @value{VERSION}, @value{UPDATED}
49 @c copyright page
50 @page
51 @vskip 0pt plus 1filll
52 Copyright @copyright{} 1995 Free Software Foundation, Inc.
53 @sp 2
54 This is the first edition of the GNU Automake documentation,@*
55 and is consistent with GNU Automake @value{VERSION}.@*
56 @sp 2
57 Published by the Free Software Foundation @*
58 675 Massachusetts Avenue, @*
59 Cambridge, MA 02139 USA @*
61 Permission is granted to make and distribute verbatim copies of
62 this manual provided the copyright notice and this permission notice
63 are preserved on all copies.
65 Permission is granted to copy and distribute modified versions of this
66 manual under the conditions for verbatim copying, provided that the entire
67 resulting derived work is distributed under the terms of a permission
68 notice identical to this one.
70 Permission is granted to copy and distribute translations of this manual
71 into another language, under the above conditions for modified versions,
72 except that this permission notice may be stated in a translation
73 approved by the Free Software Foundation.
74 @end titlepage
76 @ifinfo
77 @node Top, Introduction, (dir), (dir)
78 @comment  node-name,  next,  previous,  up
79 @top GNU Automake
81 This file documents the GNU Automake package for creating GNU
82 Standards-compliant Makefiles from template files.  This edition
83 documents version @value{VERSION}.
85 @menu
86 * Introduction::                Automake's purpose
87 * Details::                     Creating an Automake template file
88 * Invoking automake::           Creating a Makefile.in
89 * Future::                      Some ideas for the future.
90 * Some index::                  Index of variables
91 @end menu
93 @end ifinfo
95 @node Introduction
96 @chapter Introduction
98 The GNU Makefile Standards Document
99 (@pxref{Makefile Conventions, , Makefile Conventions, standards.info, The
100 GNU Coding Standards})
101 is long, complicated,
102 and subject to change.  The goal of Automake is to remove the burden of
103 Makefile maintenance from back the individual GNU maintainer (and put it
104 on the back of the Automake maintainer).
106 Typical Automake input files are simply a series of macro definitions.
107 Automake processes these files to produce @file{Makefile.in}s which are
108 distribution-ready.
110 Automake does force some structure on the package maintainer.  However,
111 it is felt that this (minor) inconvenience is more than offset by
112 Automake's convenience.
115 @node Details
116 @chapter Making @code{automake} templates
118 @menu
119 * Generalities::                General overview
120 * configure::                   Automake and configure
121 * Depth::                       Types of package hierarchy
122 * Naming::                      The uniform naming scheme
123 * Programs::                    Building programs
124 * ANSI::                        Automatic de-ANSI-fication
125 * Scripts::                     Building scripts
126 * Libraries::                   Building libraries
127 * Headers::                     Header files
128 * Data::                        Data files.
129 * Docs::                        Specifying documentation files
130 * Install::                     What gets installed
131 * Clean::                       What gets cleaned
132 * Distribution::                What gets distributed
133 * Tags::                        TAGS files
134 * Dependencies::                Automatic dependency tracking
135 * Extending::                   If the defaults aren't enough
136 @end menu
138 @node Generalities
139 @section General use of Automake
141 @code{Automake} is a tool for automatically generating
142 @file{Makefile.in}s from files called @file{Makefile.am}.  The
143 @file{Makefile.am} is basically a series of @code{make} macro
144 definitions (with the occasional rule thrown in).  The generated
145 @file{Makefile.in}s are compliant with the GNU Makefile standards.
147 There should be one @file{Makefile.am} per directory of a project
148 (though it is possible to incorporate directories that don't use
149 @code{automake} if necessary).
151 @code{automake} assumes the package in question uses @code{autoconf}.
154 @node configure
155 @section How @code{automake} and @code{configure} interact
157 Automake enforces a certain amount of structure on the package
158 maintainer.  One such item is its requirement that the
159 @file{configure.in} for the package define the variables @samp{PACKAGE}
160 and @samp{VERSION}.
162 @var{PACKAGE} should be the name of the package as it appears when
163 bundled for distribution.  For instance, Automake defines @samp{PACKAGE}
164 to be @samp{automake}.
166 @var{VERSION} should be the version number of the release being worked
167 on.  We recommend that you make @file{configure.in} the only place you
168 define the version number for your package; this makes releases simpler.
170 Here is an example of what to put in @file{configure.in}:
172 @example
173 PACKAGE=cpio
174 VERSION=2.3.911
175 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
176 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
177 AC_SUBST(PACKAGE)
178 AC_SUBST(VERSION)
179 @end example
181 If your @file{configure.in} uses @samp{AC_CONFIG_HEADER}, then in each
182 directory you should define the @samp{CONFIG_HEADER} variable to hold
183 the name of the header.
185 For instance, in cpio's @file{src/Makefile.am}, we see:
187 @example
188 CONFIG_HEADER = ../config.h
189 @end example
192 @code{automake} also assumes that your @file{configure} script will
193 define the variable @samp{INSTALL_SCRIPT}.  Until this is incorporated
194 in @code{autoconf}'s @samp{AC_PROG_INSTALL} macro, you can use this
195 replacement instead:
197 @example
198 ## --------------------------------------------------------- ##
199 ## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
200 ## substitution.                                             ##
201 ## --------------------------------------------------------- ##
203 AC_DEFUN(fp_PROG_INSTALL,
204 [AC_PROG_INSTALL
205 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='$@{INSTALL@} -m 755'
206 AC_SUBST(INSTALL_SCRIPT)dnl
208 @end example
211 @code{automake} also assumes your @file{configure.in} calls
212 @samp{AC_ARG_PROGRAM}.
215 @node Depth
216 @section Types of directory hierarchy
218 @code{automake} supports three kinds of directory hierarcy: ``flat'',
219 ``shallow'', and ``deep''.
221 A flat package is one in which all the files are in a single directory.
222 The @file{Makefile.am} for such a package by definition lacks a
223 @samp{SUBDIRS} macro.  An example of such a package is @code{termutils}.
225 A deep package is one in which all the source lies in subdirectories;
226 the top level directory contains mainly configuration information.  GNU
227 cpio is a good example of such a package (as is GNU @code{tar}, although
228 it does not presently use @code{automake}).  The top level
229 @file{Makefile.am} for a deep package will contain a @samp{SUBDIRS}
230 macro, but no other macros to define objects which are built.
231 Typically, @samp{PROGRAMS} is defined in @file{src/Makefile.am}.
233 A shallow package is one in which the primary source resides in the
234 top-level directory, while various parts (typically libraries) reside in
235 subdirectories.  @code{automake} is one such package (as is GNU
236 @code{make}, which does not currently use @code{automake}).
239 The @samp{SUBDIRS} macro holds a list of subdirectories in which
240 building of various sorts can occur.  Many targets (eg @samp{all}) in
241 the generated @file{Makefile} will run both locally and in all specified
242 subdirectories.  Note that the directories listed in @samp{SUBDIRS} are
243 not expected to contain @file{Makefile.am}s; only @file{Makefile}s
244 (after configuration).  This allows inclusion of libraries from packages
245 which do not use @code{automake} (such as @code{gettext}).
247 If @samp{SUBDIRS} is defined, then your @file{configure.in} must include
248 @code{AC_PROG_MAKE_SET}.
250 FIXME supply complete list of recursive targets?
253 @node Naming
254 @section The uniform naming scheme
256 @code{Automake} uses a uniform naming scheme to make it easy to decide
257 how programs are built, and how they are installed.  This scheme also
258 supports @code{configure}-time determination of what should be built.
260 There are certain variables which are used at @code{make} time to
261 determine which objects are to be built.  For instance, @samp{PROGRAMS}
262 holds a list of programs which are to be compiled and linked.  These
263 variables are called ``primary'' variables.
265 A different set of variables are used to decide where the built objects
266 should be installed.  These variables are named after the primary
267 variables, but have a prefix indicating which standard directory should
268 be used as the installation directory.  The standard directory names are
269 given in the GNU standards (FIXME xref).  @code{automake} extends this
270 list with @samp{pkglibdir}, @samp{pkgincludedir}, and @samp{pkgdatadir};
271 these are the same as the non-@samp{pkg} versions, but with
272 @code{@@PACKAGE@@} appended.
274 For instance, @code{cpio} decides at configure time which programs are
275 built.  Some of the programs are installed in @samp{bindir}, and some
276 are installed in @samp{sbindir}:
278 @example
279 PROGRAMS = @@PROGRAMS@@
280 bin_PROGRAMS = cpio pax
281 sbin_PROGRAMS = rmt mt
282 @end example
284 Note that the common ``dir'' suffix is left off when constructing the
285 variable names; thus one writes @samp{bin_PROGRAMS} and not
286 @samp{bindir_PROGRAMS}.
288 Not every sort of object can be installed in every directory.
289 @code{automake} will flag those attempts it finds in error.
291 The special prefix @code{noinst} indicates that the objects in question
292 should not be installed at all.
294 Possible primary names are @samp{PROGRAMS}, @samp{LIBRARIES},
295 @samp{SCRIPTS}, @samp{DATA}, and @samp{HEADERS}.
297 FIXME currently TEXINFOS and MANS don't follow this rule, but they
298 probably should.
301 @node Programs
302 @section Which Programs Are Built
304 In a directory containing source that gets built into a program (as
305 opposed to a library), the @samp{PROGRAMS} variable is used:
307 @example
308 PROGRAMS = hello
309 @end example
311 In this simple case, the resulting @file{Makefile.in} will contain code
312 to generate a program named @code{hello}.  The variable
313 @samp{@var{prog}_SOURCE} is used to specify which source files get built
314 into an executable:
316 @example
317 hello_SOURCE = hello.c
318 @end example
320 This causes @file{hello.o} to be built from @code{hello.c} at compile
321 time, and then linked into @file{hello}.
323 Multiple programs can be built in a single directory -- simply list them
324 all in the @samp{PROGRAMS} definition.  Multiple programs can share a
325 single source file.  The source file must be listed in each ``_SOURCE''
326 definition.
328 Sometimes it is useful to determine the programs that are to be built at
329 configure time.  For instance, GNU @code{cpio} only builts @code{mt} and
330 @code{rmt} under special circumstances.
332 In this case, you must notify Automake of all the programs that can
333 possibly be built, but at the same time cause the generated
334 @file{Makefile.in} to use the programs specified by @code{configure}.
335 This is done trivially by making the @code{PROGRAMS} variable determined
336 at configure time, and letting @code{automake} look in the install
337 variables for the static list of programs.
339 If you need to link against libraries that are not found by
340 @code{configure}, you can use @samp{LDADD} to do so.  This variable
341 actually can be used to add any options to the linker command line.
343 Sometimes, multiple programs are built in one directory but do not share
344 the same link-time requirements.  In this case, you can use the
345 @samp{@var{prog}_LDADD} variable (where @var{PROG} is the name of the
346 program as it appears in @samp{PROGRAMS} to override the global
347 @samp{LDADD}.  (If this variable exists for a given program, then that
348 program is not linked using @samp{LDADD}.)
350 For instance, in GNU @code{cpio}, @code{pax}, @code{cpio}, and @code{mt} are
351 linked against the library @file{libcpio.a}.  However, @code{rmt} is
352 built in the same directory, and has no such link requirement.  Thus:
354 @example
355 LDADD = ../lib/libcpio.a @@INTLLIBS@@
356 rmt_LDADD =
357 @end example
359 @node Scripts
360 @section Programs Which are Scripts
362 It is possible to define and install programs which are scripts.  Such
363 programs should be listed in the @samp{SCRIPTS} variable.
364 @code{automake} doesn't define any dependencies for scripts; the
365 @file{Makefile.am} should include the appropriate rules.
367 @code{automake} does assume that objects listed in the @samp{SCRIPTS}
368 macro are derived objects; such objects are deleted by @code{make clean}.
370 @code{automake} itself is a script that is generated at configure time
371 from @file{automake.in}.  Here is how this is handled:
373 @example
374 bin_SCRIPTS = automake
376 automake: automake.in
377         CONFIG_FILES=$@@ CONFIG_HEADERS= ./config.status
378 @end example
380 Script objects can be installed in @samp{bindir}, @samp{sbindir}, or
381 @samp{libexecdir}.
384 @node Libraries
385 @section Building Libraries
387 The @samp{LIBRARIES} variable holds the names of libraries to be built
388 in the current directory.  If the libraries to be built vary at
389 configure time, you may define @samp{AM_LIBRARIES} to supply
390 @code{automake} with the full static list of possible libraries.
392 For a given library @samp{zot}, the sources are taken to be in
393 @samp{zot_SOURCES}, just as for programs.  Note that libraries and
394 programs share one namespace in @code{automake}: one directory cannot
395 contain both a library (``liblob.a'') and a program (``lob'') with the
396 same name.
398 Here is how the @file{libcpio.a} library is built in the GNU @code{cpio}
399 distribution's @file{lib} subdirectory:
401 @example
402 noinst_LIBRARIES = cpio
403 cpio_SOURCES = dirname.c dstring.c error.c filemode.c \
404 getopt.c getopt1.c idcache.c makepath.c octal.c \
405 stpcpy.c stripslash.c userspec.c xmalloc.c xstrdup.c
406 @end example
408 Extra objects can be added to a library using the @code{library_LIBADD}
409 variable.  This should be used for objects determined by
410 @code{configure}.  Again from @code{cpio}:
412 @example
413 cpio_LIBADD = @@LIBOBJS@@ @@ALLOCA@@
414 @end example
416 Library objects can be installed in @samp{libdir} or @samp{pkglibdir}.
419 @node Headers
420 @section Header files
422 Header files are specified by the @samp{HEADERS} family of variables.
423 Generally header files are not installed, so the @samp{noinst_HEADERS}
424 variable will be the most used.
426 All header files must be listed somewhere; missing ones will not appear
427 in the distribution.
429 You can also put conditionally compiled source file names into a
430 @samp{HEADERS} variable.  (This will probably change in a future
431 release).
434 @node Data
435 @section Architecture-independent data files
437 @code{automake} supports the installation of miscellaneous data files
438 using the @samp{DATA} family of variables.
440 Such data can be installed in the directories @code{datadir},
441 @code{sysconfdir}, @code{sharedstatedir}, @code{localstatedir}, or
442 @code{pkgdatadir}.
444 All such data files are included in the distribution.  (FIXME, this is
445 probably a bug)
447 Here is how @code{autoconf} installs its auxiliary data files:
449 @example
450 pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \
451 compile.am data.am depend.am dist-subd-top.am dist-subd-vars.am \
452 dist-subd.am dist-vars.am dist.am footer.am header-vars.am header.am \
453 libscripts.am libprograms.am libraries-vars.am libraries.am library.am \
454 mans-vars.am mans.am packagedata.am program.am programs.am remake-hdr.am \
455 remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \
456 texinfos-vars.am texinfos.am hack-make.sed nl-remove.sed
457 @end example
460 @node Docs
461 @section Texinfo and Man Pages
463 @subsection Texinfo
464 If the current directory contains Texinfo source, you must declare it
465 with the @samp{TEXINFOS} macro.
466 Note that any Texinfo source file must end in the @file{.texi} extension
467 (@file{.texinfo} won't work).
469 If the @file{.texi} file ``@@include''s @file{version.texi}, then that
470 file will be automatically generated.  @file{version.texi} defines three
471 Texinfo macros you can reference: @samp{EDITION}, @samp{VERSION}, and
472 @samp{UPDATED}.  The first two hold the version number of your package
473 (but are kept separate for clarity); the last is the date the primary
474 file was last modified.
475 The @file{version.texi} support requires a version of @code{date} that
476 accepts the @samp{-r} (read time from a file) option.
478 Sometimes an info file actually depends on more than one @file{.texi}
479 file.  For instance, in the @samp{xdvik} distribution,
480 @file{kpathsea.texi} includes the files @file{install.texi},
481 @file{copying.texi}, and @file{freedom.texi}.  You can tell
482 @code{automake} about these dependencies using the @samp{texi_TEXINFOS}
483 variable.  Here is how @samp{xdvik} could do it:
485 @example
486 TEXINFOS = kpathsea.texi
487 kpathsea_TEXINFOS = install.texi copying.texi freedom.texi
488 @end example
490 @code{automake} might be modified to detect these dependencies
491 automatically.
493 Currently @code{automake} can only handle one primary @file{.texi} file.
494 This restriction will be lifted if it proves too onerous.
496 @code{automake} will warn if a directory containing Texinfo source does
497 not also contain the file @file{texinfo.tex}.  (I'm not sure if this is
498 a good rule or not.  Comments?)
501 @subsection Man pages
502 A package can also include man pages.  (Though see the GNU standards on
503 this matter.  FIXME xref).
504 Man pages are declared using the @samp{MANS} macro.
507 Here is how the documentation is handled in GNU @code{cpio} (which includes
508 both Texinfo documentation and man pages):
510 @example
511 TEXINFOS = cpio.texi
512 MANS = cpio.1 mt.1
513 @end example
515 Texinfo source, info pages and man pages are all considered to be
516 ``source'' for the purposes of making a distribution.
519 @node ANSI
520 @section Automatic de-ANSI-fication of Source
522 If @file{Makefile.am} includes the text @samp{@@kr@@}, then code to
523 handle automatic de-ANSI-fication is included in the generated
524 @file{Makefile.in}.
526 This means that each C source file will be treated as ANSI C.  If no
527 ANSI C compiler is available on the build system, then the code will be
528 turned into K&R C before compilation.
530 Each directory that uses automatic de-ANSI-fication must include the
531 source files @file{ansi2knr.c} and @file{ansi2knr.1}.  Also, your
532 @file{configure} script must define the variables @samp{U} and
533 @samp{ANSI2KNR}.  Here is a snippet you can add to @file{aclocal.m4} to
534 achieve this:
536 @example
537 ## ------------------------------- ##
538 ## Check for function prototypes.  ##
539 ## ------------------------------- ##
541 AC_DEFUN(fp_C_PROTOTYPES,
542 [AC_REQUIRE([fp_PROG_CC_STDC])
543 AC_MSG_CHECKING([for function prototypes])
544 if test "$ac_cv_prog_cc_stdc" != no; then
545   AC_MSG_RESULT(yes)
546   AC_DEFINE(PROTOTYPES)
547   U= ANSI2KNR=
548 else
549   AC_MSG_RESULT(no)
550   U=_ ANSI2KNR=./ansi2knr
552 AC_SUBST(U)dnl
553 AC_SUBST(ANSI2KNR)dnl
557 ## ----------------------------------------- ##
558 ## ANSIfy the C compiler whenever possible.  ##
559 ## ----------------------------------------- ##
561 # @@defmac AC_PROG_CC_STDC
562 # @@maindex PROG_CC_STDC
563 # @@ovindex CC
564 # If the C compiler in not in ANSI C mode by default, try to add an option
565 # to output variable @@code@{CC@} to make it so.  This macro tries various
566 # options that select ANSI C on some system or another.  It considers the
567 # compiler to be in ANSI C mode if it defines @@code@{__STDC__@} to 1 and
568 # handles function prototypes correctly.
570 # If you use this macro, you should check after calling it whether the C
571 # compiler has been set to accept ANSI C; if not, the shell variable
572 # @@code@{ac_cv_prog_cc_stdc@} is set to @@samp@{no@}.  If you wrote your source
573 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
574 # program @@code@{ansi2knr@}, which comes with Ghostscript.
575 # @@end defmac
577 AC_DEFUN(fp_PROG_CC_STDC,
578 [AC_MSG_CHECKING(for $@{CC-cc@} option to accept ANSI C)
579 AC_CACHE_VAL(ac_cv_prog_cc_stdc,
580 [ac_cv_prog_cc_stdc=no
581 ac_save_CFLAGS="$CFLAGS"
582 # Don't try gcc -ansi; that turns off useful extensions and
583 # breaks some systems' header files.
584 # AIX                   -qlanglvl=ansi
585 # Ultrix and OSF/1      -std1
586 # HP-UX                 -Aa -D_HPUX_SOURCE
587 # SVR4                  -Xc
588 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
590   CFLAGS="$ac_save_CFLAGS $ac_arg"
591   AC_TRY_COMPILE(
592 [#if !defined(__STDC__) || __STDC__ != 1
593 choke me
594 #endif  
595 ], [int test (int i, double x);
596 struct s1 @{int (*f) (int a);@};
597 struct s2 @{int (*f) (double a);@};],
598 [ac_cv_prog_cc_stdc="$ac_arg"; break])
599 done
600 CFLAGS="$ac_save_CFLAGS"
602 AC_MSG_RESULT($ac_cv_prog_cc_stdc)
603 case "x$ac_cv_prog_cc_stdc" in
604   x|xno) ;;
605   *) CC="$CC $ac_cv_prog_cc_stdc" ;;
606 esac
608 @end example
611 @node Install
612 @section What Gets Installed
614 Naturally, @code{automake} handles the details of actually installing
615 your program once it has been built.  All @code{PROGRAMS},
616 @code{SCRIPTS}, @code{LIBRARIES}, @code{DATA} and @code{HEADERS} are
617 automatically installed in the appropriate places.
619 @code{automake} also handles installing any specified info and man
620 pages.
622 FIXME xref to Extending node here; sometimes you need to install more.
624 @code{automake} generates separate @samp{install-data} and
625 @samp{install-exec} targets, in case the installer is installing on
626 multiple machines which share directory structure -- these targets allow
627 the machine-independent parts to be installed only once.
629 @code{automake} also generates an @samp{uninstall} target, and an
630 @samp{installdirs} target.
633 @node Clean
634 @section Clean targets
636 The GNU Makefile Standards specify a number of different clean rules.
637 Generally the files that can cleaned are determined automatically by
638 @code{automake}.  Of course, @code{automake} also recognizes some
639 variables that can be defined to specify additional files to clean.
640 These variables are @samp{MOSTLYCLEANFILES}, @samp{CLEANFILES},
641 @samp{DISTCLEANFILES}, and @samp{MAINTAINERCLEANFILES}.
644 @node Distribution
645 @section Building a Release
647 The @samp{dist} target in the generated @file{Makefile.in} can be used
648 to generate a gzip'd tar file for distribution.  The tar file is named
649 based on the @var{PACKAGE} and @var{VERSION} variables.
651 For the most part, the files to distribute are automatically found by
652 @code{automake}: all source files are automatically included in a
653 distribution, as are all @file{Makefile.am}s and @file{Makefile.in}s.
654 @code{automake} also has a built-in list of commonly used files which,
655 if present in the current directory, are automatically included.  This
656 list is printed by @code{automake --help}.
658 Still, sometimes there are files which must be distributed, but which
659 are not covered in the automatic rules.  These files should be listed in
660 the @samp{DIST_OTHER} variable.
662 For instance, in the @code{automake} distribution, 
663 @file{automake.in} (the source to
664 @code{automake}) is not found automatically.  So in the
665 @file{Makefile.am}, we have:
667 @example
668 DIST_OTHER = automake.in
669 @end example
671 FIXME: describe DIST_SUBDIRS or not?  It is a hack which might go away.
673 @node Tags
674 @section Interfacing to @code{etags}
676 @code{automake} will generate rules to generate @file{TAGS} files for
677 use with GNU Emacs under some circumstances.
679 If any C source code or headers are present, then a @file{TAGS} file
680 will be generated for the directory.
682 At the topmost directory of a multi-directory package, a @file{TAGS}
683 file will be generated that will include by reference all @file{TAGS}
684 files from subdirectories.
686 Also, if the variable @samp{ETAGS_ARGS} is defined, a @file{TAGS} file
687 will be generated.  This variable is intended for use in directories
688 which contain taggable source that @code{etags} does not understand.
690 Here is how @code{automake} generates tags for its source, and for nodes
691 in its Texinfo file:
693 @example
694 ETAGS_ARGS = automake.in --lang=none \
695  --regex='/^@@node[ \t]+\([^,]+\)/\1/' automake.texi
696 @end example
699 @node Dependencies
700 @section Automatic dependency tracking
702 As a developer it is often painful to continually update the
703 @file{Makefile.in} whenever the include-file dependencies change in a
704 project.  @code{automake} supplies a way to automatically track
705 dependency changes, and distribute the dependencies in the generated
706 @file{Makefile.in}.
708 Currently this support requires the use of @code{GNU make} and
709 @code{gcc}.  It might become possible in the future to supply a
710 different dependency generating program, if there is enough demand.
712 This mode is enabled by default if any C program or library is defined
713 in the current directory.
715 When you decide to make a distribution, the @samp{dist} target will
716 re-run @code{automake} with the @samp{--include-deps} option.  This
717 causes the previously generated dependencies to be inserted into the
718 generated @file{Makefile.in}, and thus into the distribution.
719 @samp{--include-deps} also turns off inclusion of the dependency
720 generation code.
722 There should probably be a way to suppress this mode.
725 @node Extending
726 @section When Automake Isn't Enough
728 Sometimes @code{automake} isn't enough.  Then you just lose.
730 Actually, @code{automake}s implicit copying semantics means that many
731 problems can be worked around by simply adding some @code{make} targets
732 and rules to @file{Makefile.in}.  @code{automake} will ignore these
733 additions.
735 There are some caveats to doing this.  You can't overload a target
736 already used by @code{automake}.  However, various useful targets have a
737 ``-local'' version you can specify in your @file{Makefile.in}.
739 The targets that support a local version are @samp{all}, @samp{info},
740 @samp{dvi}, @samp{check}, @samp{install-data}, @samp{install-exec}, and
741 @samp{uninstall}.
743 For instance, here is how to install a file in @file{/etc}:
745 @example
746 install-data-local:
747         $(INSTALL_DATA) $(srcdir)/afile /etc/afile
748 @end example
751 @node Invoking automake
752 @chapter Using @code{automake} to Create @file{Makefile.in}
754 There are basically two modes in which @code{automake} can be run.
756 In the first, most common, mode, @code{automake} is simply run without
757 any arguments.  It will determine which @file{Makefile.am}s exist by
758 looking in the current directory and immediate subdirectories, and will
759 automatically build @file{Makefile.in}s in these directories.
761 In the second mode, @code{automake} is run with the name of one or more
762 @file{Makefile}s as arguments.  It then rebuilds the corresponding
763 @file{Makefile.in}s from the (also) corresponding @file{Makefile.am}s.
764 This second mode is most often used by @code{make} itself, when it
765 notices that a @code{Makefile.in} is out of date.
768 @node Future
769 @chapter Some ideas for the future
771 Here are some things that might happen in the future:
773 @itemize @bullet
774 @item
775 Better error checking would be good.
776 @end itemize
778 @node Some index
779 @chapter Nothing yet
781 @bye
783 NOTES:
785 * Need section on operation of automake: it reads Makefile.am and COPIES
786 the contents.  This section should include info on SUFFIXES, because
787 that is usually only needed when copying in additional targets (?)