aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/make.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/make.adb')
-rw-r--r--gcc/ada/make.adb491
1 files changed, 311 insertions, 180 deletions
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index e799e05..71f95c4 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -275,6 +275,8 @@ package body Make is
Current_Verbosity : Prj.Verbosity := Prj.Default;
-- Verbosity to parse the project files
+ Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data;
+
Main_Project : Prj.Project_Id := No_Project;
-- The project id of the main project file, if any
@@ -943,7 +945,8 @@ package body Make is
(Source_File => Name_Find,
Source_File_Name => File_Name,
Source_Index => Index,
- Naming => Projects.Table (Main_Project).Naming,
+ Naming => Project_Tree.Projects.Table
+ (Main_Project).Naming,
In_Package => The_Package,
Allow_ALI =>
Program = Binder or else Program = Linker);
@@ -958,7 +961,8 @@ package body Make is
Switch_List := Switches.Values;
while Switch_List /= Nil_String loop
- Element := String_Elements.Table (Switch_List);
+ Element :=
+ Project_Tree.String_Elements.Table (Switch_List);
Get_Name_String (Element.Value);
if Name_Len > 0 then
@@ -1073,7 +1077,9 @@ package body Make is
if Project /= No_Project then
Change_Dir
- (Get_Name_String (Projects.Table (Project).Object_Directory));
+ (Get_Name_String
+ (Project_Tree.Projects.Table
+ (Project).Object_Directory));
-- Otherwise, for sources outside of any project, set the working
-- directory to the object directory of the main project.
@@ -1081,7 +1087,8 @@ package body Make is
elsif Main_Project /= No_Project then
Change_Dir
(Get_Name_String
- (Projects.Table (Main_Project).Object_Directory));
+ (Project_Tree.Projects.Table
+ (Main_Project).Object_Directory));
end if;
end if;
end Change_To_Object_Directory;
@@ -1716,7 +1723,8 @@ package body Make is
Get_Reference
(Source_File_Name => Source_File_Name,
Project => Arguments_Project,
- Path => Arguments_Path_Name);
+ Path => Arguments_Path_Name,
+ In_Tree => Project_Tree);
-- If the source is not a source of a project file, check if
-- this is allowed.
@@ -1736,14 +1744,15 @@ package body Make is
-- We get the project directory for the relative path
-- switches and arguments.
- Data := Projects.Table (Arguments_Project);
+ Data := Project_Tree.Projects.Table (Arguments_Project);
-- If the source is in an extended project, we go to
-- the ultimate extending project.
while Data.Extended_By /= No_Project loop
Arguments_Project := Data.Extended_By;
- Data := Projects.Table (Arguments_Project);
+ Data :=
+ Project_Tree.Projects.Table (Arguments_Project);
end loop;
-- If building a dynamic or relocatable library, compile with
@@ -1763,7 +1772,8 @@ package body Make is
if Data.Dir_Path = null then
Data.Dir_Path :=
new String'(Get_Name_String (Data.Display_Directory));
- Projects.Table (Arguments_Project) := Data;
+ Project_Tree.Projects.Table (Arguments_Project) :=
+ Data;
end if;
-- We now look for package Compiler
@@ -1772,7 +1782,8 @@ package body Make is
Compiler_Package :=
Prj.Util.Value_Of
(Name => Name_Compiler,
- In_Packages => Data.Decl.Packages);
+ In_Packages => Data.Decl.Packages,
+ In_Tree => Project_Tree);
if Compiler_Package /= No_Package then
@@ -1804,7 +1815,8 @@ package body Make is
begin
while Current /= Nil_String loop
- Element := String_Elements.Table (Current);
+ Element := Project_Tree.String_Elements.
+ Table (Current);
Number := Number + 1;
Current := Element.Next;
end loop;
@@ -1816,7 +1828,8 @@ package body Make is
Current := Switches.Values;
for Index in New_Args'Range loop
- Element := String_Elements.Table (Current);
+ Element := Project_Tree.String_Elements.
+ Table (Current);
Get_Name_String (Element.Value);
New_Args (Index) :=
new String'(Name_Buffer (1 .. Name_Len));
@@ -2221,22 +2234,26 @@ package body Make is
-- check for an eventual library project, and use the full path.
if Arguments_Project /= No_Project then
- if not Projects.Table (Arguments_Project).Externally_Built then
- Prj.Env.Set_Ada_Paths (Arguments_Project, True);
+ if not Project_Tree.Projects.Table
+ (Arguments_Project).Externally_Built
+ then
+ Prj.Env.Set_Ada_Paths
+ (Arguments_Project, Project_Tree, True);
if not Unique_Compile
and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
then
declare
The_Data : Project_Data :=
- Projects.Table (Arguments_Project);
+ Project_Tree.Projects.Table
+ (Arguments_Project);
Prj : Project_Id := Arguments_Project;
begin
while The_Data.Extended_By /= No_Project loop
Prj := The_Data.Extended_By;
- The_Data := Projects.Table (Prj);
+ The_Data := Project_Tree.Projects.Table (Prj);
end loop;
if The_Data.Library
@@ -2252,7 +2269,8 @@ package body Make is
-- Now mark the project as processed
- Projects.Table (Prj).Need_To_Build_Lib := True;
+ Project_Tree.Projects.Table
+ (Prj).Need_To_Build_Lib := True;
end if;
end;
end if;
@@ -3006,7 +3024,9 @@ package body Make is
else
declare
Parent_Directory : constant String :=
- Get_Name_String (Projects.Table (Project).Directory);
+ Get_Name_String
+ (Project_Tree.Projects.Table
+ (Project).Directory);
begin
if Parent_Directory (Parent_Directory'Last) =
@@ -3025,17 +3045,21 @@ package body Make is
-- Start of processing for Configuration_Pragmas_Switch
begin
- Prj.Env.Create_Config_Pragmas_File (For_Project, Main_Project);
+ Prj.Env.Create_Config_Pragmas_File
+ (For_Project, Main_Project, Project_Tree);
- if Projects.Table (For_Project).Config_File_Name /= No_Name then
+ if Project_Tree.Projects.Table
+ (For_Project).Config_File_Name /= No_Name
+ then
Temporary_Config_File :=
- Projects.Table (For_Project).Config_File_Temp;
+ Project_Tree.Projects.Table (For_Project).Config_File_Temp;
Last := 1;
Result (1) :=
new String'
("-gnatec=" &
Get_Name_String
- (Projects.Table (For_Project).Config_File_Name));
+ (Project_Tree.Projects.Table
+ (For_Project).Config_File_Name));
else
Temporary_Config_File := False;
@@ -3043,16 +3067,20 @@ package body Make is
-- Check for attribute Builder'Global_Configuration_Pragmas
- The_Packages := Projects.Table (Main_Project).Decl.Packages;
+ The_Packages := Project_Tree.Projects.Table
+ (Main_Project).Decl.Packages;
Gnatmake :=
Prj.Util.Value_Of
(Name => Name_Builder,
- In_Packages => The_Packages);
+ In_Packages => The_Packages,
+ In_Tree => Project_Tree);
if Gnatmake /= No_Package then
Global_Attribute := Prj.Util.Value_Of
(Variable_Name => Name_Global_Configuration_Pragmas,
- In_Variables => Packages.Table (Gnatmake).Decl.Attributes);
+ In_Variables => Project_Tree.Packages.Table
+ (Gnatmake).Decl.Attributes,
+ In_Tree => Project_Tree);
Global_Attribute_Present :=
Global_Attribute /= Nil_Variable_Value
and then Get_Name_String (Global_Attribute.Value) /= "";
@@ -3076,16 +3104,20 @@ package body Make is
-- Check for attribute Compiler'Local_Configuration_Pragmas
- The_Packages := Projects.Table (For_Project).Decl.Packages;
+ The_Packages :=
+ Project_Tree.Projects.Table (For_Project).Decl.Packages;
Compiler :=
Prj.Util.Value_Of
(Name => Name_Compiler,
- In_Packages => The_Packages);
+ In_Packages => The_Packages,
+ In_Tree => Project_Tree);
if Compiler /= No_Package then
Local_Attribute := Prj.Util.Value_Of
(Variable_Name => Name_Local_Configuration_Pragmas,
- In_Variables => Packages.Table (Compiler).Decl.Attributes);
+ In_Variables => Project_Tree.Packages.Table
+ (Compiler).Decl.Attributes,
+ In_Tree => Project_Tree);
Local_Attribute_Present :=
Local_Attribute /= Nil_Variable_Value
and then Get_Name_String (Local_Attribute.Value) /= "";
@@ -3134,7 +3166,7 @@ package body Make is
if Gnatmake_Called and not Debug.Debug_Flag_N then
Delete_Mapping_Files;
Delete_Temp_Config_Files;
- Prj.Env.Delete_All_Path_Files;
+ Prj.Env.Delete_All_Path_Files (Project_Tree);
end if;
end Delete_All_Temp_Files;
@@ -3167,18 +3199,24 @@ package body Make is
Success : Boolean;
begin
if (not Debug.Debug_Flag_N) and Main_Project /= No_Project then
- for Project in 1 .. Projects.Last loop
- if Projects.Table (Project).Config_File_Temp then
+ for Project in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ if
+ Project_Tree.Projects.Table (Project).Config_File_Temp
+ then
if Verbose_Mode then
Write_Str ("Deleting temp configuration file """);
Write_Str (Get_Name_String
- (Projects.Table (Project).Config_File_Name));
+ (Project_Tree.Projects.Table
+ (Project).Config_File_Name));
Write_Line ("""");
end if;
Delete_File
(Name => Get_Name_String
- (Projects.Table (Project).Config_File_Name),
+ (Project_Tree.Projects.Table
+ (Project).Config_File_Name),
Success => Success);
-- Make sure that we don't have a config file for this
@@ -3186,9 +3224,12 @@ package body Make is
-- In this case, we will recreate another config file:
-- we cannot reuse the one that we just deleted!
- Projects.Table (Project).Config_Checked := False;
- Projects.Table (Project).Config_File_Name := No_Name;
- Projects.Table (Project).Config_File_Temp := False;
+ Project_Tree.Projects.Table (Project).
+ Config_Checked := False;
+ Project_Tree.Projects.Table (Project).
+ Config_File_Name := No_Name;
+ Project_Tree.Projects.Table (Project).
+ Config_File_Temp := False;
end if;
end loop;
end if;
@@ -3446,7 +3487,8 @@ package body Make is
-- Get the project of the current main
- Proj := Prj.Env.Project_Of (File_Name, Main_Project);
+ Proj := Prj.Env.Project_Of
+ (File_Name, Main_Project, Project_Tree);
-- Fail if the current main is not a source of a
-- project.
@@ -3462,7 +3504,8 @@ package body Make is
-- is the actual path of a source of a project.
if Main /= File_Name then
- Data := Projects.Table (Main_Project);
+ Data :=
+ Project_Tree.Projects.Table (Main_Project);
Real_Path :=
Locate_Regular_File
@@ -3496,6 +3539,7 @@ package body Make is
Prj.Env.File_Name_Of_Library_Unit_Body
(Name => File_Name,
Project => Main_Project,
+ In_Tree => Project_Tree,
Main_Project_Only => False,
Full_Path => True);
Normed_Path : constant String :=
@@ -3542,7 +3586,7 @@ package body Make is
("""" & Main &
""" is not a source of project " &
Get_Name_String
- (Projects.Table
+ (Project_Tree.Projects.Table
(Real_Main_Project).Name));
end if;
end if;
@@ -3591,12 +3635,12 @@ package body Make is
-- Traverse all units
- for J in Prj.Com.Units.First .. Prj.Com.Units.Last loop
+ for J in Unit_Table.First ..
+ Unit_Table.Last (Project_Tree.Units)
+ loop
declare
- Unit : constant Prj.Com.Unit_Data :=
- Prj.Com.Units.Table (J);
- use Prj.Com;
-
+ Unit : constant Unit_Data :=
+ Project_Tree.Units.Table (J);
begin
if Unit.Name /= No_Name then
@@ -3650,9 +3694,11 @@ package body Make is
if ALI_Name /= No_Name
and then
- Projects.Table (ALI_Project).Extended_By = No_Project
+ Project_Tree.Projects.Table
+ (ALI_Project).Extended_By = No_Project
and then
- Projects.Table (ALI_Project).Extends = No_Project
+ Project_Tree.Projects.Table
+ (ALI_Project).Extends = No_Project
then
-- First line is the unit name
@@ -3691,8 +3737,8 @@ package body Make is
Get_Name_String (ALI_Name);
begin
Get_Name_String
- (Projects.Table (ALI_Project).
- Object_Directory);
+ (Project_Tree.Projects.Table
+ (ALI_Project).Object_Directory);
if Name_Buffer (Name_Len) /=
Directory_Separator
@@ -3792,7 +3838,7 @@ package body Make is
-- And the project file cannot be a library project file
- elsif Projects.Table (Main_Project).Library then
+ elsif Project_Tree.Projects.Table (Main_Project).Library then
Make_Failed ("-B cannot be used for a library project file");
else
@@ -3832,7 +3878,7 @@ package body Make is
-- cannot be specified on the command line.
if Osint.Number_Of_Files /= 0 then
- if Projects.Table (Main_Project).Library
+ if Project_Tree.Projects.Table (Main_Project).Library
and then not Unique_Compile
and then ((not Make_Steps) or else Bind_Only or else Link_Only)
then
@@ -3859,7 +3905,8 @@ package body Make is
end if;
declare
- Value : String_List_Id := Projects.Table (Main_Project).Mains;
+ Value : String_List_Id :=
+ Project_Tree.Projects.Table (Main_Project).Mains;
begin
-- The attribute Main is an empty list or not specified,
@@ -3868,7 +3915,8 @@ package body Make is
if Value = Prj.Nil_String or else Unique_Compile then
if (not Make_Steps) or else Compile_Only
- or else not Projects.Table (Main_Project).Library
+ or else not Project_Tree.Projects.Table
+ (Main_Project).Library
then
-- First make sure that the binder and the linker
-- will not be invoked.
@@ -3900,11 +3948,13 @@ package body Make is
declare
Data : constant Project_Data :=
- Projects.Table (Main_Project);
+ Project_Tree.Projects.Table (Main_Project);
Languages : constant Variable_Value :=
Prj.Util.Value_Of
- (Name_Languages, Data.Decl.Attributes);
+ (Name_Languages,
+ Data.Decl.Attributes,
+ Project_Tree);
Current : String_List_Id;
Element : String_Element;
@@ -3921,7 +3971,8 @@ package body Make is
Look_For_Foreign :
while Current /= Nil_String loop
- Element := String_Elements.Table (Current);
+ Element := Project_Tree.String_Elements.
+ Table (Current);
Get_Name_String (Element.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
@@ -3938,7 +3989,9 @@ package body Make is
-- language, all the Ada mains.
while Value /= Prj.Nil_String loop
- Get_Name_String (String_Elements.Table (Value).Value);
+ Get_Name_String
+ (Project_Tree.String_Elements.Table
+ (Value).Value);
-- To know if a main is an Ada main, get its project.
-- It should be the project specified on the command
@@ -3946,17 +3999,23 @@ package body Make is
if (not Foreign_Language) or else
Prj.Env.Project_Of
- (Name_Buffer (1 .. Name_Len), Main_Project) =
+ (Name_Buffer (1 .. Name_Len),
+ Main_Project,
+ Project_Tree) =
Main_Project
then
At_Least_One_Main := True;
Osint.Add_File
(Get_Name_String
- (String_Elements.Table (Value).Value),
- Index => String_Elements.Table (Value).Index);
+ (Project_Tree.String_Elements.Table
+ (Value).Value),
+ Index =>
+ Project_Tree.String_Elements.Table
+ (Value).Index);
end if;
- Value := String_Elements.Table (Value).Next;
+ Value := Project_Tree.String_Elements.Table
+ (Value).Next;
end loop;
-- If we did not get any main, it means that all mains
@@ -3984,7 +4043,8 @@ package body Make is
end if;
if Main_Project /= No_Project
- and then Projects.Table (Main_Project).Externally_Built
+ and then Project_Tree.Projects.Table
+ (Main_Project).Externally_Built
then
Make_Failed
("nothing to do for a main project that is externally built");
@@ -3992,10 +4052,11 @@ package body Make is
if Osint.Number_Of_Files = 0 then
if Main_Project /= No_Project
- and then Projects.Table (Main_Project).Library
+ and then Project_Tree.Projects.Table (Main_Project).Library
then
if Do_Bind_Step
- and then not Projects.Table (Main_Project).Standalone_Library
+ and then not Project_Tree.Projects.Table
+ (Main_Project).Standalone_Library
then
Make_Failed ("only stand-alone libraries may be bound");
end if;
@@ -4008,6 +4069,7 @@ package body Make is
MLib.Prj.Build_Library
(For_Project => Main_Project,
+ In_Tree => Project_Tree,
Gnatbind => Gnatbind.all,
Gnatbind_Path => Gnatbind_Path,
Gcc => Gcc.all,
@@ -4079,10 +4141,10 @@ package body Make is
if Main_Project /= No_Project then
- if Projects.Table (Main_Project).Object_Directory /= No_Name then
-
- -- Change the current directory to the object directory of
- -- the main project.
+ if Project_Tree.Projects.Table
+ (Main_Project).Object_Directory /= No_Name
+ then
+ -- Change current directory to object directory of main project
begin
Project_Object_Directory := No_Project;
@@ -4098,7 +4160,7 @@ package body Make is
Parent : constant Dir_Name_Str :=
Dir_Name
(Get_Name_String
- (Projects.Table
+ (Project_Tree.Projects.Table
(Main_Project).Object_Directory));
Dir : Dir_Type;
@@ -4134,7 +4196,8 @@ package body Make is
Make_Failed
("unable to change working directory to """,
Get_Name_String
- (Projects.Table (Main_Project).Object_Directory),
+ (Project_Tree.Projects.Table
+ (Main_Project).Object_Directory),
"""");
end;
end if;
@@ -4153,26 +4216,30 @@ package body Make is
Prj.Env.File_Name_Of_Library_Unit_Body
(Name => Main_Source_File_Name,
Project => Main_Project,
+ In_Tree => Project_Tree,
Main_Project_Only =>
not Unique_Compile);
The_Packages : constant Package_Id :=
- Projects.Table (Main_Project).Decl.Packages;
+ Project_Tree.Projects.Table (Main_Project).Decl.Packages;
Builder_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Name_Builder,
- In_Packages => The_Packages);
+ In_Packages => The_Packages,
+ In_Tree => Project_Tree);
Binder_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Name_Binder,
- In_Packages => The_Packages);
+ In_Packages => The_Packages,
+ In_Tree => Project_Tree);
Linker_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
- (Name => Name_Linker,
- In_Packages => The_Packages);
+ (Name => Name_Linker,
+ In_Packages => The_Packages,
+ In_Tree => Project_Tree);
begin
-- We fail if we cannot find the main source file
@@ -4250,13 +4317,16 @@ package body Make is
(Name => Name_Ada,
Index => 0,
Attribute_Or_Array_Name => Name_Default_Switches,
- In_Package => Builder_Package);
+ In_Package => Builder_Package,
+ In_Tree => Project_Tree);
Switches : constant Array_Element_Id :=
Prj.Util.Value_Of
(Name => Name_Switches,
In_Arrays =>
- Packages.Table (Builder_Package).Decl.Arrays);
+ Project_Tree.Packages.Table
+ (Builder_Package).Decl.Arrays,
+ In_Tree => Project_Tree);
begin
if Defaults /= Nil_Variable_Value then
@@ -4359,30 +4429,41 @@ package body Make is
if not Unique_Compile
and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
then
- for Proj in Projects.First .. Projects.Last loop
- if Projects.Table (Proj).Library then
- Projects.Table (Proj).Need_To_Build_Lib :=
- (not MLib.Tgt.Library_Exists_For (Proj))
- and then (not Projects.Table (Proj).Externally_Built);
-
- if Projects.Table (Proj).Need_To_Build_Lib then
-
+ for Proj in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ if Project_Tree.Projects.Table (Proj).Library then
+ Project_Tree.Projects.Table
+ (Proj).Need_To_Build_Lib :=
+ (not MLib.Tgt.Library_Exists_For (Proj, Project_Tree))
+ and then (not Project_Tree.Projects.Table
+ (Proj).Externally_Built);
+
+ if Project_Tree.Projects.Table
+ (Proj).Need_To_Build_Lib
+ then
-- If there is no object directory, then it will be
-- impossible to build the library. So fail immediately.
- if Projects.Table (Proj).Object_Directory = No_Name then
+ if Project_Tree.Projects.Table
+ (Proj).Object_Directory = No_Name
+ then
Make_Failed
("no object files to build library for project """,
- Get_Name_String (Projects.Table (Proj).Name),
+ Get_Name_String
+ (Project_Tree.Projects.Table (Proj).Name),
"""");
- Projects.Table (Proj).Need_To_Build_Lib := False;
+ Project_Tree.Projects.Table
+ (Proj).Need_To_Build_Lib := False;
else
if Verbose_Mode then
Write_Str
("Library file does not exist for project """);
Write_Str
- (Get_Name_String (Projects.Table (Proj).Name));
+ (Get_Name_String
+ (Project_Tree.Projects.Table
+ (Proj).Name));
Write_Line ("""");
end if;
@@ -4416,8 +4497,9 @@ package body Make is
end if;
end loop;
- Get_Name_String (Projects.Table
- (Main_Project).Exec_Directory);
+ Get_Name_String
+ (Project_Tree.Projects.Table
+ (Main_Project).Exec_Directory);
if Name_Buffer (Name_Len) /= Directory_Separator then
Name_Len := Name_Len + 1;
@@ -4445,7 +4527,8 @@ package body Make is
declare
Dir_Path : constant String_Access :=
new String'(Get_Name_String
- (Projects.Table (Main_Project).Directory));
+ (Project_Tree.Projects.Table
+ (Main_Project).Directory));
begin
for J in 1 .. Binder_Switches.Last loop
Test_If_Relative_Path
@@ -4481,10 +4564,10 @@ package body Make is
end;
end if;
- -- We now put in the Binder_Switches and Linker_Switches tables,
- -- the binder and linker switches of the command line that have been
- -- put in the Saved_ tables. If a project file was used, then the
- -- command line switches will follow the project file switches.
+ -- We now put in the Binder_Switches and Linker_Switches tables, the
+ -- binder and linker switches of the command line that have been put in
+ -- the Saved_ tables. If a project file was used, then the command line
+ -- switches will follow the project file switches.
for J in 1 .. Saved_Binder_Switches.Last loop
Add_Switch
@@ -4563,15 +4646,20 @@ package body Make is
The_Mapping_File_Names :=
new Temp_File_Names
- (No_Project .. Projects.Last, 1 .. Saved_Maximum_Processes);
+ (No_Project .. Project_Table.Last (Project_Tree.Projects),
+ 1 .. Saved_Maximum_Processes);
Last_Mapping_File_Names :=
- new Indices'(No_Project .. Projects.Last => 0);
+ new Indices'
+ (No_Project .. Project_Table.Last (Project_Tree.Projects)
+ => 0);
The_Free_Mapping_File_Indices :=
new Free_File_Indices
- (No_Project .. Projects.Last, 1 .. Saved_Maximum_Processes);
+ (No_Project .. Project_Table.Last (Project_Tree.Projects),
+ 1 .. Saved_Maximum_Processes);
Last_Free_Indices :=
- new Indices'(No_Project .. Projects.Last => 0);
+ new Indices'(No_Project .. Project_Table.Last
+ (Project_Tree.Projects) => 0);
Bad_Compilation.Init;
@@ -4632,8 +4720,9 @@ package body Make is
-- executable "main.2" for a main subprogram
-- "main.2.ada", when the body termination is ".2.ada".
- Executable := Prj.Util.Executable_Of
- (Main_Project, Main_Source_File, Main_Index);
+ Executable :=
+ Prj.Util.Executable_Of
+ (Main_Project, Project_Tree, Main_Source_File, Main_Index);
end if;
end if;
@@ -4653,7 +4742,7 @@ package body Make is
end if;
end loop;
- Get_Name_String (Projects.Table
+ Get_Name_String (Project_Tree.Projects.Table
(Main_Project).Exec_Directory);
if
@@ -4752,23 +4841,31 @@ package body Make is
-- Put in Library_Projs table all library project
-- file ids when the library need to be rebuilt.
- for Proj1 in Projects.First .. Projects.Last loop
-
- if Projects.Table (Proj1).Standalone_Library then
+ for Proj1 in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ if Project_Tree.Projects.Table
+ (Proj1).Standalone_Library
+ then
There_Are_Stand_Alone_Libraries := True;
end if;
- if Projects.Table (Proj1).Library
- and then not Projects.Table (Proj1).Need_To_Build_Lib
- and then not Projects.Table (Proj1).Externally_Built
+ if Project_Tree.Projects.Table (Proj1).Library
+ and then not Project_Tree.Projects.Table
+ (Proj1).Need_To_Build_Lib
+ and then not Project_Tree.Projects.Table
+ (Proj1).Externally_Built
then
- MLib.Prj.Check_Library (Proj1);
+ MLib.Prj.Check_Library (Proj1, Project_Tree);
end if;
- if Projects.Table (Proj1).Need_To_Build_Lib then
+ if Project_Tree.Projects.Table
+ (Proj1).Need_To_Build_Lib
+ then
Library_Projs.Increment_Last;
Current := Library_Projs.Last;
- Depth := Projects.Table (Proj1).Depth;
+ Depth := Project_Tree.Projects.Table
+ (Proj1).Depth;
-- Put the projects in decreasing depth order,
-- so that if libA depends on libB, libB is first
@@ -4776,13 +4873,15 @@ package body Make is
while Current > 1 loop
Proj2 := Library_Projs.Table (Current - 1);
- exit when Projects.Table (Proj2).Depth >= Depth;
+ exit when Project_Tree.Projects.Table
+ (Proj2).Depth >= Depth;
Library_Projs.Table (Current) := Proj2;
Current := Current - 1;
end loop;
Library_Projs.Table (Current) := Proj1;
- Projects.Table (Proj1).Need_To_Build_Lib := False;
+ Project_Tree.Projects.Table
+ (Proj1).Need_To_Build_Lib := False;
end if;
end loop;
end;
@@ -4793,6 +4892,7 @@ package body Make is
Library_Rebuilt := True;
MLib.Prj.Build_Library
(For_Project => Library_Projs.Table (J),
+ In_Tree => Project_Tree,
Gnatbind => Gnatbind.all,
Gnatbind_Path => Gnatbind_Path,
Gcc => Gcc.all,
@@ -4994,9 +5094,12 @@ package body Make is
if Main_Project /= No_Project
and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
then
- for Proj in Projects.First .. Projects.Last loop
- if Projects.Table (Proj).Library and then
- Projects.Table (Proj).Library_Kind /= Static
+ for Proj in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ if Project_Tree.Projects.Table (Proj).Library
+ and then Project_Tree.Projects.Table
+ (Proj).Library_Kind /= Static
then
Shared_Libs := True;
Bind_Shared := Shared_Switch'Access;
@@ -5039,7 +5142,7 @@ package body Make is
-- Put all the source directories in ADA_INCLUDE_PATH,
-- and all the object directories in ADA_OBJECTS_PATH
- Prj.Env.Set_Ada_Paths (Main_Project, False);
+ Prj.Env.Set_Ada_Paths (Main_Project, Project_Tree, False);
-- If switch -C was specified, create a binder mapping file
@@ -5103,14 +5206,18 @@ package body Make is
if MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None then
-- Check for library projects
- for Proj1 in 1 .. Projects.Last loop
+ for Proj1 in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
if Proj1 /= Main_Project
- and then Projects.Table (Proj1).Library
+ and then
+ Project_Tree.Projects.Table (Proj1).Library
then
-- Add this project to table Library_Projs
There_Are_Libraries := True;
- Depth := Projects.Table (Proj1).Depth;
+ Depth :=
+ Project_Tree.Projects.Table (Proj1).Depth;
Library_Projs.Increment_Last;
Current := Library_Projs.Last;
@@ -5119,7 +5226,8 @@ package body Make is
while Current > 1 loop
Proj2 := Library_Projs.Table (Current - 1);
- exit when Projects.Table (Proj2).Depth <= Depth;
+ exit when Project_Tree.Projects.Table
+ (Proj2).Depth <= Depth;
Library_Projs.Table (Current) := Proj2;
Current := Current - 1;
end loop;
@@ -5129,14 +5237,16 @@ package body Make is
-- If it is not a static library and path option
-- is set, add it to the Library_Paths table.
- if Projects.Table (Proj1).Library_Kind /= Static
+ if Project_Tree.Projects.Table
+ (Proj1).Library_Kind /= Static
and then Path_Option /= null
then
Library_Paths.Increment_Last;
Library_Paths.Table (Library_Paths.Last) :=
new String'
(Get_Name_String
- (Projects.Table (Proj1).Library_Dir));
+ (Project_Tree.Projects.Table
+ (Proj1).Library_Dir));
end if;
end if;
end loop;
@@ -5148,7 +5258,7 @@ package body Make is
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-L" &
Get_Name_String
- (Projects.Table
+ (Project_Tree.Projects.Table
(Library_Projs.Table (Index)).
Library_Dir));
@@ -5158,7 +5268,7 @@ package body Make is
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-l" &
Get_Name_String
- (Projects.Table
+ (Project_Tree.Projects.Table
(Library_Projs.Table (Index)).
Library_Name));
end loop;
@@ -5233,15 +5343,15 @@ package body Make is
-- Put the object directories in ADA_OBJECTS_PATH
- Prj.Env.Set_Ada_Paths (Main_Project, False);
+ Prj.Env.Set_Ada_Paths (Main_Project, Project_Tree, False);
-- Check for attributes Linker'Linker_Options in projects
-- other than the main project
declare
Linker_Options : constant String_List :=
- Linker_Options_Switches (Main_Project);
-
+ Linker_Options_Switches
+ (Main_Project, Project_Tree);
begin
for Option in Linker_Options'Range loop
Linker_Switches.Increment_Last;
@@ -5340,21 +5450,25 @@ package body Make is
File_Name_Of_Library_Unit_Body
(Name => Main_Source_File_Name,
Project => Main_Project,
+ In_Tree => Project_Tree,
Main_Project_Only =>
not Unique_Compile);
The_Packages : constant Package_Id :=
- Projects.Table (Main_Project).Decl.Packages;
+ Project_Tree.Projects.Table
+ (Main_Project).Decl.Packages;
Binder_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Name_Binder,
- In_Packages => The_Packages);
+ In_Packages => The_Packages,
+ In_Tree => Project_Tree);
Linker_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
- (Name => Name_Linker,
- In_Packages => The_Packages);
+ (Name => Name_Linker,
+ In_Packages => The_Packages,
+ In_Tree => Project_Tree);
begin
-- We fail if we cannot find the main source file
@@ -5442,7 +5556,8 @@ package body Make is
declare
Dir_Path : constant String_Access :=
new String'(Get_Name_String
- (Projects.Table (Main_Project).Directory));
+ (Project_Tree.Projects.Table
+ (Main_Project).Directory));
begin
for
J in Last_Binder_Switch + 1 .. Binder_Switches.Last
@@ -5516,7 +5631,7 @@ package body Make is
if not Debug.Debug_Flag_N then
Delete_Mapping_Files;
- Prj.Env.Delete_All_Path_Files;
+ Prj.Env.Delete_All_Path_Files (Project_Tree);
end if;
Exit_Program (E_Success);
@@ -5528,7 +5643,7 @@ package body Make is
when Compilation_Failed =>
if not Debug.Debug_Flag_N then
Delete_Mapping_Files;
- Prj.Env.Delete_All_Path_Files;
+ Prj.Env.Delete_All_Path_Files (Project_Tree);
end if;
Exit_Program (E_Fatal);
@@ -5605,7 +5720,7 @@ package body Make is
if Project /= No_Project then
Prj.Env.Create_Mapping_File
- (Project,
+ (Project, Project_Tree,
The_Mapping_File_Names
(Project, Last_Mapping_File_Names (Project)));
@@ -5669,7 +5784,7 @@ package body Make is
Snames.Initialize;
- Prj.Initialize;
+ Prj.Initialize (Project_Tree);
Dependencies.Init;
@@ -5789,6 +5904,7 @@ package body Make is
Prj.Pars.Parse
(Project => Main_Project,
+ In_Tree => Project_Tree,
Project_File_Name => Project_File_Name.all,
Packages_To_Check => Packages_To_Check_By_Gnatmake);
@@ -5807,14 +5923,16 @@ package body Make is
-- We add the source directories and the object directories
-- to the search paths.
- Add_Source_Directories (Main_Project);
- Add_Object_Directories (Main_Project);
+ Add_Source_Directories (Main_Project, Project_Tree);
+ Add_Object_Directories (Main_Project, Project_Tree);
-- Compute depth of each project
- for Proj in 1 .. Projects.Last loop
- Projects.Table (Proj).Seen := False;
- Projects.Table (Proj).Depth := 0;
+ for Proj in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ Project_Tree.Projects.Table (Proj).Seen := False;
+ Project_Tree.Projects.Table (Proj).Depth := 0;
end loop;
Recursive_Compute_Depth
@@ -5860,11 +5978,12 @@ package body Make is
Into_Q : Boolean)
is
Put_In_Q : Boolean := Into_Q;
- Unit : Com.Unit_Data;
+ Unit : Unit_Data;
Sfile : Name_Id;
Extending : constant Boolean :=
- Projects.Table (The_Project).Extends /= No_Project;
+ Project_Tree.Projects.Table
+ (The_Project).Extends /= No_Project;
function Check_Project (P : Project_Id) return Boolean;
-- Returns True if P is The_Project or a project extended by
@@ -5880,7 +5999,8 @@ package body Make is
return True;
elsif Extending then
declare
- Data : Project_Data := Projects.Table (The_Project);
+ Data : Project_Data :=
+ Project_Tree.Projects.Table (The_Project);
begin
loop
@@ -5888,7 +6008,7 @@ package body Make is
return True;
end if;
- Data := Projects.Table (Data.Extends);
+ Data := Project_Tree.Projects.Table (Data.Extends);
exit when Data.Extends = No_Project;
end loop;
end;
@@ -5897,30 +6017,31 @@ package body Make is
return False;
end Check_Project;
- -- Start of processing of Insert_Project_Sources
+ -- Start of processing for Insert_Project_Sources
begin
-- For all the sources in the project files,
- for Id in Com.Units.First .. Com.Units.Last loop
- Unit := Com.Units.Table (Id);
+ for Id in Unit_Table.First ..
+ Unit_Table.Last (Project_Tree.Units)
+ loop
+ Unit := Project_Tree.Units.Table (Id);
Sfile := No_Name;
-- If there is a source for the body, and the body has not been
-- locally removed,
- if Unit.File_Names (Com.Body_Part).Name /= No_Name
- and then Unit.File_Names (Com.Body_Part).Path /= Slash
+ if Unit.File_Names (Body_Part).Name /= No_Name
+ and then Unit.File_Names (Body_Part).Path /= Slash
then
-
-- And it is a source for the specified project
- if Check_Project (Unit.File_Names (Com.Body_Part).Project) then
+ if Check_Project (Unit.File_Names (Body_Part).Project) then
-- If we don't have a spec, we cannot consider the source
-- if it is a subunit
- if Unit.File_Names (Com.Specification).Name = No_Name then
+ if Unit.File_Names (Specification).Name = No_Name then
declare
Src_Ind : Source_File_Index;
@@ -5937,7 +6058,7 @@ package body Make is
begin
Src_Ind := Sinput.P.Load_Project_File
(Get_Name_String
- (Unit.File_Names (Com.Body_Part).Path));
+ (Unit.File_Names (Body_Part).Path));
-- If it is a subunit, discard it
@@ -5945,24 +6066,24 @@ package body Make is
Sfile := No_Name;
else
- Sfile := Unit.File_Names (Com.Body_Part).Name;
+ Sfile := Unit.File_Names (Body_Part).Name;
end if;
end;
else
- Sfile := Unit.File_Names (Com.Body_Part).Name;
+ Sfile := Unit.File_Names (Body_Part).Name;
end if;
end if;
- elsif Unit.File_Names (Com.Specification).Name /= No_Name
- and then Unit.File_Names (Com.Specification).Path /= Slash
- and then Check_Project (Unit.File_Names (Com.Specification).Project)
+ elsif Unit.File_Names (Specification).Name /= No_Name
+ and then Unit.File_Names (Specification).Path /= Slash
+ and then Check_Project (Unit.File_Names (Specification).Project)
then
-- If there is no source for the body, but there is a source
-- for the spec which has not been locally removed, then we take
-- this one.
- Sfile := Unit.File_Names (Com.Specification).Name;
+ Sfile := Unit.File_Names (Specification).Name;
end if;
-- If Put_In_Q is True, we insert into the Q
@@ -6090,7 +6211,7 @@ package body Make is
declare
Source_File_Name : constant String :=
Get_Name_String (Source_File);
- Saved_Verbosity : constant Verbosity := Prj.Com.Current_Verbosity;
+ Saved_Verbosity : constant Verbosity := Current_Verbosity;
Project : Project_Id := No_Project;
Path_Name : Name_Id := No_Name;
Data : Project_Data;
@@ -6100,13 +6221,14 @@ package body Make is
-- the source. Call it with verbosity default to avoid verbose
-- messages.
- Prj.Com.Current_Verbosity := Default;
+ Current_Verbosity := Default;
Prj.Env.
Get_Reference
(Source_File_Name => Source_File_Name,
Project => Project,
+ In_Tree => Project_Tree,
Path => Path_Name);
- Prj.Com.Current_Verbosity := Saved_Verbosity;
+ Current_Verbosity := Saved_Verbosity;
-- If this source is in a project, check that the ALI file is
-- in its object directory. If it is not, return False, so that
@@ -6116,9 +6238,10 @@ package body Make is
-- the general case and return True at the end of the function.
if Project /= No_Project
- and then Projects.Table (Project).Extends /= No_Project
+ and then Project_Tree.Projects.Table
+ (Project).Extends /= No_Project
then
- Data := Projects.Table (Project);
+ Data := Project_Tree.Projects.Table (Project);
declare
Object_Directory : constant String :=
@@ -6328,26 +6451,26 @@ package body Make is
-- been seen or if the depth is large enough.
if Project = No_Project
- or else Projects.Table (Project).Seen
- or else Projects.Table (Project).Depth >= Depth
+ or else Project_Tree.Projects.Table (Project).Seen
+ or else Project_Tree.Projects.Table (Project).Depth >= Depth
then
return;
end if;
- Projects.Table (Project).Depth := Depth;
+ Project_Tree.Projects.Table (Project).Depth := Depth;
-- Mark the project as Seen to avoid endless loop caused by limited
-- withs.
- Projects.Table (Project).Seen := True;
+ Project_Tree.Projects.Table (Project).Seen := True;
- List := Projects.Table (Project).Imported_Projects;
+ List := Project_Tree.Projects.Table (Project).Imported_Projects;
-- Visit each imported project
while List /= Empty_Project_List loop
- Proj := Project_Lists.Table (List).Project;
- List := Project_Lists.Table (List).Next;
+ Proj := Project_Tree.Project_Lists.Table (List).Project;
+ List := Project_Tree.Project_Lists.Table (List).Next;
Recursive_Compute_Depth
(Project => Proj,
Depth => Depth + 1);
@@ -6356,12 +6479,12 @@ package body Make is
-- Visit a project being extended, if any
Recursive_Compute_Depth
- (Project => Projects.Table (Project).Extends,
+ (Project => Project_Tree.Projects.Table (Project).Extends,
Depth => Depth + 1);
-- Reset the Seen flag, as we leave this project
- Projects.Table (Project).Seen := False;
+ Project_Tree.Projects.Table (Project).Seen := False;
end Recursive_Compute_Depth;
-----------------------
@@ -6976,20 +7099,25 @@ package body Make is
Prj.Util.Value_Of
(Name => Name_Default_Switches,
In_Arrays =>
- Packages.Table (In_Package).Decl.Arrays);
+ Project_Tree.Packages.Table
+ (In_Package).Decl.Arrays,
+ In_Tree => Project_Tree);
Switches_Array : constant Array_Element_Id :=
Prj.Util.Value_Of
(Name => Name_Switches,
In_Arrays =>
- Packages.Table (In_Package).Decl.Arrays);
+ Project_Tree.Packages.Table
+ (In_Package).Decl.Arrays,
+ In_Tree => Project_Tree);
begin
Switches :=
Prj.Util.Value_Of
(Index => Source_File,
Src_Index => Source_Index,
- In_Array => Switches_Array);
+ In_Array => Switches_Array,
+ In_Tree => Project_Tree);
if Switches = Nil_Variable_Value then
declare
@@ -7028,7 +7156,8 @@ package body Make is
Prj.Util.Value_Of
(Index => Name_Find,
Src_Index => 0,
- In_Array => Switches_Array);
+ In_Array => Switches_Array,
+ In_Tree => Project_Tree);
if Switches = Nil_Variable_Value
and then Allow_ALI
@@ -7046,7 +7175,8 @@ package body Make is
Prj.Util.Value_Of
(Index => Name_Find,
Src_Index => 0,
- In_Array => Switches_Array);
+ In_Array => Switches_Array,
+ In_Tree => Project_Tree);
end if;
end if;
end;
@@ -7057,7 +7187,8 @@ package body Make is
Prj.Util.Value_Of
(Index => Name_Ada,
Src_Index => 0,
- In_Array => Defaults);
+ In_Array => Defaults,
+ In_Tree => Project_Tree);
end if;
return Switches;