OSDN Git Service

* targhooks.c (default_stack_protect_guard): Avoid sharing RTL
[pf3gnuchains/gcc-fork.git] / gcc / ada / clean.adb
index 64f8045..978a5e7 100644 (file)
@@ -35,6 +35,7 @@ with Prj;      use Prj;
 with Prj.Env;
 with Prj.Ext;
 with Prj.Pars;
+with Prj.Tree; use Prj.Tree;
 with Prj.Util; use Prj.Util;
 with Snames;
 with Switch;   use Switch;
@@ -90,7 +91,7 @@ package body Clean is
 
    Project_File_Name : String_Access := null;
 
-   Project_Tree : constant Prj.Project_Tree_Ref := new Prj.Project_Tree_Data;
+   Project_Node_Tree : Project_Node_Tree_Ref;
 
    Main_Project : Prj.Project_Id := Prj.No_Project;
 
@@ -1044,7 +1045,19 @@ package body Clean is
                   begin
                      Proj := Project_Tree.Projects;
                      while Proj /= null loop
-                        if Has_Foreign_Sources (Proj.Project) then
+
+                        --  For gnatmake, when the project specifies more than
+                        --  just Ada as a language (even if course we could not
+                        --  find any source file for the other languages), we
+                        --  will take all the object files found in the object
+                        --  directories. Since we know the project supports at
+                        --  least Ada, we just have to test whether it has at
+                        --  least two languages, and we do not care about the
+                        --  sources.
+
+                        if Proj.Project.Languages /= null
+                          and then Proj.Project.Languages.Next /= null
+                        then
                            Global_Archive := True;
                            exit;
                         end if;
@@ -1390,7 +1403,9 @@ package body Clean is
          Prj.Pars.Parse
            (Project           => Main_Project,
             In_Tree           => Project_Tree,
+            In_Node_Tree      => Project_Node_Tree,
             Project_File_Name => Project_File_Name.all,
+            Flags             => Gnatmake_Flags,
             Packages_To_Check => Packages_To_Check_By_Gnatmake);
 
          if Main_Project = No_Project then
@@ -1543,6 +1558,10 @@ package body Clean is
          Csets.Initialize;
          Namet.Initialize;
          Snames.Initialize;
+
+         Project_Node_Tree := new Project_Node_Tree_Data;
+         Prj.Tree.Initialize (Project_Node_Tree);
+
          Prj.Initialize (Project_Tree);
 
          --  Check if the platform is VMS and, if it is, change some variables
@@ -1672,7 +1691,7 @@ package body Clean is
 
                         elsif Arg (3) = 'P' then
                            Prj.Ext.Add_Search_Project_Directory
-                             (Arg (4 .. Arg'Last));
+                             (Project_Node_Tree, Arg (4 .. Arg'Last));
 
                         else
                            Bad_Argument;
@@ -1721,6 +1740,7 @@ package body Clean is
                      when 'e' =>
                         if Arg = "-eL" then
                            Follow_Links_For_Files := True;
+                           Follow_Links_For_Dirs  := True;
 
                         else
                            Bad_Argument;
@@ -1860,7 +1880,8 @@ package body Clean is
 
                            if OK then
                               Prj.Ext.Add
-                                (External_Name =>
+                                (Project_Node_Tree,
+                                 External_Name =>
                                    Ext_Asgn (Start .. Equal_Pos - 1),
                                  Value         =>
                                    Ext_Asgn (Equal_Pos + 1 .. Stop));