-- --
-- B o d y --
-- --
--- --
--- Copyright (C) 1997-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, 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- --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
--- Program to create, set, or delete an alternate runtime library.
+-- Program to create, set, or delete an alternate runtime library
-- Works by calling an appropriate target specific Makefile residing
-- in the default library object (e.g. adalib) directory from the context
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;
+with Gnatvsn; use Gnatvsn;
with Interfaces.C_Streams; use Interfaces.C_Streams;
with Osint; use Osint;
-with Sdefault; use Sdefault;
with System;
procedure GnatLbr is
+ pragma Ident (Gnat_Static_Version_String);
type Lib_Mode is (None, Create, Set, Delete);
Next_Arg : Integer;
Make_Path : String_Access;
procedure Create_Directory (Name : System.Address; Mode : Integer);
- pragma Import (C, Create_Directory, "mkdir");
+ pragma Import (C, Create_Directory, "decc$mkdir");
begin
if Argument_Count = 0 then
exit when Next_Arg > Argument_Count;
Process_One_Arg : declare
- Arg : String := Argument (Next_Arg);
+ Arg : constant String := Argument (Next_Arg);
begin
-
if Arg'Length > 9 and then Arg (1 .. 9) = "--create=" then
if Mode = None then
Mode := Create;
-- there are two.
--
Include_Dirs := 0;
- Include_Dir_Name := String_Access (Include_Dir_Default_Name);
- Get_Next_Dir_In_Path_Init (String_Access (Include_Dir_Name));
+ Include_Dir_Name := new String'(Include_Dir_Default_Prefix);
+ Get_Next_Dir_In_Path_Init (Include_Dir_Name);
loop
declare
- Dir : String_Access := String_Access
- (Get_Next_Dir_In_Path (String_Access (Include_Dir_Name)));
+ Dir : constant String_Access := String_Access
+ (Get_Next_Dir_In_Path (Include_Dir_Name));
begin
exit when Dir = null;
Include_Dirs := Include_Dirs + 1;
- Include_Dir (Include_Dirs)
- := String_Access (Normalize_Directory_Name (Dir.all));
+ Include_Dir (Include_Dirs) :=
+ String_Access (Normalize_Directory_Name (Dir.all));
end;
end loop;
Object_Dirs := 0;
- Object_Dir_Name := String_Access (Object_Dir_Default_Name);
- Get_Next_Dir_In_Path_Init (String_Access (Object_Dir_Name));
+ Object_Dir_Name := new String'(Object_Dir_Default_Prefix);
+ Get_Next_Dir_In_Path_Init (Object_Dir_Name);
loop
declare
- Dir : String_Access := String_Access
- (Get_Next_Dir_In_Path (String_Access (Object_Dir_Name)));
+ Dir : constant String_Access :=
+ String_Access
+ (Get_Next_Dir_In_Path (Object_Dir_Name));
begin
exit when Dir = null;
Object_Dirs := Object_Dirs + 1;
end;
end loop;
- -- "Make" an alternate sublibrary for each default sublibrary.
+ -- "Make" an alternate sublibrary for each default sublibrary
for Dirs in 1 .. Object_Dirs loop
-
Make_Args (1) :=
new String'("-C");
& F_ADC_File (1 .. F_ADC_File_Len));
Make_Args (6) :=
- new String'("LIBRARY_VERSION=" & '"' & Library_Version & '"');
+ new String'("LIBRARY_VERSION=" & '"' &
+ Verbose_Library_Version & '"');
Make_Args (7) :=
new String'("-f");
Make_Path := Locate_Exec_On_Path (Make);
Put (Make);
- for I in 1 .. Make_Args'Last loop
+ for J in 1 .. Make_Args'Last loop
Put (" ");
- Put (Make_Args (I).all);
+ Put (Make_Args (J).all);
end loop;
New_Line;
Spawn (Make_Path.all, Make_Args, Success);
+
if not Success then
Put_Line (Standard_Error, "Error: Make failed");
Exit_Program (E_Fatal);
when Set =>
- -- Validate arguments.
+ -- Validate arguments
if Lib_Dir = null then
Put_Line (Standard_Error,
Exit_Program (E_Fatal);
end if;
- -- Give instructions.
+ -- Give instructions
Put_Line ("Copy the contents of "
& ADC_File.all & " into your GNAT.ADC file");
when Delete =>
- -- Give instructions.
+ -- Give instructions
Put_Line ("GNAT Librarian DELETE not yet implemented.");
Put_Line ("Use appropriate system tools to remove library");