This section contains some additional useful notes on the operation of the gnatmake command.
If gnatmake finds no ALI files, it recompiles the main program and all other units required by the main program. This means that gnatmake can be used for the initial compile, as well as during the re-edit development cycle.
If you enter gnatmake file.adb, where file.adb is a subunit or body of a generic unit, gnatmake recompiles file.adb (because it finds no ALI) and stops, issuing a warning.
In gnatmake the 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.
gnatmake examines both an ALI file and its corresponding object file for consistency. If an ALI is more recent than its corresponding object, or the object is missing, the corresponding source will be recompiled. Note that gnatmake expects an ALI and the corresponding object file to be in the same directory.
gnatmake will 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.
gnatmake has 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
Using gnatmake along with the -s (minimal re-compilation) switch provides an extremely powerful tool: you can freely 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 so obsolescence of debugging information cannot go unnoticed.