Next: , Previous: , Up: GNU Automake   [Contents][Index]

16 Rebuilding Makefiles

Automake generates rules to automatically rebuild Makefiles, configure, and other derived files like

If you are using AM_MAINTAINER_MODE in, then these automatic rebuilding rules are only enabled in maintainer mode.

Sometimes it is convenient to supplement the rebuild rules for configure or config.status with additional dependencies. The variables CONFIGURE_DEPENDENCIES and CONFIG_STATUS_DEPENDENCIES can be used to list these extra dependencies. These variables should be defined in all Makefiles of the tree (because these two rebuild rules are output in all of them), so it is safer and easier to AC_SUBST them from For instance, the following statement will cause configure to be rerun each time is changed.


Note the ‘$(top_srcdir)/’ in the file name. Since this variable is to be used in all Makefiles, its value must be sensible at any level in the build hierarchy.


CONFIGURE_DEPENDENCIES adds dependencies to the configure rule, whose effect is to run autoconf. This variable should be seldom used, because automake already tracks m4_included files. However it can be useful when playing tricky games with m4_esyscmd or similar non-recommendable macros with side effects. Be also aware that interactions of this variable with the autom4te cache in The Autoconf Manual are quite problematic and can cause subtle breakage, so you might want to disable the cache if you want to use CONFIGURE_DEPENDENCIES.

CONFIG_STATUS_DEPENDENCIES adds dependencies to the config.status rule, whose effect is to run configure. This variable should therefore carry any non-standard source that may be read as a side effect of running configure, like in the example above.

Speaking of scripts, we recommend against them today. They are mainly used when the version of a package is updated automatically by a script (e.g., in daily builds). Here is what some old-style configure.acs may look like:

. $srcdir/

Here, is a shell fragment that sets VERSION_NUMBER. The problem with this example is that automake cannot track dependencies (listing in CONFIG_STATUS_DEPENDENCIES, and distributing this file is up to the user), and that it uses the obsolete form of AC_INIT and AM_INIT_AUTOMAKE. Upgrading to the new syntax is not straightforward, because shell variables are not allowed in AC_INIT’s arguments. We recommend that be replaced by an M4 file that is included by


Here version.m4 could contain something like ‘m4_define([VERSION_NUMBER], [1.2])’. The advantage of this second form is that automake will take care of the dependencies when defining the rebuild rule, and will also distribute the file automatically. An inconvenience is that autoconf will now be rerun each time the version number is bumped, when only configure had to be rerun in the previous setup.

GNU Make, at least, has an option --always-make which tells Make to consider that all targets are out of date. This interacts badly with Automake-generated Makefiles, which implement their own careful rules for when to regenerate Makefiles, as described above. The result is an endless loop, or other poor behavior. The only thing to do, as far as we know, is to refrain from using --always-make.

Next: Changing Automake’s Behavior, Previous: Support for test suites, Up: GNU Automake   [Contents][Index]