Commit 31a33125 by Vincent Celier Committed by Arnaud Charlet

makegpr.adb (Check_Compilation_Needed): Take into account path names with spaces.

2006-10-31  Vincent Celier  <celier@adacore.com>

	* makegpr.adb (Check_Compilation_Needed): Take into account path names
	with spaces.
	(Check_Compilation_Needed): When checking a C or C++ source, do not
	resolve symbolic links.
	(Display_Command): New Boolean parameter Ellipse, defaulted to False.
	When not in verbose mode and Ellipse is True, display "..." for the
	first argument with Display set to False.
	(Build_Global_Archive): Always set Display True for the first object
	file. Call Display_Command with Ellipse set to True.

From-SVN: r118323
parent 57d9e177
...@@ -234,7 +234,7 @@ package body Makegpr is ...@@ -234,7 +234,7 @@ package body Makegpr is
(Table_Component_Type => String_Access, (Table_Component_Type => String_Access,
Table_Index_Type => Integer, Table_Index_Type => Integer,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 2, Table_Initial => 10,
Table_Increment => 100, Table_Increment => 100,
Table_Name => "Makegpr.X_Switches"); Table_Name => "Makegpr.X_Switches");
-- Table to store the -X switches to be passed to gnatmake -- Table to store the -X switches to be passed to gnatmake
...@@ -262,7 +262,7 @@ package body Makegpr is ...@@ -262,7 +262,7 @@ package body Makegpr is
Table_Index_Type => Integer, Table_Index_Type => Integer,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 200, Table_Initial => 200,
Table_Increment => 50, Table_Increment => 100,
Table_Name => "Makegpr.Cache_Args"); Table_Name => "Makegpr.Cache_Args");
-- A table to cache arguments, to avoid multiple allocation of the same -- A table to cache arguments, to avoid multiple allocation of the same
-- strings. It is not possible to use a hash table, because String is -- strings. It is not possible to use a hash table, because String is
...@@ -346,7 +346,7 @@ package body Makegpr is ...@@ -346,7 +346,7 @@ package body Makegpr is
Table_Index_Type => Integer, Table_Index_Type => Integer,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 200, Table_Initial => 200,
Table_Increment => 50, Table_Increment => 100,
Table_Name => "Makegpr.Lib_Path"); Table_Name => "Makegpr.Lib_Path");
-- A table to compute the path to put in the path option switch, when it -- A table to compute the path to put in the path option switch, when it
-- is supported. -- is supported.
...@@ -442,25 +442,27 @@ package body Makegpr is ...@@ -442,25 +442,27 @@ package body Makegpr is
procedure Display_Command procedure Display_Command
(Name : String; (Name : String;
Path : String_Access; Path : String_Access;
CPATH : String_Access := null); CPATH : String_Access := null;
-- Display the command for a spawned process, if in Verbose_Mode or Ellipse : Boolean := False);
-- not in Quiet_Output. -- Display the command for a spawned process, if in Verbose_Mode or not in
-- Quiet_Output. In non verbose mode, when Ellipse is True, display "..."
-- in place of the first argument that has Display set to False.
procedure Get_Compiler (For_Language : First_Language_Indexes); procedure Get_Compiler (For_Language : First_Language_Indexes);
-- Find the compiler name and path name for a specified programming -- Find the compiler name and path name for a specified programming
-- language, if not already done. Results are in the corresponding -- language, if not already done. Results are in the corresponding elements
-- elements of arrays Compiler_Names and Compiler_Paths. Name of compiler -- of arrays Compiler_Names and Compiler_Paths. Name of compiler is found
-- is found in package IDE of the main project, or defaulted. -- in package IDE of the main project, or defaulted. Fail if compiler
-- Fail if compiler cannot be found on the path. For the Ada language, -- cannot be found on the path. For the Ada language, gnatmake, rather than
-- gnatmake, rather than the Ada compiler is returned. -- the Ada compiler is returned.
procedure Get_Imported_Directories procedure Get_Imported_Directories
(Project : Project_Id; (Project : Project_Id;
Data : in out Project_Data); Data : in out Project_Data);
-- Find the necessary switches -I to be used when compiling sources -- Find the necessary switches -I to be used when compiling sources of
-- of languages other than Ada, in a specified project file. Cache the -- languages other than Ada, in a specified project file. Cache the result
-- result in component Imported_Directories_Switches of the project data. -- in component Imported_Directories_Switches of the project data. For
-- For gcc/g++ compilers, get the value of the C*_INCLUDE_PATH, instead. -- gcc/g++ compilers, get the value of the C*_INCLUDE_PATH, instead.
procedure Initialize; procedure Initialize;
-- Do the necessary package initialization and process the command line -- Do the necessary package initialization and process the command line
...@@ -476,9 +478,9 @@ package body Makegpr is ...@@ -476,9 +478,9 @@ package body Makegpr is
-- Link executables -- Link executables
procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := ""); procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := "");
-- Report an error. If Keep_Going is False, just call Osint.Fail. -- Report an error. If Keep_Going is False, just call Osint.Fail. If
-- If Keep_Going is True, display the error and increase the total number -- Keep_Going is True, display the error and increase the total number of
-- of errors. -- errors.
procedure Report_Total_Errors (Kind : String); procedure Report_Total_Errors (Kind : String);
-- If Total_Number_Of_Errors is not zero, report it, and fail -- If Total_Number_Of_Errors is not zero, report it, and fail
...@@ -498,9 +500,9 @@ package body Makegpr is ...@@ -498,9 +500,9 @@ package body Makegpr is
procedure Add_Archives (For_Gnatmake : Boolean) is procedure Add_Archives (For_Gnatmake : Boolean) is
Last_Arg : constant Natural := Last_Argument; Last_Arg : constant Natural := Last_Argument;
-- The position of the last argument before adding the archives. -- The position of the last argument before adding the archives. Used to
-- Used to reverse the order of the arguments added when processing -- reverse the order of the arguments added when processing the
-- the archives. -- archives.
procedure Recursive_Add_Archives (Project : Project_Id); procedure Recursive_Add_Archives (Project : Project_Id);
-- Recursive procedure to add the archive of a project file, if any, -- Recursive procedure to add the archive of a project file, if any,
...@@ -530,9 +532,9 @@ package body Makegpr is ...@@ -530,9 +532,9 @@ package body Makegpr is
begin begin
if Data.Library then if Data.Library then
-- If it is a library project file, nothing to do if -- If it is a library project file, nothing to do if gnatmake
-- gnatmake will be invoked, because gnatmake will take -- will be invoked, because gnatmake will take care of it, even
-- care of it, even if the library is not an Ada library. -- if the library is not an Ada library.
if not For_Gnatmake then if not For_Gnatmake then
if Data.Library_Kind = Static then if Data.Library_Kind = Static then
...@@ -557,18 +559,17 @@ package body Makegpr is ...@@ -557,18 +559,17 @@ package body Makegpr is
("-L" & Name_Buffer (1 .. Name_Len), ("-L" & Name_Buffer (1 .. Name_Len),
Verbose_Mode); Verbose_Mode);
-- If there is a run path option, prepend this -- If there is a run path option, prepend this directory
-- directory to the library path. It is probable -- to the library path. It is probable that the order of
-- that the order of the directories in the path -- the directories in the path option is not important,
-- option is not important, but just in case -- but just in case put the directories in the same order
-- put the directories in the same order as the -- as the libraries.
-- libraries.
if Path_Option /= null then if Path_Option /= null then
-- If it is not the first directory, make room -- If it is not the first directory, make room at the
-- at the beginning of the table, including -- beginning of the table, including for a path
-- for a path separator. -- separator.
if Lib_Path.Last > 0 then if Lib_Path.Last > 0 then
Increment := Name_Len + 1; Increment := Name_Len + 1;
...@@ -599,8 +600,8 @@ package body Makegpr is ...@@ -599,8 +600,8 @@ package body Makegpr is
end if; end if;
end if; end if;
-- For a non-library project, the only archive needed -- For a non-library project, the only archive needed is the one
-- is the one for the main project, if there is one. -- for the main project, if there is one.
elsif Project = Main_Project and then Global_Archive_Exists then elsif Project = Main_Project and then Global_Archive_Exists then
Add_Argument Add_Argument
...@@ -689,11 +690,13 @@ package body Makegpr is ...@@ -689,11 +690,13 @@ package body Makegpr is
-- And reverse the order -- And reverse the order
declare declare
First : Positive := Last_Arg + 1; First : Positive;
Last : Natural := Last_Argument; Last : Natural;
Temp : String_Access; Temp : String_Access;
begin begin
First := Last_Arg + 1;
Last := Last_Argument;
while First < Last loop while First < Last loop
Temp := Arguments (First); Temp := Arguments (First);
Arguments (First) := Arguments (Last); Arguments (First) := Arguments (Last);
...@@ -761,6 +764,7 @@ package body Makegpr is ...@@ -761,6 +764,7 @@ package body Makegpr is
-- Nothing to do if argument is empty -- Nothing to do if argument is empty
if Arg'Length > 0 then if Arg'Length > 0 then
-- Check if the argument is already in the Cache_Args table. -- Check if the argument is already in the Cache_Args table.
-- If it is already there, reuse the allocated value. -- If it is already there, reuse the allocated value.
...@@ -1072,7 +1076,7 @@ package body Makegpr is ...@@ -1072,7 +1076,7 @@ package body Makegpr is
Open (File, Archive_Dep_Name); Open (File, Archive_Dep_Name);
-- If the archive dependency file does not exist, we need to -- If the archive dependency file does not exist, we need to
-- to rebuild the archive and to create its dependency file. -- rebuild the archive and to create its dependency file.
if not Is_Valid (File) then if not Is_Valid (File) then
Need_To_Rebuild := True; Need_To_Rebuild := True;
...@@ -1084,8 +1088,7 @@ package body Makegpr is ...@@ -1084,8 +1088,7 @@ package body Makegpr is
end if; end if;
else else
-- Put all sources of language other than Ada in -- Put all sources of language other than Ada in Source_Indexes
-- Source_Indexes.
declare declare
Local_Data : Project_Data; Local_Data : Project_Data;
...@@ -1100,7 +1103,6 @@ package body Makegpr is ...@@ -1100,7 +1103,6 @@ package body Makegpr is
if not Local_Data.Library then if not Local_Data.Library then
Source_Id := Local_Data.First_Other_Source; Source_Id := Local_Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Add_Source_Id (Proj, Source_Id); Add_Source_Id (Proj, Source_Id);
Source_Id := Project_Tree.Other_Sources.Table Source_Id := Project_Tree.Other_Sources.Table
...@@ -1129,8 +1131,8 @@ package body Makegpr is ...@@ -1129,8 +1131,8 @@ package body Makegpr is
if (not Source_Indexes (S).Found) if (not Source_Indexes (S).Found)
and then Source.Object_Path = Object_Path and then Source.Object_Path = Object_Path
then then
-- We have found the object file: get the source -- We have found the object file: get the source data,
-- data, and mark it as found. -- and mark it as found.
Source_Id := S_Id; Source_Id := S_Id;
Source_Indexes (S).Found := True; Source_Indexes (S).Found := True;
...@@ -1152,8 +1154,8 @@ package body Makegpr is ...@@ -1152,8 +1154,8 @@ package body Makegpr is
exit; exit;
end if; end if;
-- The second line is the time stamp of the object file. -- The second line is the time stamp of the object file. If
-- If there is no next line, then the dependency file is -- there is no next line, then the dependency file is
-- truncated, and the archive need to be rebuilt. -- truncated, and the archive need to be rebuilt.
if End_Of_File (File) then if End_Of_File (File) then
...@@ -1251,7 +1253,6 @@ package body Makegpr is ...@@ -1251,7 +1253,6 @@ package body Makegpr is
if not Data.Library then if not Data.Library then
Source_Id := Data.First_Other_Source; Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Source :=
Project_Tree.Other_Sources.Table (Source_Id); Project_Tree.Other_Sources.Table (Source_Id);
...@@ -1263,7 +1264,8 @@ package body Makegpr is ...@@ -1263,7 +1264,8 @@ package body Makegpr is
(Source.Object_Name, Proj) (Source.Object_Name, Proj)
then then
Add_Argument Add_Argument
(Get_Name_String (Source.Object_Path), Verbose_Mode); (Get_Name_String (Source.Object_Path),
Verbose_Mode or (First_Object = Last_Argument));
end if; end if;
Source_Id := Source.Next; Source_Id := Source.Next;
...@@ -1292,7 +1294,10 @@ package body Makegpr is ...@@ -1292,7 +1294,10 @@ package body Makegpr is
Last_Argument := Saved_Last_Argument; Last_Argument := Saved_Last_Argument;
end if; end if;
Display_Command (Archive_Builder, Archive_Builder_Path); Display_Command
(Archive_Builder,
Archive_Builder_Path,
Ellipse => True);
Spawn Spawn
(Archive_Builder_Path.all, (Archive_Builder_Path.all,
...@@ -1424,7 +1429,7 @@ package body Makegpr is ...@@ -1424,7 +1429,7 @@ package body Makegpr is
Open (File, Archive_Dep_Name); Open (File, Archive_Dep_Name);
-- If the archive dependency file does not exist, we need to -- If the archive dependency file does not exist, we need to
-- to rebuild the archive and to create its dependency file. -- rebuild the archive and to create its dependency file.
if not Is_Valid (File) then if not Is_Valid (File) then
Need_To_Rebuild := True; Need_To_Rebuild := True;
...@@ -1439,12 +1444,12 @@ package body Makegpr is ...@@ -1439,12 +1444,12 @@ package body Makegpr is
-- Put all sources of language other than Ada in Source_Indexes -- Put all sources of language other than Ada in Source_Indexes
Last_Source := 0; Last_Source := 0;
Source_Id := Data.First_Other_Source;
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Add_Source_Id (Project, Source_Id); Add_Source_Id (Project, Source_Id);
Source_Id := Project_Tree.Other_Sources.Table Source_Id :=
(Source_Id).Next; Project_Tree.Other_Sources.Table (Source_Id).Next;
end loop; end loop;
-- Read the dependency file, line by line -- Read the dependency file, line by line
...@@ -1588,15 +1593,14 @@ package body Makegpr is ...@@ -1588,15 +1593,14 @@ package body Makegpr is
Last_Argument := 0; Last_Argument := 0;
-- If there are sources in Ada, then gnatmake will build the -- If there are sources in Ada, then gnatmake will build the library,
-- library, so nothing to do. -- so nothing to do.
if not Data.Languages (Ada_Language_Index) then if not Data.Languages (Ada_Language_Index) then
-- Get all the object files of the project -- Get all the object files of the project
Source_Id := Data.First_Other_Source; Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Project_Tree.Other_Sources.Table (Source_Id); Source := Project_Tree.Other_Sources.Table (Source_Id);
Add_Argument Add_Argument
...@@ -1604,8 +1608,8 @@ package body Makegpr is ...@@ -1604,8 +1608,8 @@ package body Makegpr is
Source_Id := Source.Next; Source_Id := Source.Next;
end loop; end loop;
-- If it is a library, it need to be built it the same way -- If it is a library, it need to be built it the same way Ada
-- Ada libraries are built. -- libraries are built.
if Data.Library_Kind = Static then if Data.Library_Kind = Static then
MLib.Build_Library MLib.Build_Library
...@@ -1643,13 +1647,14 @@ package body Makegpr is ...@@ -1643,13 +1647,14 @@ package body Makegpr is
begin begin
if not Library_Options.Default then if not Library_Options.Default then
declare declare
Current : String_List_Id := Library_Options.Values; Current : String_List_Id;
Element : String_Element; Element : String_Element;
begin begin
Current := Library_Options.Values;
while Current /= Nil_String loop while Current /= Nil_String loop
Element := Project_Tree.String_Elements. Element :=
Table (Current); Project_Tree.String_Elements.Table (Current);
Get_Name_String (Element.Value); Get_Name_String (Element.Value);
if Name_Len /= 0 then if Name_Len /= 0 then
...@@ -1928,8 +1933,8 @@ package body Makegpr is ...@@ -1928,8 +1933,8 @@ package body Makegpr is
Line_Loop : loop Line_Loop : loop
declare declare
Line : constant String := Name_Buffer (1 .. Name_Len); Line : String := Name_Buffer (1 .. Name_Len);
Last : constant Natural := Name_Len; Last : Natural := Name_Len;
begin begin
Name_Loop : loop Name_Loop : loop
...@@ -1963,8 +1968,24 @@ package body Makegpr is ...@@ -1963,8 +1968,24 @@ package body Makegpr is
-- Look for the end of the source path name -- Look for the end of the source path name
Finish := Start; Finish := Start;
while Finish < Last and then Line (Finish + 1) /= ' ' loop while Finish < Last loop
if Line (Finish) = '\' then
-- When we are getting a '\' that is not the last
-- character of the line, the next character is part
-- of the path name, even if it is a space.
Line (Finish .. Last - 1) := Line (Finish + 1 .. Last);
Last := Last - 1;
else
-- A space that is not preceded by '\' indicates the
-- end of the path name.
exit when Line (Finish + 1) = ' ';
Finish := Finish + 1; Finish := Finish + 1;
end if;
end loop; end loop;
-- Check this source -- Check this source
...@@ -1973,6 +1994,7 @@ package body Makegpr is ...@@ -1973,6 +1994,7 @@ package body Makegpr is
Src_Name : constant String := Src_Name : constant String :=
Normalize_Pathname Normalize_Pathname
(Name => Line (Start .. Finish), (Name => Line (Start .. Finish),
Resolve_Links => False,
Case_Sensitive => False); Case_Sensitive => False);
Src_TS : Time_Stamp_Type; Src_TS : Time_Stamp_Type;
...@@ -2049,8 +2071,7 @@ package body Makegpr is ...@@ -2049,8 +2071,7 @@ package body Makegpr is
return; return;
end if; end if;
-- If we are here, then everything is OK, and we don't need -- If we are here, then everything is OK, no need to recompile
-- to recompile.
if Verbose_Mode then if Verbose_Mode then
Write_Line (" -> up to date"); Write_Line (" -> up to date");
...@@ -2229,8 +2250,8 @@ package body Makegpr is ...@@ -2229,8 +2250,8 @@ package body Makegpr is
Add_Argument (Dash_c, True); Add_Argument (Dash_c, True);
-- Add the compiling switches for this source found in -- Add the compiling switches for this source found in package Compiler
-- package Compiler of the project file, if they exist. -- of the project file, if they exist.
Add_Switches Add_Switches
(Data, Compiler, Source.Language, Source.File_Name); (Data, Compiler, Source.Language, Source.File_Name);
...@@ -2240,9 +2261,8 @@ package body Makegpr is ...@@ -2240,9 +2261,8 @@ package body Makegpr is
Add_Argument (Get_Name_String (Source.Path_Name), True); Add_Argument (Get_Name_String (Source.Path_Name), True);
-- If non static library project, compile with the PIC option if there -- If non static library project, compile with the PIC option if there
-- is one (when there is no PIC option, function MLib.Tgt.PIC_Option -- is one (when there is no PIC option, MLib.Tgt.PIC_Option returns an
-- returns an empty string, and Add_Argument with an empty string has -- empty string, and Add_Argument with an empty string has no effect).
-- no effect).
if Data.Library and then Data.Library_Kind /= Static then if Data.Library and then Data.Library_Kind /= Static then
Add_Argument (PIC_Option, True); Add_Argument (PIC_Option, True);
...@@ -2253,8 +2273,8 @@ package body Makegpr is ...@@ -2253,8 +2273,8 @@ package body Makegpr is
Add_Argument (Dash_o, True); Add_Argument (Dash_o, True);
Add_Argument (Get_Name_String (Source.Object_Name), True); Add_Argument (Get_Name_String (Source.Object_Name), True);
-- When compiler is GCC, use the magic switch that creates -- When compiler is GCC, use the magic switch that creates the
-- the dependency file in the correct format. -- dependency file in the correct format.
if Compiler_Is_Gcc (Source.Language) then if Compiler_Is_Gcc (Source.Language) then
Add_Argument Add_Argument
...@@ -2262,16 +2282,15 @@ package body Makegpr is ...@@ -2262,16 +2282,15 @@ package body Makegpr is
Verbose_Mode); Verbose_Mode);
end if; end if;
-- Add the compiling switches for the language specified -- Add the compiling switches for the language specified on the command
-- on the command line, if any. -- line, if any.
for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop
Add_Argument (Options (Source.Language).Table (J), True); Add_Argument (Options (Source.Language).Table (J), True);
end loop; end loop;
-- Finally, add the imported directory switches for this -- Finally, add the imported directory switches for this project file
-- project file (or, for gcc compilers, set up the CPATH env var -- (or, for gcc compilers, set up the CPATH env var if needed).
-- if needed).
Add_Search_Directories (Data, Source.Language); Add_Search_Directories (Data, Source.Language);
...@@ -2396,11 +2415,10 @@ package body Makegpr is ...@@ -2396,11 +2415,10 @@ package body Makegpr is
if not Sources_Compiled.Get (Source_Name) then if not Sources_Compiled.Get (Source_Name) then
Sources_Compiled.Set (Source_Name, True); Sources_Compiled.Set (Source_Name, True);
Source_Id := Data.First_Other_Source;
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Source := Project_Tree.Other_Sources.Table (Source_Id);
Project_Tree.Other_Sources.Table (Source_Id);
exit when Source.File_Name = Source_Name; exit when Source.File_Name = Source_Name;
Source_Id := Source.Next; Source_Id := Source.Next;
end loop; end loop;
...@@ -2626,7 +2644,7 @@ package body Makegpr is ...@@ -2626,7 +2644,7 @@ package body Makegpr is
loop loop
Data := Project_Tree.Projects.Table (Project); Data := Project_Tree.Projects.Table (Project);
if (not Data.Virtual) and then Data.Other_Sources_Present then if not Data.Virtual and then Data.Other_Sources_Present then
Source_Id := Data.First_Other_Source; Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Project_Tree.Other_Sources.Table (Source_Id); Source := Project_Tree.Other_Sources.Table (Source_Id);
...@@ -2662,12 +2680,10 @@ package body Makegpr is ...@@ -2662,12 +2680,10 @@ package body Makegpr is
Change_Dir (Get_Name_String (Data.Object_Directory)); Change_Dir (Get_Name_String (Data.Object_Directory));
Source_Id := Data.First_Other_Source;
-- Process each source one by one -- Process each source one by one
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Project_Tree.Other_Sources.Table (Source_Id); Source := Project_Tree.Other_Sources.Table (Source_Id);
Current_Source_Number := Current_Source_Number + 1; Current_Source_Number := Current_Source_Number + 1;
Need_To_Compile := Force_Compilations; Need_To_Compile := Force_Compilations;
...@@ -2750,7 +2766,7 @@ package body Makegpr is ...@@ -2750,7 +2766,7 @@ package body Makegpr is
(Name : String; (Name : String;
First_Source : Other_Source_Id) First_Source : Other_Source_Id)
is is
Source_Id : Other_Source_Id := First_Source; Source_Id : Other_Source_Id;
Source : Other_Source; Source : Other_Source;
Dep_File : Ada.Text_IO.File_Type; Dep_File : Ada.Text_IO.File_Type;
...@@ -2760,6 +2776,7 @@ package body Makegpr is ...@@ -2760,6 +2776,7 @@ package body Makegpr is
Create (Dep_File, Append_File, Name); Create (Dep_File, Append_File, Name);
Source_Id := First_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Project_Tree.Other_Sources.Table (Source_Id); Source := Project_Tree.Other_Sources.Table (Source_Id);
Put_Line (Dep_File, Get_Name_String (Source.Object_Name)); Put_Line (Dep_File, Get_Name_String (Source.Object_Name));
...@@ -2799,7 +2816,6 @@ package body Makegpr is ...@@ -2799,7 +2816,6 @@ package body Makegpr is
if not Project_Tree.Projects.Table (Project).Library then if not Project_Tree.Projects.Table (Project).Library then
Source_Id := Source_Id :=
Project_Tree.Projects.Table (Project).First_Other_Source; Project_Tree.Projects.Table (Project).First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Project_Tree.Other_Sources.Table (Source_Id); Source := Project_Tree.Other_Sources.Table (Source_Id);
...@@ -2833,8 +2849,11 @@ package body Makegpr is ...@@ -2833,8 +2849,11 @@ package body Makegpr is
procedure Display_Command procedure Display_Command
(Name : String; (Name : String;
Path : String_Access; Path : String_Access;
CPATH : String_Access := null) CPATH : String_Access := null;
Ellipse : Boolean := False)
is is
Display_Ellipse : Boolean := Ellipse;
begin begin
-- Only display the command in Verbose Mode (-v) or when -- Only display the command in Verbose Mode (-v) or when
-- not in Quiet Output (no -q). -- not in Quiet Output (no -q).
...@@ -2862,6 +2881,10 @@ package body Makegpr is ...@@ -2862,6 +2881,10 @@ package body Makegpr is
if Arguments_Displayed (Arg) then if Arguments_Displayed (Arg) then
Write_Char (' '); Write_Char (' ');
Write_Str (Arguments (Arg).all); Write_Str (Arguments (Arg).all);
elsif Display_Ellipse then
Write_Str (" ...");
Display_Ellipse := False;
end if; end if;
end loop; end loop;
...@@ -2982,13 +3005,14 @@ package body Makegpr is ...@@ -2982,13 +3005,14 @@ package body Makegpr is
--------- ---------
procedure Add (Source_Dirs : String_List_Id) is procedure Add (Source_Dirs : String_List_Id) is
Element_Id : String_List_Id := Source_Dirs; Element_Id : String_List_Id;
Element : String_Element; Element : String_Element;
Add_Arg : Boolean := True; Add_Arg : Boolean := True;
begin begin
-- Add each source directory path name, preceded by "-I" to Arguments -- Add each source directory path name, preceded by "-I" to Arguments
Element_Id := Source_Dirs;
while Element_Id /= Nil_String loop while Element_Id /= Nil_String loop
Element := Project_Tree.String_Elements.Table (Element_Id); Element := Project_Tree.String_Elements.Table (Element_Id);
...@@ -2996,6 +3020,7 @@ package body Makegpr is ...@@ -2996,6 +3020,7 @@ package body Makegpr is
Get_Name_String (Element.Value); Get_Name_String (Element.Value);
if Name_Len > 0 then if Name_Len > 0 then
-- Remove a trailing directory separator: this may cause -- Remove a trailing directory separator: this may cause
-- problems on Windows. -- problems on Windows.
...@@ -3009,8 +3034,8 @@ package body Makegpr is ...@@ -3009,8 +3034,8 @@ package body Makegpr is
Arg : constant String := Arg : constant String :=
"-I" & Name_Buffer (1 .. Name_Len); "-I" & Name_Buffer (1 .. Name_Len);
begin begin
-- Check if directory is already in the list. -- Check if directory is already in the list. If it is,
-- If it is, no need to put it again. -- no need to put it there again.
for Index in 1 .. Last_Argument loop for Index in 1 .. Last_Argument loop
if Arguments (Index).all = Arg then if Arguments (Index).all = Arg then
...@@ -3067,10 +3092,9 @@ package body Makegpr is ...@@ -3067,10 +3092,9 @@ package body Makegpr is
Recursive_Get_Dirs (Data.Extends); Recursive_Get_Dirs (Data.Extends);
Imported := Data.Imported_Projects;
-- Call itself for all imported projects, if any -- Call itself for all imported projects, if any
Imported := Data.Imported_Projects;
while Imported /= Empty_Project_List loop while Imported /= Empty_Project_List loop
Recursive_Get_Dirs Recursive_Get_Dirs
(Project_Tree.Project_Lists.Table (Project_Tree.Project_Lists.Table
...@@ -3604,13 +3628,13 @@ package body Makegpr is ...@@ -3604,13 +3628,13 @@ package body Makegpr is
if not Mains_Specified then if not Mains_Specified then
declare declare
Element_Id : String_List_Id := Data.Mains; Element_Id : String_List_Id;
Element : String_Element; Element : String_Element;
begin begin
Element_Id := Data.Mains;
while Element_Id /= Nil_String loop while Element_Id /= Nil_String loop
Element := Project_Tree.String_Elements.Table Element := Project_Tree.String_Elements.Table (Element_Id);
(Element_Id);
if Element.Value /= No_Name then if Element.Value /= No_Name then
Mains.Add_Main (Get_Name_String (Element.Value)); Mains.Add_Main (Get_Name_String (Element.Value));
...@@ -3702,10 +3726,10 @@ package body Makegpr is ...@@ -3702,10 +3726,10 @@ package body Makegpr is
Add_Str_To_Name_Buffer (Main); Add_Str_To_Name_Buffer (Main);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Main_Id := Name_Find; Main_Id := Name_Find;
Source_Id := Data.First_Other_Source;
-- Check if it is a source of a language other than Ada -- Check if it is a source of a language other than Ada
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Source :=
Project_Tree.Other_Sources.Table (Source_Id); Project_Tree.Other_Sources.Table (Source_Id);
...@@ -3840,6 +3864,7 @@ package body Makegpr is ...@@ -3840,6 +3864,7 @@ package body Makegpr is
declare declare
Main : constant String := Mains.Next_Main; Main : constant String := Mains.Next_Main;
Main_Id : Name_Id; Main_Id : Name_Id;
begin begin
exit when Main'Length = 0; exit when Main'Length = 0;
...@@ -3849,10 +3874,10 @@ package body Makegpr is ...@@ -3849,10 +3874,10 @@ package body Makegpr is
Add_Str_To_Name_Buffer (Main); Add_Str_To_Name_Buffer (Main);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Main_Id := Name_Find; Main_Id := Name_Find;
Source_Id := Data.First_Other_Source;
-- Check if it is a source of the main project file -- Check if it is a source of the main project file
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop while Source_Id /= No_Other_Source loop
Source := Source :=
Project_Tree.Other_Sources.Table (Source_Id); Project_Tree.Other_Sources.Table (Source_Id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment