| 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
|
|---|
| 21 | This file documents GNU automake @value{VERSION}
|
|---|
| 22 |
|
|---|
| 23 | Copyright (C) 1995, 96, 97, 98 Free Software Foundation, Inc.
|
|---|
| 24 |
|
|---|
| 25 | Permission is granted to make and distribute verbatim copies of
|
|---|
| 26 | this manual provided the copyright notice and this permission notice
|
|---|
| 27 | are preserved on all copies.
|
|---|
| 28 |
|
|---|
| 29 | @ignore
|
|---|
| 30 | Permission is granted to process this file through TeX and print the
|
|---|
| 31 | results, provided the printed document carries copying permission
|
|---|
| 32 | notice identical to this one except for the removal of this paragraph
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | @end ignore
|
|---|
| 36 | Permission is granted to copy and distribute modified versions of this
|
|---|
| 37 | manual under the conditions for verbatim copying, provided that the entire
|
|---|
| 38 | resulting derived work is distributed under the terms of a permission
|
|---|
| 39 | notice identical to this one.
|
|---|
| 40 |
|
|---|
| 41 | Permission is granted to copy and distribute translations of this manual
|
|---|
| 42 | into another language, under the above conditions for modified versions,
|
|---|
| 43 | except that this permission notice may be stated in a translation approved
|
|---|
| 44 | by 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
|
|---|
| 55 | Copyright @copyright{} 1995, 96 Free Software Foundation, Inc.
|
|---|
| 56 | @sp 2
|
|---|
| 57 | This is the first edition of the GNU Automake documentation,@*
|
|---|
| 58 | and is consistent with GNU Automake @value{VERSION}.@*
|
|---|
| 59 | @sp 2
|
|---|
| 60 | Published by the Free Software Foundation @*
|
|---|
| 61 | 59 Temple Place - Suite 330, @*
|
|---|
| 62 | Boston, MA 02111-1307 USA @*
|
|---|
| 63 |
|
|---|
| 64 | Permission is granted to make and distribute verbatim copies of
|
|---|
| 65 | this manual provided the copyright notice and this permission notice
|
|---|
| 66 | are preserved on all copies.
|
|---|
| 67 |
|
|---|
| 68 | Permission is granted to copy and distribute modified versions of this
|
|---|
| 69 | manual under the conditions for verbatim copying, provided that the entire
|
|---|
| 70 | resulting derived work is distributed under the terms of a permission
|
|---|
| 71 | notice identical to this one.
|
|---|
| 72 |
|
|---|
| 73 | Permission is granted to copy and distribute translations of this manual
|
|---|
| 74 | into another language, under the above conditions for modified versions,
|
|---|
| 75 | except that this permission notice may be stated in a translation
|
|---|
| 76 | approved 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 |
|
|---|
| 106 | This file documents the GNU Automake package for creating GNU
|
|---|
| 107 | Standards-compliant Makefiles from template files. This edition
|
|---|
| 108 | documents 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 |
|
|---|
| 144 | Automake is a tool for automatically generating @file{Makefile.in}s from
|
|---|
| 145 | files called @file{Makefile.am}. Each @file{Makefile.am} is basically a
|
|---|
| 146 | series of @code{make} macro definitions (with rules being thrown in
|
|---|
| 147 | occasionally). The generated @file{Makefile.in}s are compliant with the
|
|---|
| 148 | GNU Makefile standards.
|
|---|
| 149 |
|
|---|
| 150 | @cindex GNU Makefile standards
|
|---|
| 151 |
|
|---|
| 152 | The GNU Makefile Standards Document
|
|---|
| 153 | (@pxref{Makefile Conventions, , , standards, The GNU Coding Standards})
|
|---|
| 154 | is long, complicated, and subject to change. The goal of Automake is to
|
|---|
| 155 | remove the burden of Makefile maintenance from the back of the
|
|---|
| 156 | individual GNU maintainer (and put it on the back of the Automake
|
|---|
| 157 | maintainer).
|
|---|
| 158 |
|
|---|
| 159 | The typical Automake input file is simply a series of macro definitions.
|
|---|
| 160 | Each such file is processed to create a @file{Makefile.in}. There
|
|---|
| 161 | should generally be one @file{Makefile.am} per directory of a project.
|
|---|
| 162 |
|
|---|
| 163 | @cindex Constraints of Automake
|
|---|
| 164 | @cindex Automake constraints
|
|---|
| 165 |
|
|---|
| 166 | Automake does constrain a project in certain ways; for instance it
|
|---|
| 167 | assumes that the project uses Autoconf (@pxref{Top, , Introduction,
|
|---|
| 168 | autoconf, The Autoconf Manual}), and enforces certain restrictions on
|
|---|
| 169 | the @file{configure.in} contents.
|
|---|
| 170 |
|
|---|
| 171 | @cindex Automake requirements
|
|---|
| 172 | @cindex Requirements, Automake
|
|---|
| 173 |
|
|---|
| 174 | Automake requires @code{perl} in order to generate the
|
|---|
| 175 | @file{Makefile.in}s. However, the distributions created by Automake are
|
|---|
| 176 | fully GNU standards-compliant, and do not require @code{perl} in order
|
|---|
| 177 | to be built.
|
|---|
| 178 |
|
|---|
| 179 | @cindex BUGS, reporting
|
|---|
| 180 | @cindex Reporting BUGS
|
|---|
| 181 | @cindex E-mail, bug reports
|
|---|
| 182 |
|
|---|
| 183 | Mail 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 |
|
|---|
| 190 | The following sections cover a few basic ideas that will help you
|
|---|
| 191 | understand 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 |
|
|---|
| 205 | Automake 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;
|
|---|
| 208 | for instance, a @samp{bin_PROGRAMS} macro definition will cause targets
|
|---|
| 209 | for 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 |
|
|---|
| 215 | The macro definitions and targets in the @file{Makefile.am} are copied
|
|---|
| 216 | verbatim into the generated file. This allows you to add arbitrary code
|
|---|
| 217 | into the generated @file{Makefile.in}. For instance the Automake
|
|---|
| 218 | distribution includes a non-standard @code{cvs-dist} target, which the
|
|---|
| 219 | Automake maintainer uses to make distributions from his source control
|
|---|
| 220 | system.
|
|---|
| 221 |
|
|---|
| 222 | @cindex GNU make extensions
|
|---|
| 223 |
|
|---|
| 224 | Note that GNU make extensions are not recognized by Automake. Using
|
|---|
| 225 | such extensions in a @file{Makefile.am} will lead to errors or confusing
|
|---|
| 226 | behavior.
|
|---|
| 227 |
|
|---|
| 228 | Automake tries to group comments with adjoining targets and macro
|
|---|
| 229 | definitions in an intelligent way.
|
|---|
| 230 |
|
|---|
| 231 | @cindex Make targets, overriding
|
|---|
| 232 | @cindex Overriding make targets
|
|---|
| 233 |
|
|---|
| 234 | A target defined in @file{Makefile.am} generally overrides any such
|
|---|
| 235 | target of a similar name that would be automatically generated by
|
|---|
| 236 | @code{automake}. Although this is a supported feature, it is generally
|
|---|
| 237 | best to avoid making use of it, as sometimes the generated rules are
|
|---|
| 238 | very particular.
|
|---|
| 239 |
|
|---|
| 240 | @cindex Macros, overriding
|
|---|
| 241 | @cindex Overriding make macros
|
|---|
| 242 |
|
|---|
| 243 | Similarly, a macro defined in @file{Makefile.am} will override any
|
|---|
| 244 | definition of the macro that @code{automake} would ordinarily create.
|
|---|
| 245 | This feature is more often useful than the ability to override a target
|
|---|
| 246 | definition. Be warned that many of the macros generated by
|
|---|
| 247 | @code{automake} are considered to be for internal use only, and their
|
|---|
| 248 | names might change in future releases.
|
|---|
| 249 |
|
|---|
| 250 | @cindex Recursive operation of Automake
|
|---|
| 251 | @cindex Automake, recursive operation
|
|---|
| 252 | @cindex Example of recursive operation
|
|---|
| 253 |
|
|---|
| 254 | When examining a macro definition, Automake will recursively examine
|
|---|
| 255 | macros referenced in the definition. For example, if Automake is
|
|---|
| 256 | looking at the content of @code{foo_SOURCES} in this snippet
|
|---|
| 257 |
|
|---|
| 258 | @example
|
|---|
| 259 | xs = a.c b.c
|
|---|
| 260 | foo_SOURCES = c.c $(xs)
|
|---|
| 261 | @end example
|
|---|
| 262 |
|
|---|
| 263 | it would use the files @file{a.c}, @file{b.c}, and @file{c.c} as the
|
|---|
| 264 | contents of @code{foo_SOURCES}.
|
|---|
| 265 |
|
|---|
| 266 | @cindex ## (special Automake comment)
|
|---|
| 267 | @cindex Special Automake comment
|
|---|
| 268 | @cindex Comment, special to Automake
|
|---|
| 269 |
|
|---|
| 270 | Automake also allows a form of comment which is @emph{not} copied into
|
|---|
| 271 | the output; all lines beginning with @samp{##} are completely ignored by
|
|---|
| 272 | Automake.
|
|---|
| 273 |
|
|---|
| 274 | It 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 |
|
|---|
| 302 | A @dfn{flat} package is one in which all the files are in a single
|
|---|
| 303 | directory. The @file{Makefile.am} for such a package by definition
|
|---|
| 304 | lacks a @code{SUBDIRS} macro. An example of such a package is
|
|---|
| 305 | @code{termutils}.
|
|---|
| 306 | @vindex SUBDIRS
|
|---|
| 307 |
|
|---|
| 308 | @cindex SUBDIRS, deep package
|
|---|
| 309 |
|
|---|
| 310 | A @dfn{deep} package is one in which all the source lies in
|
|---|
| 311 | subdirectories; the top level directory contains mainly configuration
|
|---|
| 312 | information. GNU @code{cpio} is a good example of such a package, as is
|
|---|
| 313 | GNU @code{tar}. The top level @file{Makefile.am} for a deep package
|
|---|
| 314 | will contain a @code{SUBDIRS} macro, but no other macros to define
|
|---|
| 315 | objects which are built.
|
|---|
| 316 |
|
|---|
| 317 | A @dfn{shallow} package is one in which the primary source resides in
|
|---|
| 318 | the top-level directory, while various parts (typically libraries)
|
|---|
| 319 | reside 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 |
|
|---|
| 328 | While Automake is intended to be used by maintainers of GNU packages, it
|
|---|
| 329 | does make some effort to accommodate those who wish to use it, but do
|
|---|
| 330 | not 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 |
|
|---|
| 340 | To this end, Automake supports three levels of @dfn{strictness}---the
|
|---|
| 341 | strictness indicating how stringently Automake should check standards
|
|---|
| 342 | conformance.
|
|---|
| 343 |
|
|---|
| 344 | The valid strictness levels are:
|
|---|
| 345 |
|
|---|
| 346 | @table @samp
|
|---|
| 347 | @item foreign
|
|---|
| 348 | Automake will check for only those things which are absolutely
|
|---|
| 349 | required for proper operations. For instance, whereas GNU standards
|
|---|
| 350 | dictate the existence of a @file{NEWS} file, it will not be required in
|
|---|
| 351 | this mode. The name comes from the fact that Automake is intended to be
|
|---|
| 352 | used for GNU programs; these relaxed rules are not the standard mode of
|
|---|
| 353 | operation.
|
|---|
| 354 |
|
|---|
| 355 | @item gnu
|
|---|
| 356 | Automake will check---as much as possible---for compliance to the GNU
|
|---|
| 357 | standards for packages. This is the default.
|
|---|
| 358 |
|
|---|
| 359 | @item gnits
|
|---|
| 360 | Automake will check for compliance to the as-yet-unwritten @dfn{Gnits
|
|---|
| 361 | standards}. These are based on the GNU standards, but are even more
|
|---|
| 362 | detailed. Unless you are a Gnits standards contributor, it is
|
|---|
| 363 | recommended that you avoid this option until such time as the Gnits
|
|---|
| 364 | standard is actually published.
|
|---|
| 365 | @end table
|
|---|
| 366 |
|
|---|
| 367 | For more information on the precise implications of the strictness
|
|---|
| 368 | level, see @ref{Gnits}.
|
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 | @node Uniform, Canonicalization, Strictness, Generalities
|
|---|
| 372 | @section The Uniform Naming Scheme
|
|---|
| 373 |
|
|---|
| 374 | @cindex Uniform naming scheme
|
|---|
| 375 |
|
|---|
| 376 | Automake macros (from here on referred to as @emph{variables}) generally
|
|---|
| 377 | follow a @dfn{uniform naming scheme} that makes it easy to decide how
|
|---|
| 378 | programs (and other derived objects) are built, and how they are
|
|---|
| 379 | installed. This scheme also supports @code{configure} time
|
|---|
| 380 | determination 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 |
|
|---|
| 388 | At @code{make} time, certain variables are used to determine which
|
|---|
| 389 | objects are to be built. These variables are called @dfn{primary
|
|---|
| 390 | variables}. For instance, the primary variable @code{PROGRAMS} holds a
|
|---|
| 391 | list of programs which are to be compiled and linked.
|
|---|
| 392 | @vindex PROGRAMS
|
|---|
|
|---|