As a developer it is often painful to continually update the Makefile.am whenever the include-file dependencies change in a project. Automake supplies a way to automatically track dependency changes (see Automatic Dependency Tracking).
Automake always uses complete dependencies for a compilation,
including system headers. Automake’s model is that dependency
computation should be a side effect of the build. To this end,
dependencies are computed by running all compilations through a
special wrapper program called depcomp
. depcomp
understands how to coax many different C and C++ compilers into
generating dependency information in the format it requires.
‘automake -a’ will install depcomp
into your source
tree for you. If depcomp
can’t figure out how to properly
invoke your compiler, dependency tracking will simply be disabled for
your build.
Experience with earlier versions of Automake (see Dependency Tracking Evolution in Brief History of Automake) taught us that it is not reliable to generate dependencies only on the maintainer’s system, as configurations vary too much. So instead Automake implements dependency tracking at build time.
This automatic dependency tracking can be suppressed by putting
no-dependencies in the variable AUTOMAKE_OPTIONS
, or
passing no-dependencies as an argument to AM_INIT_AUTOMAKE
(this should be the preferred way). Or, you can invoke automake
with the -i option. Dependency tracking is enabled by default.
The person building your package also can choose to disable dependency tracking by configuring with --disable-dependency-tracking.
If, as the package maintainer, you wish to conditionalize your
Makefile.am
according to whether dependency tracking is
enabled, the best way is to define your own conditional in
configure.ac
according to the shell variable
$enable_dependency_tracking
(all
--enable
/--disable
options are available as shell
variables; see Package Options in The Autoconf Manual):
AM_CONDITIONAL([NO_DEP_TRACKING], [test x"$enable_dependency_tracking" = x"no"])
And then in your Makefile.am
:
if NO_DEP_TRACKING # stuff to do when dependency tracking is disabled else # stuff to do when it's enabled endif