Next: The Ada Library Information Files, Previous: Generating Object Files, Up: The GNAT Compilation Model
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 recompiled. In addition to this basic dependency, a given object may depend on additional source files as follows:
The use of `-gnatN' activates 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.
When using a gcc-based back end (in practice this means using any version of GNAT other than for the JVM, .NET or GNAAMP platforms), then the use of `-gnatN' is deprecated, and the use of `-gnatn' is preferred. Historically front end inlining was more extensive than the gcc back end inlining, but that is no longer the case.
O
depends on the proper body of a subunit through
inlining or instantiation, it depends on the parent unit of the subunit.
This means that any modification of the parent unit or one of its subunits
affects the compilation of O
.
These rules are applied transitively: if unit A `with's
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 dictated by the Ada language standard. However, it is a superset of what the standard 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'.