Node: Project Files and Main Subprograms, Previous: Switches and Project Files, Up: gnatmake and Project Files



Project Files and Main Subprograms

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 defined the 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.

If the 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.

Example:

        project Prj is
           for Main use ("main1", "main2", "main3");
        end Prnces-in-Project-Files.html#External%20References%20in%20Project%20Files">External References in Project Files,
Previous: Importing Projects,
Up: GNAT Project Manager


Project Extension

During development of a large system, it is sometimes necessary to use modified versions of some of the source files without changing the original sources. This can be achieved through a facility known as project extension.

        project Modified_Utilities extends "/baseline/utilities.gpr" is ...
     

The project file for the project being e