A given object file clearly depends on the source file which is compiled
to produce it. Here we are using depends in the sense of a typical
make utility; in other words, an object file depends on a source
file if changes to the source file require the object file to be
In addition to this basic dependency, a given object may depend on
additional source files as follows:
with's a unit X, the object file depends on the file containing the spec of unit X. This includes files that are
with'ed implicitly either because they are parents of
with'ed child units or they are run-time units required by the language constructs used in a particular unit.
Inlineapplies and inlining is activated with the -gnatn switch, the object file depends on the file containing the body of this subprogram as well as on the file containing the spec. Note that for inlining to actually occur as a result of the use of this switch, it is necessary to compile in optimizing mode.
The use of -gnatN activates a more extensive inlining optimization that is performed by the front end of the compiler. This inlining does not require that the code generation be optimized. Like -gnatn, the use of this switch generates additional dependencies. Note that -gnatN automatically implies -gnatn so it is not necessary to specify both options.
These rules are applied transitively: if unit
B, whose elaboration calls an inlined procedure in package
C, the object file for unit
A will depend on the body of
C, in file c.adb.
The set of dependent files described by these rules includes all the files on which the unit is semantically dependent, as described in the Ada 95 Language Reference Manual. However, it is a superset of what the ARM describes, because it includes generic, inline, and subunit dependencies.
An object file must be recreated by recompiling the corresponding source
file if any of the source files on which it depends are modified. For
example, if the
make utility is used to control compilation,
the rule for an Ada object file must mention all the source files on
which the object file depends, according to the above definition.
The determination of the necessary
recompilations is done automatically when one uses gnatmake.