Beginnings of switch to uniform naming scheme
[platform/upstream/automake.git] / automake.texi
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
7
8 @include version.texi
9
10 @ifinfo
11 This file documents GNU automake @value{VERSION}
12
13 Copyright (C) 1995 Free Software Foundation, Inc.
14
15 Permission is granted to make and distribute verbatim copies of
16 this manual provided the copyright notice and this permission notice
17 are preserved on all copies.
18
19 @ignore
20 Permission is granted to process this file through TeX and print the
21 results, provided the printed document carries copying permission
22 notice identical to this one except for the removal of this paragraph
23
24
25 @end ignore
26 Permission is granted to copy and distribute modified versions of this
27 manual under the conditions for verbatim copying, provided that the entire
28 resulting derived work is distributed under the terms of a permission
29 notice identical to this one.
30
31 Permission is granted to copy and distribute translations of this manual
32 into another language, under the above conditions for modified versions,
33 except that this permission notice may be stated in a translation approved
34 by the Foundation.
35 @end ifinfo
36
37
38 @titlepage
39 @title GNU AutoMake
40 @subtitle For version @value{VERSION}, @value{UPDATED}
41 @c copyright page
42 @page
43 @vskip 0pt plus 1filll
44 Copyright @copyright{} 1995 Free Software Foundation, Inc.
45 @sp 2
46 This is the first edition of the GNU AutoMake documentation,@*
47 and is consistent with GNU AutoMake @value{VERSION}.@*
48 @sp 2
49 Published by the Free Software Foundation @*
50 675 Massachusetts Avenue, @*
51 Cambridge, MA 02139 USA @*
52
53 Permission is granted to make and distribute verbatim copies of
54 this manual provided the copyright notice and this permission notice
55 are preserved on all copies.
56
57 Permission is granted to copy and distribute modified versions of this
58 manual under the conditions for verbatim copying, provided that the entire
59 resulting derived work is distributed under the terms of a permission
60 notice identical to this one.
61
62 Permission is granted to copy and distribute translations of this manual
63 into another language, under the above conditions for modified versions,
64 except that this permission notice may be stated in a translation
65 approved by the Free Software Foundation.
66 @end titlepage
67
68 @ifinfo
69 @node Top, Introduction, (dir), (dir)
70 @comment  node-name,  next,  previous,  up
71 @top
72
73 This file documents the GNU AutoMake package for creating GNU
74 Standards-compliant Makefiles from template files.  This edition
75 documents version @value{VERSION}.
76
77 @menu
78 * Introduction::                AutoMake's purpose
79 * Details::                     Creating an AutoMake template file
80 * Invoking automake::           Creating a Makefile.in
81 * Future::                      Some ideas for the future.
82 * Some index::                  Index of variables
83 @end menu
84
85 @end ifinfo
86
87 @node Introduction
88 @chapter Introduction
89
90 The GNU Makefile Standards Document
91 (@pxref{Makefile Conventions, , Makefile Conventions, standards.info, The
92 GNU Coding Standards})
93 is long, complicated,
94 and subject to change.  The goal of AutoMake is to remove the burden of
95 Makefile maintenance from back the individual GNU maintainer (and put it
96 on the back of the AutoMake maintainer)
97
98 Typical AutoMake input files are simply a series of macro definitions.
99 AutoMake processes these files to produce @file{Makefile.in}s which are
100 distribution-ready.
101
102 AutoMake does force some structure on the package maintainer.  However,
103 it is felt that this (minor) inconvenience is more than offset by
104 AutoMake's convenience.
105
106
107 @node Details
108 @chapter Making @code{automake} templates
109
110 @menu
111 * configure::                   AutoMake and configure
112 * Depth::                       Types of package hierarchy
113 * Programs::                    What gets built
114 * Source::                      Specifying source files
115 * Scripts::                     Building scripts
116 * Libraries::                   Building libraries
117 * Libstuff::                    Programs that aren't user-visible
118 * Data::                        Data files.
119 * Docs::                        Specifying documentation files
120 * ANSI::                        Automatic de-ANSI-fication
121 * Install::                     What gets installed
122 * Clean::                       What gets cleaned
123 * Distribution::                What gets distributed
124 * Tags::                        TAGS files
125 * Dependencies::                Automatic dependency tracking
126 * Extending::                   If the defaults aren't enough
127 @end menu
128
129 @node configure
130 @section How @code{automake} and @code{configure} interact
131
132 AutoMake enforces a certain amount of structure on the package
133 maintainer.  One such item is its requirement that the
134 @file{configure.in} for the package define the variables @samp{PACKAGE}
135 and @samp{VERSION}.
136
137 @var{PACKAGE} should be the name of the package as it appears when
138 bundled for distribution.  For instance, AutoMake defines @samp{PACKAGE}
139 to be @samp{am}.
140
141 @var{VERSION} should be the version number of the release being worked
142 on.  We recommend that you make @file{configure.in} the only place you
143 define the version number for your package; this makes releases simpler.
144
145 Here is an example of what to put in @file{configure.in}:
146
147 @example
148 PACKAGE=cpio
149 VERSION=2.3.911
150 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
151 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
152 AC_SUBST(PACKAGE)
153 AC_SUBST(VERSION)
154 @end example
155
156 If your @file{configure.in} uses @samp{AC_CONFIG_HEADER}, then in each
157 directory you should define the @samp{CONFIG_HEADER} variable to hold
158 the name of the header.
159
160 For instance, in cpio's @file{src/Makefile.am}, we see:
161
162 @example
163 CONFIG_HEADER = ../config.h
164 @end example
165
166
167 @code{automake} also assumes that your @file{configure} script will
168 define the variable @samp{INSTALL_SCRIPT}.  Until this is incorporated
169 in @code{autoconf}'s @samp{AC_PROG_INSTALL} macro, you can use this
170 replacement instead:
171
172 @example
173 ## --------------------------------------------------------- ##
174 ## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
175 ## substitution.                                             ##
176 ## --------------------------------------------------------- ##
177
178 AC_DEFUN(fp_PROG_INSTALL,
179 [AC_PROG_INSTALL
180 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='$@{INSTALL@} -m 755'
181 AC_SUBST(INSTALL_SCRIPT)dnl
182 ])
183 @end example
184
185
186 @code{automake} also assumes your @file{configure.in} calls
187 @samp{AC_ARG_PROGRAM}.
188
189
190 @node Depth
191 @section Types of directory hierarchy
192
193 @code{automake} supports three kinds of directory hierarcy: ``flat'',
194 ``shallow'', and ``deep''.
195
196 A flat package is one in which all the files are in a single directory.
197 The @file{Makefile.am} for such a package by definition lacks a
198 @samp{SUBDIRS} macro.  (There are not any @code{automake}-using packages
199 which are flat)
200
201 A deep package is one in which all the source lies in subdirectories;
202 the top level directory contains only configuration information.  GNU
203 cpio is a good example of such a package (as is GNU tar, although it
204 does not presently use @code{automake}).  The top level
205 @file{Makefile.am} for a deep package will contain a @samp{SUBDIRS}
206 macro, but no other macros to define objects which are built (eg
207 @samp{PROGRAMS}).
208
209 A shallow package is one in which the primary source resides in the
210 top-level directory, while various parts (typically libraries) reside in
211 subdirectories.  @code{automake} is one such package (as is GNU make,
212 which does not currently use @code{automake}).
213
214
215 The @samp{SUBDIRS} macro holds a list of subdirectories in which
216 building of various sorts can occur.  Many targets (eg @samp{all}) in
217 the generated @file{Makefile} will run both locally and in all specified
218 subdirectories.  Note that the directories listed in @samp{SUBDIRS} are
219 not expected to contain @file{Makefile.am}s; only @file{Makefile}s
220 (after configuration).  This allows inclusion of libraries from packages
221 which do not use @code{automake} (such as gettext).
222
223 If @samp{SUBDIRS} is defined, then your @file{configure.in} must include
224 @code{AC_PROG_MAKE_SET}.
225
226 FIXME supply complete list of recursive targets?
227
228
229 @node Programs
230 @section Which Programs Are Built
231
232 In a directory containing source that gets built into a program (as
233 opposed to a library), the @samp{PROGRAMS} variable is used:
234
235 @example
236 PROGRAMS = hello
237 @end example
238
239 In this simple case, the resulting @file{Makefile.in} will contain code
240 to generate a program named @code{hello}.  The variable
241 @samp{@var{prog}_SOURCE} is used to specify which source files get built
242 into an executable:
243
244 @example
245 hello_SOURCE = hello.c
246 @end example
247
248 This causes @file{hello.o} to be built from @code{hello.c} at compile
249 time, and then linked into @file{hello}.
250
251 Multiple programs can be built in a single directory -- simply list them
252 all in the @samp{PROGRAMS} definition.  Multiple programs can share a
253 single source file.  The source file must be listed in each ``_SOURCE''
254 definition.
255
256 Sometimes it is useful to determine the programs that are to be built at
257 configure time.  For instance, GNU cpio only builts @code{mt} and
258 @code{rmt} under special circumstances.
259
260 In this case, you must notify AutoMake of all the programs that can
261 possibly be built, but at the same time cause the generated
262 @file{Makefile.in} to use the programs specified by @code{configure}.
263 You can do this using the @code{AM_PROGRAMS} variable.  Here is the
264 relevant code from cpio:
265
266 @example
267 PROGRAMS = @@PROGS@@
268 AM_PROGRAMS = cpio pax mt rmt
269 @end example
270
271
272 If you need to link against libraries that are not found by
273 @code{configure}, you can use @samp{LDADD} to do so.  This variable
274 actually can be used to add any options to the linker command line.
275
276 Sometimes, multiple programs are built in one directory but do not share
277 the same link-time requirements.  In this case, you can use the
278 @samp{@var{prog}_LDADD} variable to override the global @samp{LDADD}.
279 (If this variable exists for a given program, then that program is not
280 linked using @samp{LDADD}).
281
282 For instance, in GNU cpio, @code{pax}, @code{cpio}, and @code{mt} are
283 linked against the library @file{libcpio.a}.  However, @code{rmt} is
284 built in the same directory, and has no such link requirement.  Thus:
285
286 @example
287 LDADD = ../lib/libcpio.a @@INTLLIBS@@
288 rmt_LDADD =
289 @end example
290
291
292 @node Source
293 @section Specifying Source Code
294
295 Any header files in your distribution must be listed in the
296 @samp{HEADERS} variable.  This is used both for making distributions,
297 and for automatic de-ANSI-fication.
298
299 @example
300 HEADERS = hello.h getopt.h rx.h
301 @end example
302
303 @samp{HEADERS} should also be used to list any sources files which are
304 conditionally built.  FIXME probably should use @samp{SOURCES} for this;
305 that support might even work.
306
307
308 @node Scripts
309 @section Programs Which are Scripts
310
311 It is possible to define and install programs which are scripts.  Such
312 programs should be listed in the @samp{SCRIPTS} variable.
313 @code{automake} doesn't define any dependencies for scripts; if a script
314 is not to be installed as-is, the @file{Makefile.am} should include the
315 appropriate rules.
316
317 @code{automake} itself is a script that is generated at configure time
318 from @file{automake.in}.  Here is how this is handled:
319
320 @example
321 SCRIPTS = automake
322
323 automake: automake.in
324         CONFIG_FILES=$@@ CONFIG_HEADERS= ./config.status
325 @end example
326
327
328 @node Libraries
329 @section Building Libraries
330
331 The @samp{LIBRARIES} variable holds the names of libraries to be built
332 in the current directory.  If the libraries to be built vary at
333 configure time, you may define @samp{AM_LIBRARIES} to supply
334 @code{automake} with the full static list of possible libraries.
335
336 For a given library @samp{zot}, the sources are taken to be in
337 @samp{@var{zot}_SOURCES}, just as for programs.  Note that libraries and
338 programs share one namespace in @code{automake}: one directory cannot
339 contain both a library (``liblob.a'') and a program (``lob'') with the
340 same name.
341
342 Here is how the @file{libcpio.a} library is built in the GNU cpio
343 distribution's @file{lib} subdirectory:
344
345 @example
346 LIBRARIES = cpio
347 cpio_SOURCES = dirname.c dstring.c error.c filemode.c \
348 getopt.c getopt1.c idcache.c makepath.c octal.c \
349 stpcpy.c stripslash.c userspec.c xmalloc.c xstrdup.c
350 @end example
351
352
353 @node Libstuff
354 @section Programs which are not User-Visible
355
356 @code{automake} allows for the automatic building and installation of
357 programs which are not actually used by the user, but are instead used
358 by other user-visible programs.  Such programs are installed in a
359 separate directory from user-visible programs.
360
361 For programs of this sort which are build from C source, define the
362 names in @samp{LIBPROGRAMS}.  For scripts, use @samp{LIBSCRIPTS}.  In
363 other respects, these variables are similar to @samp{PROGRAMS} and
364 @samp{SCRIPTS}.  Both of these variables have ``AM_'' override forms.
365
366 Here is how to generate a program named @code{goodbye}, a helper for
367 @code{hello}:
368
369 @example
370 LIBPROGRAMS = goodbye
371 goodbye_SOURCES = goodbye.c
372 @end example
373
374
375 @node Data
376 @section Architecture-independent data files
377
378 @code{automake} supports two different ways to install
379 architecture-independent data files.
380
381 The first variable that can be used is @samp{DATA}.  This is intended to
382 be used for only a small number of data files.  The files are installed
383 in @samp{$@{datadir@}}.
384
385 The second variable that can be used is @samp{PACKAGEDATA}.  This is
386 intended for a larger number of data files.  The files are installed in
387 @samp{$@{datadir@}/$@{PACKAGE@}}.  This variable is what @code{automake}
388 itself uses:
389
390 @example
391 PACKAGEDATA = clean-kr.am clean.am compile-kr.am compile-vars.am \
392 compile.am data.am depend.am dist-subd-top.am dist-subd-vars.am \
393 dist-subd.am dist-vars.am dist.am footer.am header-vars.am header.am \
394 libscripts.am libprograms.am libraries-vars.am libraries.am library.am \
395 mans-vars.am mans.am packagedata.am program.am programs.am remake-hdr.am \
396 remake-subd.am remake.am scripts.am subdirs.am tags.am tags-subd.am \
397 texinfos-vars.am texinfos.am hack-make.sed nl-remove.sed
398 @end example
399
400 All @samp{DATA} and @samp{PACKAGEDATA} files are included in a
401 distribution.
402
403
404 @node Docs
405 @section Texinfo and Man Pages
406
407 @subsection Texinfo
408 If the current directory contains Texinfo source, you must declare it
409 with the @samp{TEXINFOS} macro.
410 Note that any Texinfo source file must end in the @file{.texi} extension
411 (@file{.texinfo} won't work).
412
413 If the @file{.texi} file ``@@include''s @file{version.texi}, then that
414 file will be automatically generated.  @file{version.texi} defines three
415 Texinfo macros you can reference: @samp{EDITION}, @samp{VERSION}, and
416 @samp{UPDATED}.  The first two hold the version number of your package
417 (but are kept separate for clarity); the last is the date the primary
418 file was last modified.
419 The @file{version.texi} support requires a version of @code{date} that
420 accepts the @samp{-r} (read time from a file) option.
421
422 Sometimes an info file actually depends on more than one @file{.texi}
423 file.  For instance, in the @samp{xdvik} distribution,
424 @file{kpathsea.texi} includes the files @file{install.texi},
425 @file{copying.texi}, and @file{freedom.texi}.  You can tell
426 @code{automake} about these dependencies using the @samp{texi_TEXINFOS}
427 variable.  Here is how @samp{xdvik} could do it:
428
429 @example
430 TEXINFOS = kpathsea.texi
431 kpathsea_TEXINFOS = install.texi copying.texi freedom.texi
432 @end example
433
434 @code{automake} might be modified to detect these dependencies
435 automatically.
436
437 Currently @code{automake} can only handle one primary @file{.texi} file.
438 This restriction will be lifted if it proves too onerous.
439
440 @code{automake} will warn if a directory containing Texinfo source does
441 not also contain the file @file{texinfo.tex}.  (I'm not sure if this is
442 a good rule or not.  Comments?)
443
444
445 @subsection Man pages
446 A package can also include man pages.  (Though see the GNU standards on
447 this matter.  FIXME xref).
448 Man pages are declared using the @samp{MANS} macro.
449
450
451 Here is how the documentation is handled in GNU cpio (which includes
452 both Texinfo documentation and man pages):
453
454 @example
455 TEXINFOS = cpio.texi
456 MANS = cpio.1 mt.1
457 @end example
458
459 Texinfo source, info pages and man pages are all considered to be
460 ``source'' for the purposes of making a distribution.
461
462
463 @node ANSI
464 @section Automatic de-ANSI-fication of Source
465
466 If @file{Makefile.am} includes the text @samp{@@kr@@}, then code to
467 handle automatic de-ANSI-fication is included in the generated
468 @file{Makefile.in}.
469
470 This means that each C source file will be treated as ANSI C.  If no
471 ANSI C compiler is available on the build system, then the code will be
472 turned into K&R C before compilation.
473
474 Each directory that uses automatic de-ANSI-fication must include the
475 source files @file{ansi2knr.c} and @file{ansi2knr.1}.  Also, your
476 @file{configure} script must define the variables @samp{U} and
477 @samp{ANSI2KNR}.  Here is a snippet you can add to @file{aclocal.m4} to
478 achieve this:
479
480 @example
481 ## ------------------------------- ##
482 ## Check for function prototypes.  ##
483 ## ------------------------------- ##
484
485 AC_DEFUN(fp_C_PROTOTYPES,
486 [AC_REQUIRE([fp_PROG_CC_STDC])
487 AC_MSG_CHECKING([for function prototypes])
488 if test "$ac_cv_prog_cc_stdc" != no; then
489   AC_MSG_RESULT(yes)
490   AC_DEFINE(PROTOTYPES)
491   U= ANSI2KNR=
492 else
493   AC_MSG_RESULT(no)
494   U=_ ANSI2KNR=./ansi2knr
495 fi
496 AC_SUBST(U)dnl
497 AC_SUBST(ANSI2KNR)dnl
498 ])
499
500
501 ## ----------------------------------------- ##
502 ## ANSIfy the C compiler whenever possible.  ##
503 ## ----------------------------------------- ##
504
505 # @@defmac AC_PROG_CC_STDC
506 # @@maindex PROG_CC_STDC
507 # @@ovindex CC
508 # If the C compiler in not in ANSI C mode by default, try to add an option
509 # to output variable @@code@{CC@} to make it so.  This macro tries various
510 # options that select ANSI C on some system or another.  It considers the
511 # compiler to be in ANSI C mode if it defines @@code@{__STDC__@} to 1 and
512 # handles function prototypes correctly.
513 #
514 # If you use this macro, you should check after calling it whether the C
515 # compiler has been set to accept ANSI C; if not, the shell variable
516 # @@code@{ac_cv_prog_cc_stdc@} is set to @@samp@{no@}.  If you wrote your source
517 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
518 # program @@code@{ansi2knr@}, which comes with Ghostscript.
519 # @@end defmac
520
521 AC_DEFUN(fp_PROG_CC_STDC,
522 [AC_MSG_CHECKING(for $@{CC-cc@} option to accept ANSI C)
523 AC_CACHE_VAL(ac_cv_prog_cc_stdc,
524 [ac_cv_prog_cc_stdc=no
525 ac_save_CFLAGS="$CFLAGS"
526 # Don't try gcc -ansi; that turns off useful extensions and
527 # breaks some systems' header files.
528 # AIX                   -qlanglvl=ansi
529 # Ultrix and OSF/1      -std1
530 # HP-UX                 -Aa -D_HPUX_SOURCE
531 # SVR4                  -Xc
532 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
533 do
534   CFLAGS="$ac_save_CFLAGS $ac_arg"
535   AC_TRY_COMPILE(
536 [#if !defined(__STDC__) || __STDC__ != 1
537 choke me
538 #endif  
539 ], [int test (int i, double x);
540 struct s1 @{int (*f) (int a);@};
541 struct s2 @{int (*f) (double a);@};],
542 [ac_cv_prog_cc_stdc="$ac_arg"; break])
543 done
544 CFLAGS="$ac_save_CFLAGS"
545 ])
546 AC_MSG_RESULT($ac_cv_prog_cc_stdc)
547 case "x$ac_cv_prog_cc_stdc" in
548   x|xno) ;;
549   *) CC="$CC $ac_cv_prog_cc_stdc" ;;
550 esac
551 ])
552 @end example
553
554
555 @node Install
556 @section What Gets Installed
557
558 Naturally, @code{automake} handles the details of actually installing
559 your program once it has been built.  Any objects specified in
560 @samp{PROGRAMS}, @samp{LIBPROGRAMS}, @samp{SCRIPTS}, @samp{LIBSCRIPTS},
561 @samp{DATA}, and @samp{PACKAGEDATA} are automatically installed in the
562 appropriate place.
563
564 @code{automake} also handles installing any specified info and man
565 pages.
566
567 FIXME xref to Extending node here; sometimes you need to install more.
568
569 @code{automake} generates separate @samp{install-data} and
570 @samp{install-exec} targets, in case the installer is installing on
571 multiple machines which share directory structure -- these targets allow
572 the machine-independent parts to be installed only once.
573
574 @code{automake} also generates an @samp{uninstall} target, and an
575 @samp{installdirs} target.
576
577
578 @node Clean
579 @section Clean targets
580
581 The GNU Makefile Standards specify a number of different clean rules.
582 Generally the files that can cleaned are determined automatically by
583 @code{automake}.  Of course, @code{automake} also recognizes some
584 variables that can be defined to specify additional files to clean.
585 These variables are @samp{MOSTLYCLEANFILES}, @samp{CLEANFILES},
586 @samp{DISTCLEANFILES}, and @samp{MAINTAINERCLEANFILES}.
587
588
589 @node Distribution
590 @section Building a Release
591
592 The @samp{dist} target in the generated @file{Makefile.in} can be used
593 to generate a gzip'd tar file for distribution.  The tar file is named
594 based on the @var{PACKAGE} and @var{VERSION} variables.
595
596 For the most part, the files to distribute are automatically found by
597 @code{automake}: all source files are automatically included in a
598 distribution, as are all @file{Makefile.am}s and @file{Makefile.in}s.
599 @code{automake} also has a built-in list of commonly used files which,
600 if present in the current directory, are automatically included.  This
601 list is printed by @code{automake --help}.
602
603 Still, sometimes there are files which must be distributed, but which
604 are not covered in the automatic rules.  These files should be listed in
605 the @samp{DIST_OTHER} variable.
606
607 For instance, in the @code{automake} distribution, 
608 @file{automake.in} (the source to
609 @code{automake}) is not found automatically.  So in the
610 @file{Makefile.am}, we have:
611
612 @example
613 DIST_OTHER = automake.in
614 @end example
615
616 FIXME mention files that are found automatically but not printed by
617 --help.
618 FIXME: describe DIST_SUBDIRS or not?  It is a hack which might go away.
619
620 @node Tags
621 @section Interfacing to @code{etags}
622
623 @code{automake} will generate rules to generate @file{TAGS} files for
624 use with GNU Emacs under some circumstances.
625
626 If any C source code or headers are present, then a @file{TAGS} file
627 will be generated for the directory.
628
629 At the topmost directory of a multi-directory package, a @file{TAGS}
630 file will be generated that will include by reference all @file{TAGS}
631 files from subdirectories.
632
633 Also, if the variable @samp{ETAGS_ARGS} is defined, a @file{TAGS} file
634 will be generated.  This variable is intended for use in directories
635 which contain taggable source that @code{etags} does not understand.
636 (For instance, it could be set to a regexp to recognize node names in
637 Texinfo documentation)
638
639
640 @node Dependencies
641 @section Automatic dependency tracking
642
643 As a developer it is often painful to continually update the
644 @file{Makefile.in} whenever the include-file dependencies change in a
645 project.  @code{automake} supplies a way to automatically track
646 dependency changes, and distribute the dependencies in the generated
647 @file{Makefile.in}.
648
649 Currently this support requires the use of @code{GNU make} and
650 @code{gcc}.  It might become possible in the future to supply a
651 different dependency generating program, if there is enough demand.
652
653 This mode is enabled by default if any C program or library is defined
654 in the current directory.
655
656 When you decide to make a distribution, the @samp{dist} target will
657 re-run @code{automake} with the @samp{--include-deps} option.  This
658 causes the previously generated dependencies to be inserted into the
659 generated @file{Makefile.in}, and thus into the distribution.
660 @samp{--include-deps} also turns off inclusion of the dependency
661 generation code.
662
663 There should probably be a way to suppress this mode.
664
665
666 @node Extending
667 @section When AutoMake Isn't Enough
668
669 Sometimes @code{automake} isn't enough.  Then you just lose.
670
671 Actually, @code{automake}s implicit copying semantics means that many
672 problems can be worked around by simply adding some @code{make} targets
673 and rules to @file{Makefile.in}.  @code{automake} will ignore these
674 additions.
675
676 There are some caveats to doing this.  You can't overload a target
677 already used by @code{automake}.  However, various useful targets have a
678 ``-local'' version you can specify in your @file{Makefile.in}.
679
680 The targets that support a local version are @samp{all}, @samp{info},
681 @samp{dvi}, @samp{check}, @samp{install-data}, @samp{install-exec}, and
682 @samp{uninstall}.  (Currently @samp{install} is also supported, but this
683 might go away)
684
685 For instance, here is how to install a file in @file{/etc}:
686
687 @example
688 install-data-local:
689         $(INSTALL_DATA) $(srcdir)/afile /etc/afile
690 @end example
691
692
693 @node Invoking automake
694 @chapter Using @code{automake} to Create @file{Makefile.in}
695
696 There are basically two modes in which @code{automake} can be run.
697
698 In the first, most common, mode, @code{automake} is simply run without
699 any arguments.  It will determine which @file{Makefile.am}s exist by
700 looking in the current directory and immediate subdirectories, and will
701 automatically build @file{Makefile.in}s in these directories.
702
703 In the second mode, @code{automake} is run with the name of one or more
704 @file{Makefile}s as arguments.  It then rebuilds the corresponding
705 @file{Makefile.in}s from the (also) corresponding @file{Makefile.am}s.
706 This second mode is most often used by @code{make} itself, when it
707 notices that a @code{Makefile.in} is out of date.
708
709
710 @node Future
711 @chapter Some ideas for the future
712
713 Here are some things that might happen in the future:
714
715 @itemize @bullet
716 @item
717 Better error checking would be good.
718 @end itemize
719
720 @node Some index
721 @chapter Nothing yet
722
723 @bye
724
725 NOTES:
726
727 * Need section on operation of automake: it reads Makefile.am and COPIES
728 the contents.  This section should include info on SUFFIXES, because
729 that is usually only needed when copying in additional targets (?)