source: trunk/essentials/sys-devel/automake-1.4/automake.texi@ 3253

Last change on this file since 3253 was 3124, checked in by bird, 19 years ago

automake 1.4-p6

File size: 118.4 KB
Line 
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@dircategory GNU admin
11@direntry
12* automake: (automake). Making Makefile.in's
13@end direntry
14
15@dircategory Individual utilities
16@direntry
17* aclocal: (automake)Invoking aclocal. Generating aclocal.m4
18@end direntry
19
20@ifinfo
21This file documents GNU automake @value{VERSION}
22
23Copyright (C) 1995, 96, 97, 98 Free Software Foundation, Inc.
24
25Permission is granted to make and distribute verbatim copies of
26this manual provided the copyright notice and this permission notice
27are preserved on all copies.
28
29@ignore
30Permission is granted to process this file through TeX and print the
31results, provided the printed document carries copying permission
32notice identical to this one except for the removal of this paragraph
33
34
35@end ignore
36Permission is granted to copy and distribute modified versions of this
37manual under the conditions for verbatim copying, provided that the entire
38resulting derived work is distributed under the terms of a permission
39notice identical to this one.
40
41Permission is granted to copy and distribute translations of this manual
42into another language, under the above conditions for modified versions,
43except that this permission notice may be stated in a translation approved
44by the Foundation.
45@end ifinfo
46
47
48@titlepage
49@title GNU Automake
50@subtitle For version @value{VERSION}, @value{UPDATED}
51@author David MacKenzie and Tom Tromey
52
53@page
54@vskip 0pt plus 1filll
55Copyright @copyright{} 1995, 96 Free Software Foundation, Inc.
56@sp 2
57This is the first edition of the GNU Automake documentation,@*
58and is consistent with GNU Automake @value{VERSION}.@*
59@sp 2
60Published by the Free Software Foundation @*
6159 Temple Place - Suite 330, @*
62Boston, MA 02111-1307 USA @*
63
64Permission is granted to make and distribute verbatim copies of
65this manual provided the copyright notice and this permission notice
66are preserved on all copies.
67
68Permission is granted to copy and distribute modified versions of this
69manual under the conditions for verbatim copying, provided that the entire
70resulting derived work is distributed under the terms of a permission
71notice identical to this one.
72
73Permission is granted to copy and distribute translations of this manual
74into another language, under the above conditions for modified versions,
75except that this permission notice may be stated in a translation
76approved by the Free Software Foundation.
77@end titlepage
78
79@c Define an index of configure output variables.
80@defcodeindex ov
81@c Define an index of configure variables.
82@defcodeindex cv
83@c Define an index of options.
84@defcodeindex op
85@c Define an index of targets.
86@defcodeindex tr
87@c Define an index of commands.
88@defcodeindex cm
89
90@c Put the macros and variables into their own index.
91@c @syncodeindex fn cp
92@syncodeindex ov vr
93@syncodeindex cv vr
94@syncodeindex fn vr
95
96@c Put everything else into one index (arbitrarily chosen to be the concept index).
97@syncodeindex op cp
98@syncodeindex tr cp
99@syncodeindex cm cp
100
101@ifinfo
102@node Top, Introduction, (dir), (dir)
103@comment node-name, next, previous, up
104@top GNU Automake
105
106This file documents the GNU Automake package for creating GNU
107Standards-compliant Makefiles from template files. This edition
108documents version @value{VERSION}.
109
110@menu
111* Introduction:: Automake's purpose
112* Generalities:: General ideas
113* Examples:: Some example packages
114* Invoking Automake:: Creating a Makefile.in
115* configure:: Scanning configure.in
116* Top level:: The top-level Makefile.am
117* Programs:: Building programs and libraries
118* Other objects:: Other derived objects
119* Other GNU Tools:: Other GNU Tools
120* Documentation:: Building documentation
121* Install:: What gets installed
122* Clean:: What gets cleaned
123* Dist:: What goes in a distribution
124* Tests:: Support for test suites
125* Options:: Changing Automake's behavior
126* Miscellaneous:: Miscellaneous rules
127* Include:: Including extra files in an Automake template.
128* Conditionals:: Conditionals
129* Gnits:: The effect of @code{--gnu} and @code{--gnits}
130* Cygnus:: The effect of @code{--cygnus}
131* Extending:: Extending Automake
132* Distributing:: Distributing the Makefile.in
133* Future:: Some ideas for the future
134* Macro and Variable Index::
135* General Index::
136@end menu
137
138@end ifinfo
139
140
141@node Introduction, Generalities, Top, Top
142@chapter Introduction
143
144Automake is a tool for automatically generating @file{Makefile.in}s from
145files called @file{Makefile.am}. Each @file{Makefile.am} is basically a
146series of @code{make} macro definitions (with rules being thrown in
147occasionally). The generated @file{Makefile.in}s are compliant with the
148GNU Makefile standards.
149
150@cindex GNU Makefile standards
151
152The GNU Makefile Standards Document
153(@pxref{Makefile Conventions, , , standards, The GNU Coding Standards})
154is long, complicated, and subject to change. The goal of Automake is to
155remove the burden of Makefile maintenance from the back of the
156individual GNU maintainer (and put it on the back of the Automake
157maintainer).
158
159The typical Automake input file is simply a series of macro definitions.
160Each such file is processed to create a @file{Makefile.in}. There
161should generally be one @file{Makefile.am} per directory of a project.
162
163@cindex Constraints of Automake
164@cindex Automake constraints
165
166Automake does constrain a project in certain ways; for instance it
167assumes that the project uses Autoconf (@pxref{Top, , Introduction,
168autoconf, The Autoconf Manual}), and enforces certain restrictions on
169the @file{configure.in} contents.
170
171@cindex Automake requirements
172@cindex Requirements, Automake
173
174Automake requires @code{perl} in order to generate the
175@file{Makefile.in}s. However, the distributions created by Automake are
176fully GNU standards-compliant, and do not require @code{perl} in order
177to be built.
178
179@cindex BUGS, reporting
180@cindex Reporting BUGS
181@cindex E-mail, bug reports
182
183Mail suggestions and bug reports for Automake to
184@email{bug-automake@@gnu.org}.
185
186
187@node Generalities, Examples, Introduction, Top
188@chapter General ideas
189
190The following sections cover a few basic ideas that will help you
191understand how Automake works.
192
193@menu
194* General Operation:: General operation of Automake
195* Depth:: The kinds of packages
196* Strictness:: Standards conformance checking
197* Uniform:: The Uniform Naming Scheme
198* Canonicalization:: How derived variables are named
199@end menu
200
201
202@node General Operation, Depth, Generalities, Generalities
203@section General Operation
204
205Automake works by reading a @file{Makefile.am} and generating a
206@file{Makefile.in}. Certain macros and targets defined in the
207@file{Makefile.am} instruct Automake to generate more specialized code;
208for instance, a @samp{bin_PROGRAMS} macro definition will cause targets
209for compiling and linking programs to be generated.
210
211@cindex Non-standard targets
212@cindex cvs-dist, non-standard example
213@trindex cvs-dist
214
215The macro definitions and targets in the @file{Makefile.am} are copied
216verbatim into the generated file. This allows you to add arbitrary code
217into the generated @file{Makefile.in}. For instance the Automake
218distribution includes a non-standard @code{cvs-dist} target, which the
219Automake maintainer uses to make distributions from his source control
220system.
221
222@cindex GNU make extensions
223
224Note that GNU make extensions are not recognized by Automake. Using
225such extensions in a @file{Makefile.am} will lead to errors or confusing
226behavior.
227
228Automake tries to group comments with adjoining targets and macro
229definitions in an intelligent way.
230
231@cindex Make targets, overriding
232@cindex Overriding make targets
233
234A target defined in @file{Makefile.am} generally overrides any such
235target of a similar name that would be automatically generated by
236@code{automake}. Although this is a supported feature, it is generally
237best to avoid making use of it, as sometimes the generated rules are
238very particular.
239
240@cindex Macros, overriding
241@cindex Overriding make macros
242
243Similarly, a macro defined in @file{Makefile.am} will override any
244definition of the macro that @code{automake} would ordinarily create.
245This feature is more often useful than the ability to override a target
246definition. Be warned that many of the macros generated by
247@code{automake} are considered to be for internal use only, and their
248names might change in future releases.
249
250@cindex Recursive operation of Automake
251@cindex Automake, recursive operation
252@cindex Example of recursive operation
253
254When examining a macro definition, Automake will recursively examine
255macros referenced in the definition. For example, if Automake is
256looking at the content of @code{foo_SOURCES} in this snippet
257
258@example
259xs = a.c b.c
260foo_SOURCES = c.c $(xs)
261@end example
262
263it would use the files @file{a.c}, @file{b.c}, and @file{c.c} as the
264contents of @code{foo_SOURCES}.
265
266@cindex ## (special Automake comment)
267@cindex Special Automake comment
268@cindex Comment, special to Automake
269
270Automake also allows a form of comment which is @emph{not} copied into
271the output; all lines beginning with @samp{##} are completely ignored by
272Automake.
273
274It is customary to make the first line of @file{Makefile.am} read:
275
276@cindex Makefile.am, first line
277@cindex First line of Makefile.am
278
279@example
280## Process this file with automake to produce Makefile.in
281@end example
282
283@c FIXME discuss putting a copyright into Makefile.am here? I would but
284@c I don't know quite what to say.
285
286@c FIXME document customary ordering of Makefile.am here!
287
288
289@node Depth, Strictness, General Operation, Generalities
290@section Depth
291
292@cindex Flat package
293@cindex Package, Flat
294@cindex Shallow package
295@cindex Package, shallow
296@cindex Deep package
297@cindex Package, deep
298
299@code{automake} supports three kinds of directory hierarchy:
300@samp{flat}, @samp{shallow}, and @samp{deep}.
301
302A @dfn{flat} package is one in which all the files are in a single
303directory. The @file{Makefile.am} for such a package by definition
304lacks a @code{SUBDIRS} macro. An example of such a package is
305@code{termutils}.
306@vindex SUBDIRS
307
308@cindex SUBDIRS, deep package
309
310A @dfn{deep} package is one in which all the source lies in
311subdirectories; the top level directory contains mainly configuration
312information. GNU @code{cpio} is a good example of such a package, as is
313GNU @code{tar}. The top level @file{Makefile.am} for a deep package
314will contain a @code{SUBDIRS} macro, but no other macros to define
315objects which are built.
316
317A @dfn{shallow} package is one in which the primary source resides in
318the top-level directory, while various parts (typically libraries)
319reside in subdirectories. Automake is one such package (as is GNU
320@code{make}, which does not currently use @code{automake}).
321
322
323@node Strictness, Uniform, Depth, Generalities
324@section Strictness
325
326@cindex Non-GNU packages
327
328While Automake is intended to be used by maintainers of GNU packages, it
329does make some effort to accommodate those who wish to use it, but do
330not want to use all the GNU conventions.
331
332@cindex Strictness, defined
333@cindex Strictness, foreign
334@cindex foreign strictness
335@cindex Strictness, gnu
336@cindex gnits strictness
337@cindex Strictness, gnits
338@cindex gnits strictness
339
340To this end, Automake supports three levels of @dfn{strictness}---the
341strictness indicating how stringently Automake should check standards
342conformance.
343
344The valid strictness levels are:
345
346@table @samp
347@item foreign
348Automake will check for only those things which are absolutely
349required for proper operations. For instance, whereas GNU standards
350dictate the existence of a @file{NEWS} file, it will not be required in
351this mode. The name comes from the fact that Automake is intended to be
352used for GNU programs; these relaxed rules are not the standard mode of
353operation.
354
355@item gnu
356Automake will check---as much as possible---for compliance to the GNU
357standards for packages. This is the default.
358
359@item gnits
360Automake will check for compliance to the as-yet-unwritten @dfn{Gnits
361standards}. These are based on the GNU standards, but are even more
362detailed. Unless you are a Gnits standards contributor, it is
363recommended that you avoid this option until such time as the Gnits
364standard is actually published.
365@end table
366
367For more information on the precise implications of the strictness
368level, see @ref{Gnits}.
369
370
371@node Uniform, Canonicalization, Strictness, Generalities
372@section The Uniform Naming Scheme
373
374@cindex Uniform naming scheme
375
376Automake macros (from here on referred to as @emph{variables}) generally
377follow a @dfn{uniform naming scheme} that makes it easy to decide how
378programs (and other derived objects) are built, and how they are
379installed. This scheme also supports @code{configure} time
380determination of what should be built.
381
382@cindex _PROGRAMS primary variable
383@cindex PROGRAMS primary variable
384@cindex Primary variable, PROGRAMS
385
386@cindex Primary variable, defined
387
388At @code{make} time, certain variables are used to determine which
389objects are to be built. These variables are called @dfn{primary
390variables}. For instance, the primary variable @code{PROGRAMS} holds a
391list of programs which are to be compiled and linked.
392@vindex PROGRAMS
393
394@cindex pkglibdir, defined
395@cindex pkgincludedir, defined
396@cindex pkgdatadir, defined
397
398@vindex pkglibdir
399@vindex pkgincludedir
400@vindex pkgdatadir
401
402A different set of variables is used to decide where the built objects
403should be installed. These variables are named after the primary
404variables, but have a prefix indicating which standard directory should
405be used as the installation directory. The standard directory names are
406given in the GNU standards (@pxref{Directory Variables, , , standards,
407The GNU Coding Standards}). Automake extends this list with
408@code{pkglibdir}, @code{pkgincludedir}, and @code{pkgdatadir}; these are
409the same as the non-@samp{pkg} versions, but with @samp{@@PACKAGE@@}
410appended. For instance, @code{pkglibdir} is defined as
411@code{$(datadir)/@@PACKAGE@@}.
412@cvindex PACKAGE
413
414@cindex EXTRA_, prepending
415
416For each primary, there is one additional variable named by prepending
417@samp{EXTRA_} to the primary name. This variable is used to list
418objects which may or may not be built, depending on what
419@code{configure} decides. This variable is required because Automake
420must statically know the entire list of objects that may be built in
421order to generate a @file{Makefile.in} that will work in all cases.
422
423@cindex EXTRA_PROGRAMS, defined
424@cindex Example, EXTRA_PROGRAMS
425@cindex cpio example
426
427For instance, @code{cpio} decides at configure time which programs are
428built. Some of the programs are installed in @code{bindir}, and some
429are installed in @code{sbindir}:
430
431@example
432EXTRA_PROGRAMS = mt rmt
433bin_PROGRAMS = cpio pax
434sbin_PROGRAMS = @@PROGRAMS@@
435@end example
436
437Defining a primary variable without a prefix (e.g. @code{PROGRAMS}) is
438an error.
439
440Note that the common @samp{dir} suffix is left off when constructing the
441variable names; thus one writes @samp{bin_PROGRAMS} and not
442@samp{bindir_PROGRAMS}.
443
444Not every sort of object can be installed in every directory. Automake
445will flag those attempts it finds in error. Automake will also diagnose
446obvious misspellings in directory names.
447
448@cindex Extending list of installation directories
449@cindex Installation directories, extending list
450
451Sometimes the standard directories---even as augmented by Automake---
452are not enough. In particular it is sometimes useful, for clarity, to
453install objects in a subdirectory of some predefined directory. To this
454end, Automake allows you to extend the list of possible installation
455directories. A given prefix (e.g. @samp{zar}) is valid if a variable of
456the same name with @samp{dir} appended is defined (e.g. @code{zardir}).
457
458@cindex HTML support, example
459
460For instance, until HTML support is part of Automake, you could use this
461to install raw HTML documentation:
462
463@example
464htmldir = $(prefix)/html
465html_DATA = automake.html
466@end example
467
468@cindex noinst primary prefix, definition
469
470The special prefix @samp{noinst} indicates that the objects in question
471should not be installed at all.
472
473@cindex check primary prefix, definition
474
475The special prefix @samp{check} indicates that the objects in question
476should not be built until the @code{make check} command is run.
477
478Possible primary names are @samp{PROGRAMS}, @samp{LIBRARIES},
479@samp{LISP}, @samp{SCRIPTS}, @samp{DATA}, @samp{HEADERS}, @samp{MANS},
480and @samp{TEXINFOS}.
481@vindex PROGRAMS
482@vindex LIBRARIES
483@vindex LISP
484@vindex SCRIPTS
485@vindex DATA
486@vindex HEADERS
487@vindex MANS
488@vindex TEXINFOS
489
490
491@node Canonicalization, , Uniform, Generalities
492@section How derived variables are named
493
494@cindex canonicalizing Automake macros
495
496Sometimes a Makefile variable name is derived from some text the user
497supplies. For instance, program names are rewritten into Makefile macro
498names. Automake canonicalizes this text, so that it does not have to
499follow Makefile macro naming rules. All characters in the name except
500for letters, numbers, and the underscore are turned into underscores
501when making macro references. For example, if your program is named
502@code{sniff-glue}, the derived variable name would be
503@code{sniff_glue_SOURCES}, not @code{sniff-glue_SOURCES}.
504
505
506@node Examples, Invoking Automake, Generalities, Top
507@chapter Some example packages
508
509@menu
510* Complete:: A simple example, start to finish
511* Hello:: A classic program
512* etags:: Building etags and ctags
513@end menu
514
515
516@node Complete, Hello, Examples, Examples
517@section A simple example, start to finish
518
519@cindex Complete example
520
521Let's suppose you just finished writing @code{zardoz}, a program to make
522your head float from vortex to vortex. You've been using Autoconf to
523provide a portability framework, but your @file{Makefile.in}s have been
524ad-hoc. You want to make them bulletproof, so you turn to Automake.
525
526@cindex AM_INIT_AUTOMAKE, example use
527
528The first step is to update your @file{configure.in} to include the
529commands that @code{automake} needs. The simplest way to do this is to
530add an @code{AM_INIT_AUTOMAKE} call just after @code{AC_INIT}:
531
532@example
533AM_INIT_AUTOMAKE(zardoz, 1.0)
534@end example
535
536Since your program doesn't have any complicating factors (e.g., it
537doesn't use @code{gettext}, it doesn't want to build a shared library),
538you're done with this part. That was easy!
539
540@cindex aclocal program, introduction
541@cindex aclocal.m4, preexisting
542@cindex acinclude.m4, defined
543
544Now you must regenerate @file{configure}. But to do that, you'll need
545to tell @code{autoconf} how to find the new macro you've used. The
546easiest way to do this is to use the @code{aclocal} program to generate
547your @file{aclocal.m4} for you. But wait... you already have an
548@file{aclocal.m4}, because you had to write some hairy macros for your
549program. The @code{aclocal} program lets you put your own macros into
550@file{acinclude.m4}, so simply rename and then run:
551
552@example
553mv aclocal.m4 acinclude.m4
554aclocal
555autoconf
556@end example
557
558@cindex zardoz example
559
560Now it is time to write your @file{Makefile.am} for @code{zardoz}.
561Since @code{zardoz} is a user program, you want to install it where the
562rest of the user programs go. Additionally, @code{zardoz} has some
563Texinfo documentation. Your @file{configure.in} script uses
564@code{AC_REPLACE_FUNCS}, so you need to link against @samp{@@LIBOBJS@@}.
565So here's what you'd write:
566
567@example
568bin_PROGRAMS = zardoz
569zardoz_SOURCES = main.c head.c float.c vortex9.c gun.c
570zardoz_LDADD = @@LIBOBJS@@
571
572info_TEXINFOS = zardoz.texi
573@end example
574
575Now you can run @code{automake --add-missing} to generate your
576@file{Makefile.in} and grab any auxiliary files you might need, and
577you're done!
578
579
580@node Hello, etags, Complete, Examples
581@section A classic program
582
583@cindex Example, GNU Hello
584@cindex Hello example
585@cindex GNU Hello, example
586
587@uref{ftp://prep.ai.mit.edu/pub/gnu/hello-1.3.tar.gz, GNU hello} is
588renowned for its classic simplicity and versatility. This section shows
589how Automake could be used with the GNU Hello package. The examples
590below are from the latest beta version of GNU Hello, but with all of the
591maintainer-only code stripped out, as well as all copyright comments.
592
593Of course, GNU Hello is somewhat more featureful than your traditional
594two-liner. GNU Hello is internationalized, does option processing, and
595has a manual and a test suite. GNU Hello is a deep package.
596
597@cindex configure.in, from GNU Hello
598@cindex GNU Hello, configure.in
599@cindex Hello, configure.in
600
601Here is the @file{configure.in} from GNU Hello:
602
603@example
604dnl Process this file with autoconf to produce a configure script.
605AC_INIT(src/hello.c)
606AM_INIT_AUTOMAKE(hello, 1.3.11)
607AM_CONFIG_HEADER(config.h)
608
609dnl Set of available languages.
610ALL_LINGUAS="de fr es ko nl no pl pt sl sv"
611
612dnl Checks for programs.
613AC_PROG_CC
614AC_ISC_POSIX
615
616dnl Checks for libraries.
617
618dnl Checks for header files.
619AC_STDC_HEADERS
620AC_HAVE_HEADERS(string.h fcntl.h sys/file.h sys/param.h)
621
622dnl Checks for library functions.
623AC_FUNC_ALLOCA
624
625dnl Check for st_blksize in struct stat
626AC_ST_BLKSIZE
627
628dnl internationalization macros
629AM_GNU_GETTEXT
630AC_OUTPUT([Makefile doc/Makefile intl/Makefile po/Makefile.in \
631 src/Makefile tests/Makefile tests/hello],
632 [chmod +x tests/hello])
633@end example
634
635The @samp{AM_} macros are provided by Automake (or the Gettext library);
636the rest are standard Autoconf macros.
637
638
639The top-level @file{Makefile.am}:
640
641@example
642EXTRA_DIST = BUGS ChangeLog.O
643SUBDIRS = doc intl po src tests
644@end example
645
646As you can see, all the work here is really done in subdirectories.
647
648The @file{po} and @file{intl} directories are automatically generated
649using @code{gettextize}; they will not be discussed here.
650
651@cindex Texinfo file handling example
652@cindex Example, handling Texinfo files
653
654In @file{doc/Makefile.am} we see:
655
656@example
657info_TEXINFOS = hello.texi
658hello_TEXINFOS = gpl.texi
659@end example
660
661This is sufficient to build, install, and distribute the GNU Hello
662manual.
663
664@cindex Regression test example
665@cindex Example, regression test
666
667Here is @file{tests/Makefile.am}:
668
669@example
670TESTS = hello
671EXTRA_DIST = hello.in testdata
672@end example
673
674The script @file{hello} is generated by @code{configure}, and is the
675only test case. @code{make check} will run this test.
676
677@cindex INCLUDES, example usage
678
679Last we have @file{src/Makefile.am}, where all the real work is done:
680
681@example
682bin_PROGRAMS = hello
683hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h system.h
684hello_LDADD = @@INTLLIBS@@ @@ALLOCA@@
685localedir = $(datadir)/locale
686INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\"
687@end example
688
689
690@node etags, , Hello, Examples
691@section Building etags and ctags
692
693@cindex Example, ctags and etags
694@cindex ctags Example
695@cindex etags Example
696
697Here is another, trickier example. It shows how to generate two
698programs (@code{ctags} and @code{etags}) from the same source file
699(@file{etags.c}). The difficult part is that each compilation of
700@file{etags.c} requires different @code{cpp} flags.
701
702@example
703bin_PROGRAMS = etags ctags
704ctags_SOURCES =
705ctags_LDADD = ctags.o
706
707etags.o: etags.c
708 $(COMPILE) -DETAGS_REGEXPS -c etags.c
709
710ctags.o: etags.c
711 $(COMPILE) -DCTAGS -o ctags.o -c etags.c
712@end example
713
714Note that @code{ctags_SOURCES} is defined to be empty---that way no
715implicit value is substituted. The implicit value, however, is used to
716generate @code{etags} from @file{etags.o}.
717
718@code{ctags_LDADD} is used to get @file{ctags.o} into the link line.
719@code{ctags_DEPENDENCIES} is generated by Automake.
720
721The above rules won't work if your compiler doesn't accept both
722@samp{-c} and @samp{-o}. The simplest fix for this is to introduce a
723bogus dependency (to avoid problems with a parallel @code{make}):
724
725@example
726etags.o: etags.c ctags.o
727 $(COMPILE) -DETAGS_REGEXPS -c etags.c
728
729ctags.o: etags.c
730 $(COMPILE) -DCTAGS -c etags.c && mv etags.o ctags.o
731@end example
732
733Also, these explicit rules do not work if the de-ANSI-fication feature
734is used (@pxref{ANSI}). Supporting de-ANSI-fication requires a little
735more work:
736
737@example
738etags._o: etags._c ctags.o
739 $(COMPILE) -DETAGS_REGEXPS -c etags.c
740
741ctags._o: etags._c
742 $(COMPILE) -DCTAGS -c etags.c && mv etags._o ctags.o
743@end example
744
745
746@node Invoking Automake, configure, Examples, Top
747@chapter Creating a @file{Makefile.in}
748
749@cindex Multiple configure.in files
750@cindex Invoking Automake
751@cindex Automake, invoking
752
753To create all the @file{Makefile.in}s for a package, run the
754@code{automake} program in the top level directory, with no arguments.
755@code{automake} will automatically find each appropriate
756@file{Makefile.am} (by scanning @file{configure.in}; @pxref{configure})
757and generate the corresponding @file{Makefile.in}. Note that
758@code{automake} has a rather simplistic view of what constitutes a
759package; it assumes that a package has only one @file{configure.in}, at
760the top. If your package has multiple @file{configure.in}s, then you
761must run @code{automake} in each directory holding a
762@file{configure.in}.
763
764You can optionally give @code{automake} an argument; @file{.am} is
765appended to the argument and the result is used as the name of the input
766file. This feature is generally only used to automatically rebuild an
767out-of-date @file{Makefile.in}. Note that @code{automake} must always
768be run from the topmost directory of a project, even if being used to
769regenerate the @file{Makefile.in} in some subdirectory. This is
770necessary because @code{automake} must scan @file{configure.in}, and
771because @code{automake} uses the knowledge that a @file{Makefile.in} is
772in a subdirectory to change its behavior in some cases.
773
774@cindex Automake options
775@cindex Options, Automake
776
777@code{automake} accepts the following options:
778
779@cindex Extra files distributed with Automake
780@cindex Files distributed with Automake
781@cindex config.guess
782
783@table @samp
784@item -a
785@itemx --add-missing
786@opindex -a
787@opindex --add-missing
788Automake requires certain common files to exist in certain situations;
789for instance @file{config.guess} is required if @file{configure.in} runs
790@code{AC_CANONICAL_HOST}. Automake is distributed with several of these
791files; this option will cause the missing ones to be automatically added
792to the package, whenever possible. In general if Automake tells you a
793file is missing, try using this option. By default Automake tries to
794make a symbolic link pointing to its own copy of the missing file; this
795can be changed with @code{--copy}.
796
797@item --amdir=@var{dir}
798@opindex --amdir
799Look for Automake data files in directory @var{dir} instead of in the
800installation directory. This is typically used for debugging.
801
802@item --build-dir=@var{dir}
803@opindex --build-dir
804Tell Automake where the build directory is. This option is used when
805including dependencies into a @file{Makefile.in} generated by @code{make
806dist}; it should not be used otherwise.