OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / ada / mlib-tgt-specific-mingw.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                    M L I B . T G T . S P E C I F I C                     --
6 --                            (Windows Version)                             --
7 --                                                                          --
8 --                                 B o d y                                  --
9 --                                                                          --
10 --          Copyright (C) 2002-2010, Free Software Foundation, Inc.         --
11 --                                                                          --
12 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
20 -- http://www.gnu.org/licenses for a complete copy of the license.          --
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 is the Windows version of the body. Works only with GCC versions
28 --  supporting the "-shared" option.
29
30 with Opt;
31 with Output; use Output;
32
33 with MLib.Fil;
34 with MLib.Utl;
35
36 package body MLib.Tgt.Specific is
37
38    package Files renames MLib.Fil;
39    package Tools renames MLib.Utl;
40
41    --  Non default subprograms
42
43    procedure Build_Dynamic_Library
44      (Ofiles       : Argument_List;
45       Options      : Argument_List;
46       Interfaces   : Argument_List;
47       Lib_Filename : String;
48       Lib_Dir      : String;
49       Symbol_Data  : Symbol_Record;
50       Driver_Name  : Name_Id := No_Name;
51       Lib_Version  : String  := "";
52       Auto_Init    : Boolean := False);
53
54    function DLL_Ext return String;
55
56    function DLL_Prefix return String;
57
58    function Is_Archive_Ext (Ext : String) return Boolean;
59
60    function Library_Major_Minor_Id_Supported return Boolean;
61
62    function PIC_Option return String;
63
64    Shared_Libgcc : aliased String := "-shared-libgcc";
65
66    Shared_Libgcc_Switch : constant Argument_List :=
67                             (1 => Shared_Libgcc'Access);
68
69    ---------------------------
70    -- Build_Dynamic_Library --
71    ---------------------------
72
73    procedure Build_Dynamic_Library
74      (Ofiles       : Argument_List;
75       Options      : Argument_List;
76       Interfaces   : Argument_List;
77       Lib_Filename : String;
78       Lib_Dir      : String;
79       Symbol_Data  : Symbol_Record;
80       Driver_Name  : Name_Id := No_Name;
81       Lib_Version  : String  := "";
82       Auto_Init    : Boolean := False)
83    is
84       pragma Unreferenced (Symbol_Data);
85       pragma Unreferenced (Interfaces);
86       pragma Unreferenced (Lib_Version);
87       pragma Unreferenced (Auto_Init);
88
89       Lib_File : constant String :=
90                    Lib_Dir & Directory_Separator &
91                    DLL_Prefix & Files.Append_To (Lib_Filename, DLL_Ext);
92
93    --  Start of processing for Build_Dynamic_Library
94
95    begin
96       if Opt.Verbose_Mode then
97          Write_Str ("building relocatable shared library ");
98          Write_Line (Lib_File);
99       end if;
100
101       Tools.Gcc
102         (Output_File => Lib_File,
103          Objects     => Ofiles,
104          Options     => Shared_Libgcc_Switch,
105          Options_2   => Options,
106          Driver_Name => Driver_Name);
107    end Build_Dynamic_Library;
108
109    -------------
110    -- DLL_Ext --
111    -------------
112
113    function DLL_Ext return String is
114    begin
115       return "dll";
116    end DLL_Ext;
117
118    ----------------
119    -- DLL_Prefix --
120    ----------------
121
122    function DLL_Prefix return String is
123    begin
124       return "lib";
125    end DLL_Prefix;
126
127    --------------------
128    -- Is_Archive_Ext --
129    --------------------
130
131    function Is_Archive_Ext (Ext : String) return Boolean is
132    begin
133       return Ext = ".a" or else Ext = ".dll";
134    end Is_Archive_Ext;
135
136    --------------------------------------
137    -- Library_Major_Minor_Id_Supported --
138    --------------------------------------
139
140    function Library_Major_Minor_Id_Supported return Boolean is
141    begin
142       return False;
143    end Library_Major_Minor_Id_Supported;
144
145    ----------------
146    -- PIC_Option --
147    ----------------
148
149    function PIC_Option return String is
150    begin
151       return "";
152    end PIC_Option;
153
154 begin
155    Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
156    DLL_Ext_Ptr               := DLL_Ext'Access;
157    DLL_Prefix_Ptr            := DLL_Prefix'Access;
158    Is_Archive_Ext_Ptr        := Is_Archive_Ext'Access;
159    PIC_Option_Ptr            := PIC_Option'Access;
160    Library_Major_Minor_Id_Supported_Ptr :=
161                                 Library_Major_Minor_Id_Supported'Access;
162 end MLib.Tgt.Specific;