When using a project file, you can invoke gnatmake with several main subprograms, by specifying their source files on the command line. Each of these needs to be an immediate source file of the project.
gnatmake -Pprj main1 main2 main3
When using a project file, you can also invoke gnatmake without
explicitly specifying any main, and the effect depends on whether you have
Main attribute. This attribute has a string list value,
where each element in the list is the name of a source file (the file
extension is optional) containing a main subprogram.
Main attribute is defined in a project file as a non-empty
string list and the switch -u is not used on the command line, then
invoking gnatmake with this project file but without any main on the
command line is equivalent to invoking gnatmake with all the file
names in the
Main attribute on the command line.
project Prj is for Main use ("main1", "main2", "main3"); end Prj;
With this project file,
"gnatmake -Pprj" is equivalent to
"gnatmake -Pprj main1 main2 main3".
When the project attribute
Main is not specified, or is specified
as an empty string list, or when the switch -u is used on the command
line, then invoking gnatmake with no main on the command line will
result in all immediate sources of the project file being checked, and
potentially recompiled. Depending on the presence of the switch -u,
sources from other project files on which the immediate sources of the main
project file depend are also checked and potentially recompiled. In other
words, the -u switch is applied to all of the immediate sources of themain project file.