aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/make.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2003-11-27 12:40:45 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2003-11-27 12:40:45 +0100
commit81a5b587efda1d6462869fcbb78379fe99d35351 (patch)
tree900429240d553526e03379183533d6964ac0cf18 /gcc/ada/make.adb
parentf4314bb628aa9f5ef498ab7891354f03ed32f4ac (diff)
downloadgcc-81a5b587efda1d6462869fcbb78379fe99d35351.zip
gcc-81a5b587efda1d6462869fcbb78379fe99d35351.tar.gz
gcc-81a5b587efda1d6462869fcbb78379fe99d35351.tar.bz2
[multiple changes]
2003-11-26 Thomas Quinot <quinot@act-europe.fr> * g-socket.ads, g-socket.adb: Clarify documentation of function Stream. Introduce a Free procedure to release the returned Stream once it becomes unused. * 5asystem.ads: For Alpha Tru64, enable ZCX by default. 2003-11-26 Arnaud Charlet <charlet@act-europe.fr> (Cond_Timed_Wait): Introduce new constant Time_Out_Max, since NT 4 cannot handle timeout values that are too large, e.g. DWORD'Last - 1. 2003-11-26 Ed Schonberg <schonberg@gnat.com> * exp_ch4.adb: (Expand_N_Slice): Recognize all cases of slices that appear as actuals in procedure calls and whose expansion must be deferred. * exp_ch6.adb (Add_Call_By_Copy_Node): Remove previous fix. Proper fix is in exp_ch4. * sem_ch3.adb: (Build_Derived_Array_Type): Create operator for unconstrained type if ancestor is unconstrained. 2003-11-26 Vincent Celier <celier@gnat.com> * make.adb (Project_Object_Directory): New global variable (Change_To_Object_Directory): New procedure (Collect_Arguments_And_Compile): Call Change_To_Object_Directory instead of Change_Dir directly. Do not change working directory to object directory of main project after each compilation. (Gnatmake): Use Change_To_Object_Directory instead of Change_Dir directly. Change to object directory of main project before binding step. (Initialize): Initialize Project_Object_Directory to No_Project * mlib-prj.adb: (Build_Library): Take into account Builder'Default_Switches ("Ada") when binding a Stand-Alone Library. * output.adb: Update Copyright notice (Write_Char): Output buffer when full 2003-11-26 Robert Dewar <dewar@gnat.com> * sem_ch13.adb: (Check_Size): Reset size if size is too small * sem_ch13.ads: (Check_Size): Fix documentation to include bit-packed array case * sem_res.adb: Implement restriction No_Direct_Boolean_Operators * s-rident.ads: Put No_Direct_Boolean_Operators in proper order * s-rident.ads: Add new restriction No_Direct_Boolean_Operators From-SVN: r73991
Diffstat (limited to 'gcc/ada/make.adb')
-rw-r--r--gcc/ada/make.adb78
1 files changed, 61 insertions, 17 deletions
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 1a58a82..a304f10 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -312,6 +312,11 @@ package body Make is
Main_Project : Prj.Project_Id := No_Project;
-- The project id of the main project file, if any
+ Project_Object_Directory : Project_Id := No_Project;
+ -- The object directory of the project for the last compilation.
+ -- Avoid calling Change_Dir if the current working directory is already
+ -- this directory
+
-- Packages of project files where unknown attributes are errors.
Naming_String : aliased String := "naming";
@@ -344,6 +349,10 @@ package body Make is
procedure Add_Object_Directories is
new Prj.Env.For_All_Object_Dirs (Action => Add_Object_Dir);
+ procedure Change_To_Object_Directory (Project : Project_Id);
+ -- Change to the object directory of project Project, if this is not
+ -- already the current working directory.
+
type Bad_Compilation_Info is record
File : File_Name_Type;
Unit : Unit_Name_Type;
@@ -1107,6 +1116,36 @@ package body Make is
end if;
end Bind;
+ --------------------------------
+ -- Change_To_Object_Directory --
+ --------------------------------
+
+ procedure Change_To_Object_Directory (Project : Project_Id) is
+ begin
+ -- Nothing to do if the current working directory is alresdy the one
+ -- we want.
+
+ if Project_Object_Directory /= Project then
+ Project_Object_Directory := Project;
+
+ -- If in a real project, set the working directory to the object
+ -- directory of the project.
+
+ if Project /= No_Project then
+ Change_Dir
+ (Get_Name_String (Projects.Table (Project).Object_Directory));
+
+ -- Otherwise, for sources outside of any project, set the working
+ -- directory to the object directory of the main project.
+
+ elsif Main_Project /= No_Project then
+ Change_Dir
+ (Get_Name_String
+ (Projects.Table (Main_Project).Object_Directory));
+ end if;
+ end if;
+ end Change_To_Object_Directory;
+
-----------
-- Check --
-----------
@@ -2204,28 +2243,23 @@ package body Make is
end;
end if;
- -- Change to the object directory of the project file, if it is
- -- not the main project file.
+ -- Change to the object directory of the project file,
+ -- if necessary.
- if Arguments_Project /= Main_Project then
- Change_Dir
- (Get_Name_String
- (Projects.Table (Arguments_Project).Object_Directory));
- end if;
+ Change_To_Object_Directory (Arguments_Project);
Pid := Compile (Arguments_Path_Name, Lib_File,
Arguments (1 .. Last_Argument));
- -- Change back to the object directory of the main project file,
- -- if necessary.
+ else
+ -- If this is a source outside of any project file, make sure
+ -- it will be compiled in the object directory of the main project
+ -- file.
- if Arguments_Project /= Main_Project then
- Change_Dir
- (Get_Name_String
- (Projects.Table (Main_Project).Object_Directory));
+ if Main_Project /= No_Project then
+ Change_To_Object_Directory (Arguments_Project);
end if;
- else
Pid := Compile (Full_Source_File, Lib_File,
Arguments (1 .. Last_Argument));
end if;
@@ -3761,9 +3795,8 @@ package body Make is
-- project.
begin
- Change_Dir
- (Get_Name_String
- (Projects.Table (Main_Project).Object_Directory));
+ Project_Object_Directory := No_Project;
+ Change_To_Object_Directory (Main_Project);
exception
when Directory_Error =>
@@ -4623,6 +4656,13 @@ package body Make is
end Recursive_Compilation_Step;
end if;
+ -- For binding and linking, we need to be in the object directory of
+ -- the main project.
+
+ if Main_Project /= No_Project then
+ Change_To_Object_Directory (Main_Project);
+ end if;
+
-- If we are here, it means that we need to rebuilt the current
-- main. So we set Executable_Obsolete to True to make sure that
-- the subsequent mains will be rebuilt.
@@ -5713,6 +5753,10 @@ package body Make is
end;
end if;
+ -- Make sure no project object directory is recorded
+
+ Project_Object_Directory := No_Project;
+
-- Set the marking label to a value that is not zero
Marking_Label := 1;