OSDN Git Service

2007-08-31 Hristian Kirtchev <kirtchev@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / mlib.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                                 M L I B                                  --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                     Copyright (C) 1999-2007, AdaCore                     --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  This package provides the core high level routines used by GNATMLIB
28 --  and GNATMAKE to build libraries
29
30 with Namet; use Namet;
31 with Osint; use Osint;
32
33 with GNAT.OS_Lib; use GNAT.OS_Lib;
34
35 package MLib is
36
37    No_Argument_List : aliased String_List := (1 .. 0 => null);
38    No_Argument      : constant String_List_Access := No_Argument_List'Access;
39
40    Max_Characters_In_Library_Name : constant := 20;
41    --  Maximum number of characters in a library name.
42    --  Used by Check_Library_Name below.
43
44    type Fail_Proc is access procedure
45      (S1 : String; S2 : String := ""; S3 : String := "");
46
47    Fail : Fail_Proc := Osint.Fail'Access;
48    --  This procedure is used in the MLib hierarchy, instead of
49    --  directly calling Osint.Fail.
50    --  It is redirected to Make.Make_Failed by gnatmake.
51
52    procedure Check_Library_Name (Name : String);
53    --  Verify that the name of a library has the following characteristics
54    --   - starts with a letter
55    --   - includes only letters and digits
56    --   - contains not more than Max_Characters_In_Library_Name characters
57
58    procedure Build_Library
59      (Ofiles      : Argument_List;
60       Output_File : String;
61       Output_Dir  : String);
62    --  Build a static library from a set of object files
63
64    procedure Copy_ALI_Files
65      (Files      : Argument_List;
66       To         : Path_Name_Type;
67       Interfaces : String_List);
68    --  Copy all ALI files Files to directory To.
69    --  Mark Interfaces ALI files as interfaces, if any.
70
71    procedure Create_Sym_Links
72      (Lib_Path    : String;
73       Lib_Version : String;
74       Lib_Dir     : String;
75       Maj_Version : String);
76
77    function Linker_Library_Path_Option return String_Access;
78    --  Linker option to specify to the linker the library directory path.
79    --  If non null, the library directory path is to be appended.
80    --  Should be deallocated by the caller, when no longer needed.
81
82    function Major_Id_Name
83      (Lib_Filename : String;
84       Lib_Version  : String) return String;
85    --  Returns the major id library file name, if it exists.
86    --  For example, if Lib_Filename is "libtoto.so" and Lib_Version is
87    --  "libtoto.so.1.2", then "libtoto.so.1" is returned.
88
89 private
90
91    Preserve : Attribute := Time_Stamps;
92    --  Used by Copy_ALI_Files. Changed to None for OpenVMS, because
93    --  Copy_Attributes always fails on VMS.
94
95 end MLib;