Commit e06a584e by Arnaud Charlet

make.adb (Gnatmake): Do not fail when the main project has no object directory.

	* make.adb (Gnatmake): Do not fail when the main project has no object
	directory.

From-SVN: r94817
parent 5f57ad31
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -4079,63 +4079,65 @@ package body Make is ...@@ -4079,63 +4079,65 @@ package body Make is
if Main_Project /= No_Project then if Main_Project /= No_Project then
if Projects.Table (Main_Project).Object_Directory = No_Name then if Projects.Table (Main_Project).Object_Directory /= No_Name then
Make_Failed ("no sources to compile");
end if;
-- Change the current directory to the object directory of the main -- Change the current directory to the object directory of
-- project. -- the main project.
begin begin
Project_Object_Directory := No_Project; Project_Object_Directory := No_Project;
Change_To_Object_Directory (Main_Project); Change_To_Object_Directory (Main_Project);
exception exception
when Directory_Error => when Directory_Error =>
-- This should never happen. But, if it does, display the -- This should never happen. But, if it does, display the
-- content of the parent directory of the obj dir. -- content of the parent directory of the obj dir.
declare declare
Parent : constant Dir_Name_Str := Parent : constant Dir_Name_Str :=
Dir_Name Dir_Name
(Get_Name_String (Get_Name_String
(Projects.Table (Main_Project).Object_Directory)); (Projects.Table
Dir : Dir_Type; (Main_Project).Object_Directory));
Str : String (1 .. 200);
Last : Natural;
begin Dir : Dir_Type;
Write_Str ("Contents of directory """); Str : String (1 .. 200);
Write_Str (Parent); Last : Natural;
Write_Line (""":");
Open (Dir, Parent); begin
Write_Str ("Contents of directory """);
Write_Str (Parent);
Write_Line (""":");
loop Open (Dir, Parent);
Read (Dir, Str, Last);
exit when Last = 0;
Write_Str (" ");
Write_Line (Str (1 .. Last));
end loop;
Close (Dir); loop
Read (Dir, Str, Last);
exit when Last = 0;
Write_Str (" ");
Write_Line (Str (1 .. Last));
end loop;
exception Close (Dir);
when X : others =>
Write_Line ("(unexpected exception)");
Write_Line (Exception_Information (X));
if Is_Open (Dir) then exception
Close (Dir); when X : others =>
end if; Write_Line ("(unexpected exception)");
end; Write_Line (Exception_Information (X));
Make_Failed ("unable to change working directory to """, if Is_Open (Dir) then
Get_Name_String Close (Dir);
(Projects.Table (Main_Project).Object_Directory), end if;
""""); end;
end;
Make_Failed
("unable to change working directory to """,
Get_Name_String
(Projects.Table (Main_Project).Object_Directory),
"""");
end;
end if;
-- Source file lookups should be cached for efficiency. -- Source file lookups should be cached for efficiency.
-- Source files are not supposed to change. -- Source files are not supposed to change.
......
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