📄 automake.texi
字号:
@node Invoking Automake, configure, Examples, Top@chapter Creating a @file{Makefile.in}@cindex Multiple configure.in files@cindex Invoking Automake@cindex Automake, invokingTo create all the @file{Makefile.in}s for a package, run the@code{automake} program in the top level directory, with no arguments.@code{automake} will automatically find each appropriate@file{Makefile.am} (by scanning @file{configure.in}; @pxref{configure})and generate the corresponding @file{Makefile.in}. Note that@code{automake} has a rather simplistic view of what constitutes apackage; it assumes that a package has only one @file{configure.in}, atthe top. If your package has multiple @file{configure.in}s, then youmust run @code{automake} in each directory holding a@file{configure.in}.You can optionally give @code{automake} an argument; @file{.am} isappended to the argument and the result is used as the name of the inputfile. This feature is generally only used to automatically rebuild anout-of-date @file{Makefile.in}. Note that @code{automake} must alwaysbe run from the topmost directory of a project, even if being used toregenerate the @file{Makefile.in} in some subdirectory. This isnecessary because @code{automake} must scan @file{configure.in}, andbecause @code{automake} uses the knowledge that a @file{Makefile.in} isin a subdirectory to change its behavior in some cases.@cindex Automake options@cindex Options, Automake@code{automake} accepts the following options:@cindex Extra files distributed with Automake@cindex Files distributed with Automake@cindex config.guess@table @samp@item -a@itemx --add-missing@opindex -a@opindex --add-missingAutomake requires certain common files to exist in certain situations;for instance @file{config.guess} is required if @file{configure.in} runs@code{AC_CANONICAL_HOST}. Automake is distributed with several of thesefiles; this option will cause the missing ones to be automatically addedto the package, whenever possible. In general if Automake tells you afile is missing, try using this option. By default Automake tries tomake a symbolic link pointing to its own copy of the missing file; thiscan be changed with @code{--copy}.@item --amdir=@var{dir}@opindex --amdirLook for Automake data files in directory @var{dir} instead of in theinstallation directory. This is typically used for debugging.@item --build-dir=@var{dir}@opindex --build-dirTell Automake where the build directory is. This option is used whenincluding dependencies into a @file{Makefile.in} generated by @code{makedist}; it should not be used otherwise.@item -c@item --copyWhen used with @code{--add-missing}, causes installed files to becopied. The default is to make a symbolic link.@item --cygnus@opindex --cygnusCauses the generated @file{Makefile.in}s to follow Cygnus rules, insteadof GNU or Gnits rules. For more information, see @ref{Cygnus}.@item --foreign@opindex --foreignSet the global strictness to @samp{foreign}. For more information, see@ref{Strictness}.@item --gnits@opindex --gnitsSet the global strictness to @samp{gnits}. For more information, see@ref{Gnits}.@item --gnu@opindex --gnuSet the global strictness to @samp{gnu}. For more information, see@ref{Gnits}. This is the default strictness.@item --help@opindex --helpPrint a summary of the command line options and exit.@item -i@itemx --include-deps@opindex -i@opindex --include-depsInclude all automatically generated dependency information(@pxref{Dependencies}) in the generated@file{Makefile.in}. This is generally done when making a distribution;see @ref{Dist}.@item --generate-deps@opindex --generate-depsGenerate a file concatenating all automatically generated dependencyinformation (@pxref{Dependencies}) into one file, @file{.dep_segment}.This is generally done when making a distribution; see @ref{Dist}. Itis useful when maintaining a @file{SMakefile} or makefiles for otherplatforms (@file{Makefile.DOS}, etc.) It can only be used inconjunction with @samp{--include-deps}, @samp{--srcdir-name}, and@samp{--build-dir}. Note that if this option is given, no otherprocessing is done.@item --no-force@opindex --no-forceOrdinarily @code{automake} creates all @file{Makefile.in}s mentioned in@file{configure.in}. This option causes it to only update those@file{Makefile.in}s which are out of date with respect to one of theirdependents.@item -o @var{dir}@itemx --output-dir=@var{dir}@opindex -o@opindex --output-dirPut the generated @file{Makefile.in} in the directory @var{dir}.Ordinarily each @file{Makefile.in} is created in the directory of thecorresponding @file{Makefile.am}. This option is used when makingdistributions.@item --srcdir-name=@var{dir}@opindex --srcdir-nameTell Automake the name of the source directory associated with thecurrent build. This option is used when including dependencies into a@file{Makefile.in} generated by @code{make dist}; it should not be usedotherwise.@item -v@itemx --verbose@opindex -v@opindex --verboseCause Automake to print information about which files are being read orcreated.@item --version@opindex --versionPrint the version number of Automake and exit.@end table@node configure, Top level, Invoking Automake, Top@chapter Scanning @file{configure.in}@cindex configure.in, scanning@cindex Scanning configure.inAutomake scans the package's @file{configure.in} to determine certaininformation about the package. Some @code{autoconf} macros are requiredand some variables must be defined in @file{configure.in}. Automakewill also use information from @file{configure.in} to further tailor itsoutput.Automake also supplies some Autoconf macros to make the maintenanceeasier. These macros can automatically be put into your@file{aclocal.m4} using the @code{aclocal} program.@menu* Requirements:: Configuration requirements* Optional:: Other things Automake recognizes* Invoking aclocal:: Auto-generating aclocal.m4* Macros:: Autoconf macros supplied with Automake* Extending aclocal:: Writing your own aclocal macros@end menu@node Requirements, Optional, configure, configure@section Configuration requirements@cindex Automake requirements@cindex Requirements of AutomakeThe simplest way to meet the basic Automake requirements is to use themacro @code{AM_INIT_AUTOMAKE} (@pxref{Macros}). But if you prefer, youcan do the required steps by hand:@cvindex AM_INIT_AUTOMAKE@itemize @bullet@itemDefine the variables @code{PACKAGE} and @code{VERSION} with@code{AC_SUBST}.@cvindex PACKAGE@cvindex VERSION@code{PACKAGE} should be the name of the package as it appears whenbundled for distribution. For instance, Automake defines @code{PACKAGE}to be @samp{automake}. @code{VERSION} should be the version number ofthe release that is being developed. We recommend that you make@file{configure.in} the only place in your package where the versionnumber is defined; this makes releases simpler.Automake doesn't do any interpretation of @code{PACKAGE} or@code{VERSION}, except in @samp{Gnits} mode (@pxref{Gnits}).@itemUse the macro @code{AC_ARG_PROGRAM} if a program or script is installed.@xref{Transforming Names, , Transforming Program Names When Installing,autoconf, The Autoconf}.@cvindex AC_ARG_PROGRAM@itemUse @code{AC_PROG_MAKE_SET} if the package is not flat. @xref{Output, ,Creating Output Files, autoconf, The Autoconf Manual}.@cvindex AC_PROG_MAKE_SET@itemUse @code{AM_SANITY_CHECK} to make sure the build environment is sane.@itemCall @code{AC_PROG_INSTALL}(@pxref{Particular Programs, , Particular Program Checks, autoconf, TheAutoconf Manual}).@cvindex AC_PROG_INSTALL@itemUse @code{AM_MISSING_PROG} to see whether the programs @code{aclocal},@code{autoconf}, @code{automake}, @code{autoheader}, and @code{makeinfo}are in the build environment. Here is how this is done:@examplemissing_dir=`cd $ac_aux_dir && pwd`AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)@end example@end itemizeHere are the other macros which Automake requires but which are not runby @code{AM_INIT_AUTOMAKE}:@cindex AC_OUTPUT, scanning@table @code@item AC_OUTPUTAutomake uses this to determine which files to create (@pxref{Output, ,Creating Output Files, autoconf, The Autoconf Manual}). Listed filesnamed @code{Makefile} are treated as @file{Makefile}s. Other listedfiles are treated differently. Currently the only difference is that a@file{Makefile} is removed by @code{make distclean}, while other filesare removed by @code{make clean}.@c FIXME: this is in violation of standards!@cvindex AC_OUTPUT@end table@node Optional, Invoking aclocal, Requirements, configure@section Other things Automake recognizes@cindex Macros Automake recognizes@cindex Recognized macros by AutomakeAutomake will also recognize the use of certain macros and tailor thegenerated @file{Makefile.in} appropriately. Currently recognized macrosand their effects are:@table @code@item AC_CONFIG_HEADERAutomake requires the use of @code{AM_CONFIG_HEADER}, which is similarto @code{AC_CONFIG_HEADER} (@pxref{Configuration Headers, ,Configuration Header Files, autoconf, The Autoconf Manual}), but doessome useful Automake-specific work.@cvindex AC_CONFIG_HEADER@item AC_CONFIG_AUX_DIRAutomake will look for various helper scripts, such as@file{mkinstalldirs}, in the directory named in this macro invocation.If not seen, the scripts are looked for in their @samp{standard}locations (either the top source directory, or in the source directorycorresponding to the current @file{Makefile.am}, whichever isappropriate). @xref{Input, , Finding `configure' Input, autoconf, TheAutoconf Manual}.@cvindex AC_CONFIG_AUX_DIRFIXME: give complete list of things looked for in this directory@item AC_PATH_XTRAAutomake will insert definitions for the variables defined by@code{AC_PATH_XTRA} into each @file{Makefile.in} that builds a C programor library. @xref{System Services, , System Services, autoconf, TheAutoconf Manual}.@cvindex AC_PATH_XTRA@item AC_CANONICAL_HOST@itemx AC_CHECK_TOOLAutomake will ensure that @file{config.guess} and @file{config.sub}exist. Also, the @file{Makefile} variables @samp{host_alias} and@samp{host_triplet} are introduced. See both @ref{Canonicalizing, ,Getting the Canonical System Type, autoconf, The Autoconf Manual}, and@ref{Generic Programs, , Generic Program Checks, autoconf, The AutoconfManual}.@c fixme xref autoconf docs.@cvindex AC_CANONICAL_HOST@cvindex AC_CHECK_TOOL@vindex host_alias@vindex host_triplet@item AC_CANONICAL_SYSTEMThis is similar to @code{AC_CANONICAL_HOST}, but also defines the@file{Makefile} variables @samp{build_alias} and @samp{target_alias}.@xref{Canonicalizing, , Getting the Canonical System Type, autoconf, TheAutoconf Manual}.@cvindex AC_CANONICAL_SYSTEM@vindex build_alias@vindex target_alias@item AC_FUNC_ALLOCA@itemx AC_FUNC_GETLOADAVG@itemx AC_FUNC_MEMCMP@itemx AC_STRUCT_ST_BLOCKS@itemx AC_FUNC_FNMATCH@itemx AM_FUNC_STRTOD@itemx AC_REPLACE_FUNCS@itemx AC_REPLACE_GNU_GETOPT@itemx AM_WITH_REGEXAutomake will ensure that the appropriate dependencies are generated forthe objects corresponding to these macros. Also, Automake will verifythat the appropriate source files are part of the distribution. Notethat Automake does not come with any of the C sources required to usethese macros, so @code{automake -a} will not install the sources.@xref{A Library}, for more information. Also, see @ref{ParticularFunctions, , Particular Function Checks, autoconf, The Autoconf Manual}.@cvindex AC_FUNC_ALLOCA@cvindex AC_FUNC_GETLOADAVG@cvindex AC_FUNC_MEMCMP@cvindex AC_STRUCT_ST_BLOCKS@cvindex AC_FUNC_FNMATCH@cvindex AC_FUNC_FNMATCH@cvindex AC_REPLACE_FUNCS@cvindex AC_REPLACE_GNU_GETOPT@cvindex AM_FUNC_STRTOD@cvindex AM_WITH_REGEX@item LIBOBJSAutomake will detect statements which put @file{.o} files into@code{LIBOBJS}, and will treat these additional files as if they werediscovered via @code{AC_REPLACE_FUNCS}. @xref{Generic Functions, ,Generic Function Checks, autoconf, The Autoconf Manual}.@cvindex LIBOBJS@item AC_PROG_RANLIBThis is required if any libraries are built in the package.@xref{Particular Programs, , Particular Program Checks, autoconf, TheAutoconf Manual}.@cvindex AC_PROG_RANLIB@item AC_PROG_CXXThis is required if any C++ source is included. @xref{ParticularPrograms, , Particular Program Checks, autoconf, The Autoconf Manual}.@cvindex AC_PROG_CXX@item AC_PROG_F77This is required if any Fortran 77 source is included. This macro isdistributed with Autoconf version 2.13 and later. @xref{ParticularPrograms, , Particular Program Checks, autoconf, The Autoconf Manual}.@cvindex AC_PROG_F77@item AC_F77_LIBRARY_LDFLAGSThis is required for programs and shared libraries that are a mixture oflanguages that include Fortran 77 (@pxref{Mixing Fortran 77 With C andC++}). @xref{Macros, , Autoconf macros supplied with Automake}.@cvindex AC_F77_LIBRARY_LDFLAGS@item AM_PROG_LIBTOOLAutomake will turn on processing for @code{libtool} (@pxref{Top, ,Introduction, libtool, The Libtool Manual}).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -