0%

Linux Automake 5 创建`Makefile.in`

GNU Automake 版本(version 1.16.1, 26 February 2018)

Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, with no Front-Cover texts,
and with no Back-Cover Texts. A copy of the license is included in
the section entitled “GNU Free Documentation License.”

5 创建一个 Makefile.in


为了创建一个包的Makefile.in,只需要在顶层目录执行命令 automake即可。 automake 会通过扫描文件configure.ac来找到每一个 Makefile.am 并生成相应的Makefile.in

此处留意: automake 假定一个包只有一个configure.ac,所以如果你的包包含多个configure.ac就需要在每个包含的目录执行 automake ,或者使用Autoconf的命令autoreconf,这个命令可以自动遍历所有的目录。

另外还需要留意 automake 必须在顶层目录执行,顶层目录需要包含文件 configure.ac

Automake通过运行autoconf来扫描文件 configure.ac及它的依赖,因此autoconf 必须在你的环境变量里面,如果有另外一个 AUTOCONF 环境变量,那么就会 替代默认的 autoconf,这在使用另外一个版本的时候比较有用。

注:automake 只是通过 autoconf 来扫描configure.ac,并不会构建 configure ,所以还需要使用autoconf来构建。

automake 接收下面的参数:

-a
--add-missing
​ Automake requires certain common files to exist in certain
​ situations; for instance, config.guess is required if
configure.ac invokes AC_CANONICAL_HOST. Automake is
​ distributed with several of these files (; this option will cause the missing ones to be
​ automatically added to the package, whenever possible. In general
​ if Automake tells you a file is missing, try using this option. By
​ default Automake tries to make a symbolic link pointing to its own
​ copy of the missing file; this can be changed with --copy.

 Many of the potentially-missing files are common scripts whose
 location may be specified via the `AC_CONFIG_AUX_DIR` macro.
 Therefore, `AC_CONFIG_AUX_DIR``s setting affects whether a file is
 considered missing, and where the missing file is added (.

 In some strictness modes, additional files are installed, x

--libdir=DIR
​ Look for Automake data files in directory DIR instead of in the
​ installation directory. This is typically used for debugging.

 The environment variable `AUTOMAKE_LIBDIR` provides another way to
 set the directory containing Automake data files.  However
 `--libdir` takes precedence over it.

--print-libdir
​ Print the path of the installation directory containing
​ Automake-provided scripts and data files (like e.g., texinfo.texi
​ and install-sh).

-c
--copy
​ 使用 --add-missing的时候默认会生成一个符号链接,这个选项会拷贝文件。

-f
--force-missing
​ When used with --add-missing, causes standard files to be
​ reinstalled even if they already exist in the source tree. This
​ involves removing the file from the source tree before creating the
​ new symlink (or, with --copy, copying the new file).

--foreign
​ 设定级别为 foreign.

--gnits
​ 设定级别为 gnits.

--gnu
​ 设定级别为 gnu.

--help
​ 打印一系列命令行选项并退出

-i
--ignore-deps
​ This disables the dependency tracking feature in generated
Makefiles; see

--include-deps
​ This enables the dependency tracking feature. This feature is
​ enabled by default. This option is provided for historical reasons
​ only and probably should not be used.

--no-force
​ Ordinarily automake creates all Makefile.ins mentioned in
configure.ac. This option causes it to only update those
Makefile.ins that are out of date with respect to one of their
​ dependents.

-o DIR
--output-dir=DIR
​ Put the generated Makefile.in in the directory DIR. Ordinarily
​ each Makefile.in is created in the directory of the corresponding
Makefile.am. This option is deprecated and will be removed in a
​ future release.

-v
--verbose
​ Cause Automake to print information about which files are being
​ read or created.

--version
​ 打印版本号并退出

-W CATEGORY
--warnings=CATEGORY
​ Output warnings falling in CATEGORY. CATEGORY can be one of:
gnu
​ warnings related to the GNU Coding Standards (
obsolete
​ obsolete features or constructions
override
​ user redefinitions of Automake rules or variables
portability
​ portability issues (e.g., use of make features that are
​ known to be not portable)
extra-portability
​ extra portability issues related to obscure tools. One
​ example of such a tool is the Microsoft lib archiver.
syntax
​ weird syntax, unused variables, typos
unsupported
​ unsupported or incomplete features
all
​ all the warnings
none
​ turn off all the warnings
error
​ treat warnings as errors

 A category can be turned off by prefixing its name with `no-`.  For
 instance, `-Wno-syntax` will hide the warnings about unused
 variables.

 The categorie output by default are `obsolete`, `syntax` and
 `unsupported`.  Additionally, `gnu` and `portability` are enabled
 in `--gnu` and `--gnits` strictness.

 Turning off `portability` will also turn off `extra-portability`,
 and similarly turning on `extra-portability` will also turn on
 `portability`.  However, turning on `portability` or turning off
 `extra-portability` will not affect the other category.

 The environment variable `WARNINGS` can contain a comma separated
 list of categorie to enable.  It will be taken into account before
 the command-line switches, this way `-Wnone` will also ignore any
 warning category enabled by `WARNINGS`.  This variable is also used
 by other tools like `autoconf`; unknown categorie are ignored for
 this reason.

If the environment variable AUTOMAKE_JOBS contains a positive
number, it is taken as the maximum number of Perl threads to use in
automake for generating multiple Makefile.in files concurrently.
This is an experimental feature.

处无为之事,行不言之教;作而弗始,生而弗有,为而弗恃,功成不居!

欢迎关注我的其它发布渠道