<HTML>
<HEAD>
<TITLE>automake</TITLE>
</HEAD>
<BODY>
<H1>GNU Automake</H1>
<H2>For version 1.3, 3 April 1998</H2>
<ADDRESS>David MacKenzie and Tom Tromey</ADDRESS>
<P>
<P><HR><P>
<H1>目录</H1>
<UL>
<LI><A NAME="TOC1" HREF="automake.html#SEC1">介绍</A>
<LI><A NAME="TOC2" HREF="automake.html#SEC2">通用性概念</A>
<UL>
<LI><A NAME="TOC3" HREF="automake.html#SEC3">通用操作</A>
<LI><A NAME="TOC4" HREF="automake.html#SEC4">深度</A>
<LI><A NAME="TOC5" HREF="automake.html#SEC5">严格性</A>
<LI><A NAME="TOC6" HREF="automake.html#SEC6">统一命名机制</A>
<LI><A NAME="TOC7" HREF="automake.html#SEC7">派生变量是如何命名的</A>
</UL>
<LI><A NAME="TOC8" HREF="automake.html#SEC8">一些实例软件包</A>
<UL>
<LI><A NAME="TOC9" HREF="automake.html#SEC9">一个简单的例子,从起点到终点</A>
<LI><A NAME="TOC10" HREF="automake.html#SEC10">一个经典的程序</A>
<LI><A NAME="TOC11" HREF="automake.html#SEC11">创建etags和ctags</A>
</UL>
<LI><A NAME="TOC12" HREF="automake.html#SEC12">创建<TT>`Makefile.in'</TT></A>
<LI><A NAME="TOC13" HREF="automake.html#SEC13">扫描<TT>`configure.in'</TT></A>
<UL>
<LI><A NAME="TOC14" HREF="automake.html#SEC14">配置需求</A>
<LI><A NAME="TOC15" HREF="automake.html#SEC15">Automake能够识别的其它事情</A>
<LI><A NAME="TOC16" HREF="automake.html#SEC16">自动生成的aclocal.m4</A>
<LI><A NAME="TOC17" HREF="automake.html#SEC17">由Automake支持的Autoconf宏</A>
<LI><A NAME="TOC18" HREF="automake.html#SEC18">编写你自己的aclocal宏</A>
</UL>
<LI><A NAME="TOC19" HREF="automake.html#SEC19">顶层<TT>`Makefile.am'</TT></A>
<LI><A NAME="TOC20" HREF="automake.html#SEC20">创建程序和库</A>
<UL>
<LI><A NAME="TOC21" HREF="automake.html#SEC21">创建一个程序</A>
<LI><A NAME="TOC22" HREF="automake.html#SEC22">创建一个库</A>
<LI><A NAME="TOC23" HREF="automake.html#SEC23">对LIBOBJS和ALLOCA的特别处理</A>
<LI><A NAME="TOC24" HREF="automake.html#SEC24">创建一个共享库</A>
<LI><A NAME="TOC25" HREF="automake.html#SEC25">创建一个程序时使用的变量</A>
<LI><A NAME="TOC26" HREF="automake.html#SEC26">对Yacc和Lex的支持</A>
<LI><A NAME="TOC27" HREF="automake.html#SEC27">C++和其它语言</A>
<LI><A NAME="TOC28" HREF="automake.html#SEC28">自动de-ANSI-fication</A>
<LI><A NAME="TOC29" HREF="automake.html#SEC29">自动的依赖性(dependency)跟踪</A>
</UL>
<LI><A NAME="TOC30" HREF="automake.html#SEC30">其它派生对象</A>
<UL>
<LI><A NAME="TOC31" HREF="automake.html#SEC31">可执行的脚本</A>
<LI><A NAME="TOC32" HREF="automake.html#SEC32">头文件</A>
<LI><A NAME="TOC33" HREF="automake.html#SEC33">与体系结构无关(Architecture-independent)的数据文件</A>
<LI><A NAME="TOC34" HREF="automake.html#SEC34">已创建的源代码</A>
</UL>
<LI><A NAME="TOC35" HREF="automake.html#SEC35">其它GNU工具</A>
<UL>
<LI><A NAME="TOC36" HREF="automake.html#SEC36">Emacs Lisp</A>
<LI><A NAME="TOC37" HREF="automake.html#SEC37">Gettext</A>
<LI><A NAME="TOC38" HREF="automake.html#SEC38">Guile</A>
<LI><A NAME="TOC39" HREF="automake.html#SEC39">Libtool</A>
<LI><A NAME="TOC40" HREF="automake.html#SEC40">Java</A>
</UL>
<LI><A NAME="TOC41" HREF="automake.html#SEC41">创建文档</A>
<UL>
<LI><A NAME="TOC42" HREF="automake.html#SEC42">Texinfo</A>
<LI><A NAME="TOC43" HREF="automake.html#SEC43">Man手册</A>
</UL>
<LI><A NAME="TOC44" HREF="automake.html#SEC44">安装了些什么</A>
<LI><A NAME="TOC45" HREF="automake.html#SEC45">清除了些什么</A>
<LI><A NAME="TOC46" HREF="automake.html#SEC46">需要发布哪些文件</A>
<LI><A NAME="TOC47" HREF="automake.html#SEC47">对测试套件(test suites)的支持</A>
<LI><A NAME="TOC48" HREF="automake.html#SEC48">改变Automake的行为</A>
<LI><A NAME="TOC49" HREF="automake.html#SEC49">其它规则</A>
<UL>
<LI><A NAME="TOC50" HREF="automake.html#SEC50">与<CODE>etags</CODE>之间的界面</A>
<LI><A NAME="TOC51" HREF="automake.html#SEC51">处理新的文件扩展名</A>
</UL>
<LI><A NAME="TOC52" HREF="automake.html#SEC52">条件(Conditionals)</A>
<LI><A NAME="TOC53" HREF="automake.html#SEC53"><CODE>--gnu</CODE> and <CODE>--gnits</CODE>的效果</A>
<LI><A NAME="TOC54" HREF="automake.html#SEC54"><CODE>--cygnus</CODE>的效果</A>
<LI><A NAME="TOC55" HREF="automake.html#SEC55">什么时候Automake不够用</A>
<LI><A NAME="TOC56" HREF="automake.html#SEC56">发布<TT>`Makefile.in'</TT></A>
<LI><A NAME="TOC57" HREF="automake.html#SEC57">未来的某些想法</A>
<LI><A NAME="TOC58" HREF="automake.html#SEC58">索引</A>
</UL>
<P><HR><P>
<P>
@dircategory GNU admin
@direntry
* automake: (automake). Making Makefile.in's
</P>
<P>
@dircategory Individual utilities
@direntry
* aclocal: (automake)Invoking aclocal. Generating aclocal.m4
</P>
<P>
Copyright (C) 1995, 96 Free Software Foundation, Inc.
<P>
这是GNU Automake文档的第一版,<BR>
并且是针对GNU Automake 1.3的。<BR>
<P>
自由软件基金会出版 <BR>
59 Temple Place - Suite 330, <BR>
Boston, MA 02111-1307 USA <BR>
</P>
<P>
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
</P>
<P>
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
</P>
<P>
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the Free Software Foundation.
</p>
<p>
只要版权声明和本许可声明保留在所有副本中,您就被授权制作和发行本手册的
原文副本。
</p>
<p>
只要整个最终派生工作按照与本手册相同的许可声明发行,您就被授权按照与
发行原文相同的条件复制和发行本手册的修改版本。
</p>
<p>
除了本许可声明应该使用由基金会批准的译文之外,您被授权按照与上述修改
版本相同的条件复制和发行本手册的其它语言的译文。
</P>
<HR>
<P>本文档由王立翻译。 1999.12.17</P>
<P>译者在此声明:不对任何由译文错误或者对译文的误解承担任何责任。</P>
<HR>
<H1><A NAME="SEC1" HREF="automake.html#TOC1">介绍</A></H1>
<P>
Automake是一个从文件<TT>`Makefile.am'</TT>自动生成<TT>`Makefile.in'</TT>
的工具。每个<TT>`Makefile.am'</TT>基本上是一系列<CODE>make</CODE>的宏定义
(make规则也会偶尔出现)。生成的<TT>`Makefile.in'</TT>s服从GNU Makefile标准。
</P>
<P>
GNU Makefile标准文档(参见<CITE>GNU编码标准</CITE>中的‘Makefile惯例’节)
长、复杂,而且会发生改变。Automake的目的就是解除个人GNU维护者维护Makefile的负担
(并且让Automake的维护者来承担这个负担)。
</P>
<P>
典型的Automake输入文件是一系列简单的宏定义。处理所有这样的文件以创建
<TT>`Makefile.in'</TT>。在一个项目(project)的每个目录中通常包含一个
<TT>`Makefile.am'</TT>。
</P>
<P>
Automake在几个方面对一个项目做了限制;例如它假定项目使用Autoconf
(参见<CITE>Autoconf手册</CITE>),并且对<TT>`configure.in'</TT>的内容施加了某些限制。
</P>
<P>
为生成<TT>`Makefile.in'</TT>,Automake需要<CODE>perl</CODE>。
但是由Automake创建的发布完全服从GNU标准,并且在创建中不需要<CODE>perl</CODE>。
</P>
<P>
请把关于Automake的建议和bug发送到
<A HREF="mailto:automake-bugs@gnu.org">automake-bugs@gnu.org</A>。
</P>
<H1><A NAME="SEC2" HREF="automake.html#TOC2">通用性概念</A></H1>
<P>
一些基本概念将有助于理解Automake是如何工作的。
</P>
<H2><A NAME="SEC3" HREF="automake.html#TOC3">通用操作</A></H2>
<P>
Automake读入<TT>`Makefile.am'</TT>并且生成<TT>`Makefile.in'</TT>。
在<TT>`Makefile.am'</TT>中定义的一些宏和目标(targets)指挥automake生成
更多特定的代码;例如一个<SAMP>`bin_PROGRAMS'</SAMP>宏定义将生成一个需要
被编译、连接的目标。
</P>
<P>
<TT>`Makefile.am'</TT>中的宏定义和目标被复制到生成的文件中。这使得你可以把
任何代码添加到生成的<TT>`Makefile.in'</TT>文件中。例如,Automake的发布
包含了非标准的<CODE>cvs-dist</CODE>目标,Automake的维护者用它从他的版本
控制系统中创建发布版本。
</P>
<P>
Automake不能识别GNU对make的扩展。在<TT>`Makefile.am'</TT>中使用这些
扩展将导致错误或者令人不解的行为。
</P>
<P>
Automake试图明智地把注释和相邻的目标(或者变量定义)关联起来。
</P>
<P>
在<TT>`Makefile.am'</TT>中定义的目标通常覆盖了所有由<CODE>automake</CODE>
自动生成的拥有相似名字的目标。虽然Automake提供了这一功能,但最好避免使用它,
�