gcc/
[official-gcc.git] / gcc / ada / mlib-tgt-specific-mingw.adb
blob704071a14ab1cacd3a171e646d9760dba4b359e7
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-2008, 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 No_Argument_List : constant String_List := (1 .. 0 => null);
65 -- Used as value of parameter Options or Options2 in calls to Gcc
67 ---------------------------
68 -- Build_Dynamic_Library --
69 ---------------------------
71 procedure Build_Dynamic_Library
72 (Ofiles : Argument_List;
73 Options : Argument_List;
74 Interfaces : Argument_List;
75 Lib_Filename : String;
76 Lib_Dir : String;
77 Symbol_Data : Symbol_Record;
78 Driver_Name : Name_Id := No_Name;
79 Lib_Version : String := "";
80 Auto_Init : Boolean := False)
82 pragma Unreferenced (Symbol_Data);
83 pragma Unreferenced (Interfaces);
84 pragma Unreferenced (Lib_Version);
85 pragma Unreferenced (Auto_Init);
87 Lib_File : constant String :=
88 Lib_Dir & Directory_Separator &
89 DLL_Prefix & Files.Append_To (Lib_Filename, DLL_Ext);
91 -- Start of processing for Build_Dynamic_Library
93 begin
94 if Opt.Verbose_Mode then
95 Write_Str ("building relocatable shared library ");
96 Write_Line (Lib_File);
97 end if;
99 Tools.Gcc
100 (Output_File => Lib_File,
101 Objects => Ofiles,
102 Options => No_Argument_List,
103 Options_2 => Options,
104 Driver_Name => Driver_Name);
105 end Build_Dynamic_Library;
107 -------------
108 -- DLL_Ext --
109 -------------
111 function DLL_Ext return String is
112 begin
113 return "dll";
114 end DLL_Ext;
116 ----------------
117 -- DLL_Prefix --
118 ----------------
120 function DLL_Prefix return String is
121 begin
122 return "lib";
123 end DLL_Prefix;
125 --------------------
126 -- Is_Archive_Ext --
127 --------------------
129 function Is_Archive_Ext (Ext : String) return Boolean is
130 begin
131 return Ext = ".a" or else Ext = ".dll";
132 end Is_Archive_Ext;
134 --------------------------------------
135 -- Library_Major_Minor_Id_Supported --
136 --------------------------------------
138 function Library_Major_Minor_Id_Supported return Boolean is
139 begin
140 return False;
141 end Library_Major_Minor_Id_Supported;
143 ----------------
144 -- PIC_Option --
145 ----------------
147 function PIC_Option return String is
148 begin
149 return "";
150 end PIC_Option;
152 begin
153 Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
154 DLL_Ext_Ptr := DLL_Ext'Access;
155 DLL_Prefix_Ptr := DLL_Prefix'Access;
156 Is_Archive_Ext_Ptr := Is_Archive_Ext'Access;
157 PIC_Option_Ptr := PIC_Option'Access;
158 Library_Major_Minor_Id_Supported_Ptr :=
159 Library_Major_Minor_Id_Supported'Access;
160 end MLib.Tgt.Specific;