Commit 65467a8a by Pascal Obry Committed by Arnaud Charlet

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
parent 01099e04
2015-05-22 Pascal Obry <obry@adacore.com> 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. * prj-util.ads, prj-util.adb (Relative_Path): New routine.
2015-05-22 Bob Duff <duff@adacore.com> 2015-05-22 Bob Duff <duff@adacore.com>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- --
...@@ -66,6 +66,10 @@ package Makeutl is ...@@ -66,6 +66,10 @@ package Makeutl is
-- Switch used to indicate that the real directories (object, exec, -- Switch used to indicate that the real directories (object, exec,
-- library, ...) are subdirectories of those in the project file. -- 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 : constant String :=
"--unchecked-shared-lib-imports"; "--unchecked-shared-lib-imports";
-- Command line switch to allow shared library projects to import projects -- Command line switch to allow shared library projects to import projects
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- 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 -- -- 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- --
...@@ -962,17 +962,39 @@ package body Prj.Conf is ...@@ -962,17 +962,39 @@ package body Prj.Conf is
-- First, find the object directory of the Conf_Project -- 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 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 else
if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then if Is_Absolute_Path (Get_Name_String (Obj_Dir.Value)) then
Get_Name_String (Obj_Dir.Value); Get_Name_String (Obj_Dir.Value);
else else
Name_Len := 0; if Obj_Root_Dir /= null then
Add_Str_To_Name_Buffer Add_Str_To_Name_Buffer (Obj_Root_Dir.all);
(Get_Name_String (Conf_Project.Directory.Display_Name)); 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)); Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value));
end if; end if;
end if; end if;
......
...@@ -5589,7 +5589,9 @@ package body Prj.Nmsc is ...@@ -5589,7 +5589,9 @@ package body Prj.Nmsc is
end if; end if;
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_Len := 1;
Name_Buffer (1) := '.'; Name_Buffer (1) := '.';
Locate_Directory Locate_Directory
...@@ -6204,7 +6206,35 @@ package body Prj.Nmsc is ...@@ -6204,7 +6206,35 @@ package body Prj.Nmsc is
The_Name : File_Name_Type; The_Name : File_Name_Type;
begin 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 -- Add Subdirs.all if it is a directory that may be created and
-- Subdirs is not null; -- Subdirs is not null;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- --
...@@ -61,6 +61,17 @@ package Prj is ...@@ -61,6 +61,17 @@ package Prj is
-- The value after the equal sign in switch --subdirs=... -- The value after the equal sign in switch --subdirs=...
-- Contains the relative subdirectory. -- 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); type Library_Support is (None, Static_Only, Full);
-- Support for Library Project File. -- Support for Library Project File.
-- - None: Library Project Files are not supported at all -- - None: Library Project Files are not supported at all
......
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