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

Last change on this file 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