Previous: , Up: Building Programs and Libraries   [Contents][Index]


7.11 Automatic dependency tracking

As a developer it is often painful to continually update the Makefile.in whenever the include-file dependencies change in a project. Automake supplies a way to automatically track dependency changes, and distribute the dependencies in the generated Makefile.in.

Currently this support requires the use of GNU make and gcc. It might become possible in the future to supply a different dependency generating program, if there is enough demand. In the meantime, this mode is enabled by default if any C program or library is defined in the current directory, so you may get a ‘Must be a separator’ error from non-GNU make.

When you decide to make a distribution, the dist target will re-run automake with ‘--include-deps’ and other options. See Creating a Makefile.in, and Changing Automake’s Behavior. This will cause the previously generated dependencies to be inserted into the generated Makefile.in, and thus into the distribution. This step also turns off inclusion of the dependency generation code, so that those who download your distribution but don’t use GNU make and gcc will not get errors.

When added to the Makefile.in, the dependencies have all system-specific dependencies automatically removed. This can be done by listing the files in ‘OMIT_DEPENDENCIES’. For instance all references to system header files are removed by Automake. Sometimes it is useful to specify that a certain header file should be removed. For instance if your configure.in uses ‘AM_WITH_REGEX’, then any dependency on rx.h or regex.h should be removed, because the correct one cannot be known until the user configures the package.

As it turns out, Automake is actually smart enough to handle the particular case of the regular expression header. It will also automatically omit libintl.h if ‘AM_GNU_GETTEXT’ is used.

Automatic dependency tracking can be suppressed by putting no-dependencies in the variable AUTOMAKE_OPTIONS.

If you unpack a distribution made by make dist, and you want to turn on the dependency-tracking code again, simply re-run automake.

The actual dependency files are put under the build directory, in a subdirectory named .deps. These dependencies are machine specific. It is safe to delete them if you like; they will be automatically recreated during the next build.


Previous: Automatic de-ANSI-fication, Up: Building Programs and Libraries   [Contents][Index]