From: Pascal Obry Date: Fri, 22 May 2015 10:40:07 +0000 (+0000) Subject: makeutl.ads (In_Place_Option): New constant. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=65467a8a46794a8010c95428b01a6887acdec258;p=gcc.git makeutl.ads (In_Place_Option): New constant. 2015-05-22 Pascal Obry * makeutl.ads (In_Place_Option): New constant. * prj.ads (Obj_Root_Dir): New variable (absolute path to relocate objects). (Root_Src_Tree): New variable (absolute path of root source tree). * prj-conf.adb (Do_Autoconf): Take into account the object root directory (if defined) to generate configuration project. * prj-nmsc.adb (Get_Directories): Handle case where Obj_Root_Dir is defined. (Locate_Directory): Likewise. From-SVN: r223543 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0df6bd3da3d..314aeffd262 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2015-05-22 Pascal Obry + + * makeutl.ads (In_Place_Option): New constant. + * prj.ads (Obj_Root_Dir): New variable (absolute path to relocate + objects). + (Root_Src_Tree): New variable (absolute path of root source tree). + * prj-conf.adb (Do_Autoconf): Take into account the object root + directory (if defined) to generate configuration project. + * prj-nmsc.adb (Get_Directories): Handle case where Obj_Root_Dir + is defined. + (Locate_Directory): Likewise. + 2015-05-22 Pascal Obry * prj-util.ads, prj-util.adb (Relative_Path): New routine. diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads index cf28b1ec1da..5a318aacf17 100644 --- a/gcc/ada/makeutl.ads +++ b/gcc/ada/makeutl.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2015, Free Software Foundation, Inc. -- -- -- -- 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- -- @@ -66,6 +66,10 @@ package Makeutl is -- Switch used to indicate that the real directories (object, exec, -- library, ...) are subdirectories of those in the project file. + In_Place_Option : constant String := "--in-place"; + -- Switch to build out-of-tree. In this context the object, exec and + -- library directories are relocated to the current working directory. + Unchecked_Shared_Lib_Imports : constant String := "--unchecked-shared-lib-imports"; -- Command line switch to allow shared library projects to import projects diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb index 9c83902d3e1..29217a7ef4e 100644 --- a/gcc/ada/prj-conf.adb +++ b/gcc/ada/prj-conf.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2006-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 2006-2015, Free Software Foundation, Inc. -- -- -- -- 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- -- @@ -962,17 +962,39 @@ package body Prj.Conf is -- First, find the object directory of the Conf_Project + -- If the object directory is a relative one and Obj_Root_Dir is set, + -- first add it. + + Name_Len := 0; + if Obj_Dir = Nil_Variable_Value or else Obj_Dir.Default then - Get_Name_String (Conf_Project.Directory.Display_Name); + + if Obj_Root_Dir /= null then + Add_Str_To_Name_Buffer (Obj_Root_Dir.all); + Add_Str_To_Name_Buffer + (Relative_Path + (Get_Name_String (Conf_Project.Directory.Display_Name), + Root_Src_Tree.all)); + else + Get_Name_String (Conf_Project.Directory.Display_Name); + end if; else if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then Get_Name_String (Obj_Dir.Value); else - Name_Len := 0; - Add_Str_To_Name_Buffer - (Get_Name_String (Conf_Project.Directory.Display_Name)); + if Obj_Root_Dir /= null then + Add_Str_To_Name_Buffer (Obj_Root_Dir.all); + Add_Str_To_Name_Buffer + (Relative_Path + (Get_Name_String (Conf_Project.Directory.Display_Name), + Root_Src_Tree.all)); + else + Add_Str_To_Name_Buffer + (Get_Name_String (Conf_Project.Directory.Display_Name)); + end if; + Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value)); end if; end if; diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 7b3d3371c54..5d209ec71d8 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -5589,7 +5589,9 @@ package body Prj.Nmsc is end if; end if; - elsif not No_Sources and then Subdirs /= null then + elsif not No_Sources + and then (Subdirs /= null or else Obj_Root_Dir /= null) + then Name_Len := 1; Name_Buffer (1) := '.'; Locate_Directory @@ -6204,7 +6206,35 @@ package body Prj.Nmsc is The_Name : File_Name_Type; begin - Get_Name_String (Name); + -- Check if we have a root-object dir specified, if so relocate all + -- artefact directories to it. + + if Obj_Root_Dir /= null + and then Create /= "" + and then not Is_Absolute_Path (Get_Name_String (Name)) + then + Name_Len := 0; + Add_Str_To_Name_Buffer (Obj_Root_Dir.all); + Add_Str_To_Name_Buffer + (Relative_Path + (The_Parent (The_Parent'First .. The_Parent_Last), + Root_Src_Tree.all)); + Add_Str_To_Name_Buffer (Get_Name_String (Name)); + + else + if Obj_Root_Dir /= null and then Create /= "" then + + -- Issue a warning that we cannot relocate absolute obj dir + + Err_Vars.Error_Msg_File_1 := Name; + Error_Or_Warning + (Data.Flags, Warning, + "{ cannot relocate absolute object directory", + No_Location, Project); + end if; + + Get_Name_String (Name); + end if; -- Add Subdirs.all if it is a directory that may be created and -- Subdirs is not null; diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index ac55681e657..4910331c484 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2015, Free Software Foundation, Inc. -- -- -- -- 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- -- @@ -61,6 +61,17 @@ package Prj is -- The value after the equal sign in switch --subdirs=... -- Contains the relative subdirectory. + Obj_Root_Dir : String_Ptr := null; + -- A root directory for building out-of-tree projects. All relative object + -- directories will be rooted at this location. If Subdirs is also set it + -- will be added at the end too. + + Root_Src_Tree : String_Ptr := null; + -- When using out-of-tree build we need to keep information about the root + -- directory source tree to properly relocate all projects to this root + -- directory. Note that the root source directory is not necessary the + -- directory of the main project. + type Library_Support is (None, Static_Only, Full); -- Support for Library Project File. -- - None: Library Project Files are not supported at all