This section contains some additional useful notes on the operation
gnatmakefinds no ALI files, it recompiles the main program and all other units required by the main program. This means that
gnatmakecan be used for the initial compile, as well as during subsequent steps of the development cycle.
.adb, where file.adb is a subunit or body of a generic unit,
gnatmakerecompiles file.adb (because it finds no ALI) and stops, issuing a warning.
gnatmakethe switch -I is used to specify both source and library file paths. Use -aI instead if you just want to specify source paths only and -aO if you want to specify library paths only.
gnatmakeexamines both an ALI file and its corresponding object file for consistency. If an ALI is more recent than its corresponding object, or if the object file is missing, the corresponding source will be recompiled. Note that
gnatmakeexpects an ALI and the corresponding object file to be in the same directory.
gnatmakewill ignore any files whose ALI file is write-protected. This may conveniently be used to exclude standard libraries from consideration and in particular it means that the use of the -f switch will not recompile these files unless -a is also specified.
gnatmakehas been designed to make the use of Ada libraries particularly convenient. Assume you have an Ada library organized as follows: obj-dir contains the objects and ALI files for of your Ada compilation units, whereas include-dir contains the specs of these units, but no bodies. Then to compile a unit stored in
main.adb, which uses this Ada library you would just type
$ gnatmake -aIinclude-dir -aLobj-dir main
gnatmakealong with the -m (minimal recompilation) switch provides a mechanism for avoiding unnecessary rcompilations. Using this switch, you can update the comments/format of your source files without having to recompile everything. Note, however, that adding or deleting lines in a source files may render its debugging info obsolete. If the file in question is a spec, the impact is rather limited, as that debugging info will only be useful during the elaboration phase of your program. For bodies the impact can be more significant. In all events, your debugger will warn you if a source file is more recent than the corresponding object, and alert you to the fact that the debugging information may be out of date.