+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.
-- --
-- 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- --
-- 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
-- --
-- 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- --
-- 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;
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
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;
-- --
-- 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- --
-- 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