aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Obry <obry@adacore.com>2015-05-22 10:40:07 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2015-05-22 12:40:07 +0200
commit65467a8a46794a8010c95428b01a6887acdec258 (patch)
tree7723c3cdcc5c84f545478d1c05eaca7a219bd5ee
parent01099e0465b7851cc5096c58f7b7155937d44960 (diff)
downloadgcc-65467a8a46794a8010c95428b01a6887acdec258.zip
gcc-65467a8a46794a8010c95428b01a6887acdec258.tar.gz
gcc-65467a8a46794a8010c95428b01a6887acdec258.tar.bz2
makeutl.ads (In_Place_Option): New constant.
2015-05-22 Pascal Obry <obry@adacore.com> * 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
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/makeutl.ads6
-rw-r--r--gcc/ada/prj-conf.adb32
-rw-r--r--gcc/ada/prj-nmsc.adb34
-rw-r--r--gcc/ada/prj.ads13
5 files changed, 88 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 0df6bd3..314aeff 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,17 @@
2015-05-22 Pascal Obry <obry@adacore.com>
+ * 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 <obry@adacore.com>
+
* prj-util.ads, prj-util.adb (Relative_Path): New routine.
2015-05-22 Bob Duff <duff@adacore.com>
diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads
index cf28b1e..5a318aa 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 9c83902..29217a7 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 7b3d337..5d209ec 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 ac55681..4910331 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