-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
Process_Created : Boolean := False;
procedure Add_Process
- (Pid : Process_Id;
- Sfile : File_Name_Type;
- Afile : File_Name_Type;
- Uname : Unit_Name_Type;
- Mfile : Natural := No_Mapping_File);
+ (Pid : Process_Id;
+ Sfile : File_Name_Type;
+ Afile : File_Name_Type;
+ Uname : Unit_Name_Type;
+ Mfile : Natural := No_Mapping_File);
-- Adds process Pid to the current list of outstanding compilation
-- processes and record the full name of the source file Sfile that
-- we are compiling, the name of its library file Afile and the
-- Check if s-stalib.adb needs to be compiled
procedure Collect_Arguments_And_Compile
- (Source_File : File_Name_Type; Source_Index : Int);
+ (Source_File : File_Name_Type;
+ Source_Index : Int);
-- Collect arguments from project file (if any) and compile
function Compile
-----------------
procedure Add_Process
- (Pid : Process_Id;
- Sfile : File_Name_Type;
- Afile : File_Name_Type;
- Uname : Unit_Name_Type;
- Mfile : Natural := No_Mapping_File)
+ (Pid : Process_Id;
+ Sfile : File_Name_Type;
+ Afile : File_Name_Type;
+ Uname : Unit_Name_Type;
+ Mfile : Natural := No_Mapping_File)
is
OC1 : constant Positive := Outstanding_Compiles + 1;
-----------------------------------
procedure Collect_Arguments_And_Compile
- (Source_File : File_Name_Type; Source_Index : Int)
+ (Source_File : File_Name_Type;
+ Source_Index : Int)
is
begin
-- Process_Created will be set True if an attempt is made to compile
Collect_Arguments (Source_File, Source_Index, Args);
end if;
+ -- For VMS, when compiling the main source, add switch
+ -- -mdebug-main=_ada_ so that the executable can be debugged
+ -- by the standard VMS debugger.
+
+ if not No_Main_Subprogram
+ and then Targparm.OpenVMS_On_Target
+ and then Source_File = Main_Source
+ then
+ -- First, check if compilation will be invoked with -g
+
+ for J in 1 .. Last_Argument loop
+ if Arguments (J)'Length >= 2
+ and then Arguments (J) (1 .. 2) = "-g"
+ and then (Arguments (J)'Length < 5
+ or else Arguments (J) (1 .. 5) /= "-gnat")
+ then
+ Add_Arguments
+ ((1 => new String'("-mdebug-main=_ada_")));
+ exit;
+ end if;
+ end loop;
+ end if;
+
-- If we use mapping file (-P or -C switches), then get one
if Create_Mapping_File then
Make_Failed ("-B cannot be used for a library project file");
else
+ No_Main_Subprogram := True;
Insert_Project_Sources
(The_Project => Main_Project,
All_Projects => Unique_Compile_All_Projects,
-- Put all the sources in the queue
+ No_Main_Subprogram := True;
Insert_Project_Sources
(The_Project => Main_Project,
All_Projects => Unique_Compile_All_Projects,
Write_Str ("GNATMAKE ");
Write_Str (Gnatvsn.Gnat_Version_String);
Write_Eol;
- Write_Str ("Copyright 1995-2004 Free Software Foundation, Inc.");
+ Write_Str
+ ("Copyright 1995-" &
+ Current_Year &
+ ", Free Software Foundation, Inc.");
Write_Eol;
end if;
for J in 1 .. Library_Projs.Last loop
Library_Rebuilt := True;
+
+ -- If a library is rebuilt, then executables are obsolete
+
+ Executable_Obsolete := True;
+
MLib.Prj.Build_Library
(For_Project => Library_Projs.Table (J),
In_Tree => Project_Tree,
-- 4) Made unit cannot be a main unit
- if (Do_Not_Execute
- or List_Dependencies
- or not Do_Bind_Step
- or not Is_Main_Unit)
- and then not No_Main_Subprogram
- and then not Build_Bind_And_Link_Full_Project
+ if ((Do_Not_Execute
+ or List_Dependencies
+ or not Do_Bind_Step
+ or not Is_Main_Unit)
+ and then not No_Main_Subprogram
+ and then not Build_Bind_And_Link_Full_Project)
+ or else Unique_Compile
then
if Osint.Number_Of_Files = 1 then
exit Multiple_Main_Loop;
while Options /= Nil_String loop
Option :=
In_Tree.String_Elements.Table (Options).Value;
+ Get_Name_String (Option);
+
+ -- Do not consider empty linker options
+
+ if Name_Len /= 0 then
+ Add_Linker_Option (Name_Buffer (1 .. Name_Len));
+
+ -- Object files and -L switches specified with relative
+ -- paths must be converted to absolute paths.
+
+ Test_If_Relative_Path
+ (Switch =>
+ Linker_Options_Buffer (Last_Linker_Option),
+ Parent =>
+ In_Tree.Projects.Table (Proj).Dir_Path,
+ Including_L_Switch => True);
+ end if;
+
Options :=
In_Tree.String_Elements.Table (Options).Next;
- Add_Linker_Option (Get_Name_String (Option));
-
- -- Object files and -L switches specified with
- -- relative paths and must be converted to
- -- absolute paths.
-
- Test_If_Relative_Path
- (Switch =>
- Linker_Options_Buffer (Last_Linker_Option),
- Parent =>
- In_Tree.Projects.Table (Proj).Dir_Path,
- Including_L_Switch => True);
end loop;
end;
end loop;