2015-09-28 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / ada / mlib-tgt-specific-mingw.adb
blobf1eedf5f23455a83722dcdd61335c8c863e6a892
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 ------------------------------------------------------------------------------
27 -- This is the Windows version of the body. Works only with GCC versions
28 -- supporting the "-shared" option.
30 with Opt;
31 with Output; use Output;
33 with MLib.Fil;
34 with MLib.Utl;
36 package body MLib.Tgt.Specific is
38 package Files renames MLib.Fil;
39 package Tools renames MLib.Utl;
41 -- Non default subprograms
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);
54 function DLL_Ext return String;
56 function DLL_Prefix return String;
58 function Is_Archive_Ext (Ext : String) return Boolean;
60 function Library_Major_Minor_Id_Supported return Boolean;
62 function PIC_Option return String;
64 Shared_Libgcc : aliased String := "-shared-libgcc";
66 Shared_Libgcc_Switch : constant Argument_List :=
67 (1 => Shared_Libgcc'Access);
69 ---------------------------
70 -- Build_Dynamic_Library --
71 ---------------------------
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)
84 pragma Unreferenced (Symbol_Data);
85 pragma Unreferenced (Interfaces);
86 pragma Unreferenced (Lib_Version);
87 pragma Unreferenced (Auto_Init);
89 Lib_File : constant String :=
90 Lib_Dir & Directory_Separator &
91 DLL_Prefix & Files.Append_To (Lib_Filename, DLL_Ext);
93 -- Start of processing for Build_Dynamic_Library
95 begin
96 if Opt.Verbose_Mode then
97 Write_Str ("building relocatable shared library ");
98 Write_Line (Lib_File);
99 end if;
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;
109 -------------
110 -- DLL_Ext --
111 -------------
113 function DLL_Ext return String is
114 begin
115 return "dll";
116 end DLL_Ext;
118 ----------------
119 -- DLL_Prefix --
120 ----------------
122 function DLL_Prefix return String is
123 begin
124 return "lib";
125 end DLL_Prefix;
127 --------------------
128 -- Is_Archive_Ext --
129 --------------------
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;
136 --------------------------------------
137 -- Library_Major_Minor_Id_Supported --
138 --------------------------------------
140 function Library_Major_Minor_Id_Supported return Boolean is
141 begin
142 return False;
143 end Library_Major_Minor_Id_Supported;
145 ----------------
146 -- PIC_Option --
147 ----------------
149 function PIC_Option return String is
150 begin
151 return "";
152 end PIC_Option;
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;