This commit was manufactured by cvs2svn to create branch
[official-gcc.git] / gcc / ada / mlib-tgt-lynxos.adb
blob0f1be1fe97fd43b35648582e4aa344cb7dbc6aa9
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- M L I B . T G T --
6 -- (LynxOS Version) --
7 -- --
8 -- B o d y --
9 -- --
10 -- Copyright (C) 2003-2004 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 2, 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 COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 -- --
26 ------------------------------------------------------------------------------
28 -- This package provides a set of target dependent routines to build
29 -- static libraries.
31 -- This is the LynxOS version of the body
33 with MLib.Fil;
34 with Namet; use Namet;
35 with Prj.Com;
37 package body MLib.Tgt is
39 ---------------------
40 -- Archive_Builder --
41 ---------------------
43 function Archive_Builder return String is
44 begin
45 return "ar";
46 end Archive_Builder;
48 -----------------------------
49 -- Archive_Builder_Options --
50 -----------------------------
52 function Archive_Builder_Options return String_List_Access is
53 begin
54 return new String_List'(1 => new String'("cr"));
55 end Archive_Builder_Options;
57 -----------------
58 -- Archive_Ext --
59 -----------------
61 function Archive_Ext return String is
62 begin
63 return "a";
64 end Archive_Ext;
66 ---------------------
67 -- Archive_Indexer --
68 ---------------------
70 function Archive_Indexer return String is
71 begin
72 return "ranlib";
73 end Archive_Indexer;
75 -----------------------------
76 -- Archive_Indexer_Options --
77 -----------------------------
79 function Archive_Indexer_Options return String_List_Access is
80 begin
81 return new String_List (1 .. 0);
82 end Archive_Indexer_Options;
84 ---------------------------
85 -- Build_Dynamic_Library --
86 ---------------------------
88 procedure Build_Dynamic_Library
89 (Ofiles : Argument_List;
90 Foreign : Argument_List;
91 Afiles : Argument_List;
92 Options : Argument_List;
93 Options_2 : Argument_List;
94 Interfaces : Argument_List;
95 Lib_Filename : String;
96 Lib_Dir : String;
97 Symbol_Data : Symbol_Record;
98 Driver_Name : Name_Id := No_Name;
99 Lib_Version : String := "";
100 Auto_Init : Boolean := False)
102 pragma Unreferenced (Ofiles);
103 pragma Unreferenced (Foreign);
104 pragma Unreferenced (Afiles);
105 pragma Unreferenced (Options);
106 pragma Unreferenced (Options_2);
107 pragma Unreferenced (Interfaces);
108 pragma Unreferenced (Lib_Filename);
109 pragma Unreferenced (Lib_Dir);
110 pragma Unreferenced (Symbol_Data);
111 pragma Unreferenced (Driver_Name);
112 pragma Unreferenced (Lib_Version);
113 pragma Unreferenced (Auto_Init);
115 begin
116 null;
117 end Build_Dynamic_Library;
119 -------------
120 -- DLL_Ext --
121 -------------
123 function DLL_Ext return String is
124 begin
125 return "";
126 end DLL_Ext;
128 --------------------
129 -- Dynamic_Option --
130 --------------------
132 function Dynamic_Option return String is
133 begin
134 return "";
135 end Dynamic_Option;
137 -------------------
138 -- Is_Object_Ext --
139 -------------------
141 function Is_Object_Ext (Ext : String) return Boolean is
142 begin
143 return Ext = ".o";
144 end Is_Object_Ext;
146 --------------
147 -- Is_C_Ext --
148 --------------
150 function Is_C_Ext (Ext : String) return Boolean is
151 begin
152 return Ext = ".c";
153 end Is_C_Ext;
155 --------------------
156 -- Is_Archive_Ext --
157 --------------------
159 function Is_Archive_Ext (Ext : String) return Boolean is
160 begin
161 return Ext = ".a";
162 end Is_Archive_Ext;
164 -------------
165 -- Libgnat --
166 -------------
168 function Libgnat return String is
169 begin
170 return "libgnat.a";
171 end Libgnat;
173 ------------------------
174 -- Library_Exists_For --
175 ------------------------
177 function Library_Exists_For (Project : Project_Id) return Boolean is
178 begin
179 if not Projects.Table (Project).Library then
180 Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
181 "for non library project");
182 return False;
184 else
185 declare
186 Lib_Dir : constant String :=
187 Get_Name_String (Projects.Table (Project).Library_Dir);
188 Lib_Name : constant String :=
189 Get_Name_String (Projects.Table (Project).Library_Name);
191 begin
192 if Projects.Table (Project).Library_Kind = Static then
193 return Is_Regular_File
194 (Lib_Dir & Directory_Separator & "lib" &
195 Fil.Ext_To (Lib_Name, Archive_Ext));
197 else
198 return Is_Regular_File
199 (Lib_Dir & Directory_Separator & "lib" &
200 Fil.Ext_To (Lib_Name, DLL_Ext));
201 end if;
202 end;
203 end if;
204 end Library_Exists_For;
206 ---------------------------
207 -- Library_File_Name_For --
208 ---------------------------
210 function Library_File_Name_For (Project : Project_Id) return Name_Id is
211 begin
212 if not Projects.Table (Project).Library then
213 Prj.Com.Fail ("INTERNAL ERROR: Library_File_Name_For called " &
214 "for non library project");
215 return No_Name;
217 else
218 declare
219 Lib_Name : constant String :=
220 Get_Name_String (Projects.Table (Project).Library_Name);
222 begin
223 Name_Len := 3;
224 Name_Buffer (1 .. Name_Len) := "lib";
226 if Projects.Table (Project).Library_Kind = Static then
227 Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
229 else
230 Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
231 end if;
233 return Name_Find;
234 end;
235 end if;
236 end Library_File_Name_For;
238 ----------------
239 -- Object_Ext --
240 ----------------
242 function Object_Ext return String is
243 begin
244 return "o";
245 end Object_Ext;
247 ----------------
248 -- PIC_Option --
249 ----------------
251 function PIC_Option return String is
252 begin
253 return "";
254 end PIC_Option;
256 -----------------------------------------------
257 -- Standalone_Library_Auto_Init_Is_Supported --
258 -----------------------------------------------
260 function Standalone_Library_Auto_Init_Is_Supported return Boolean is
261 begin
262 return False;
263 end Standalone_Library_Auto_Init_Is_Supported;
265 ---------------------------
266 -- Support_For_Libraries --
267 ---------------------------
269 function Support_For_Libraries return Library_Support is
270 begin
271 return Static_Only;
272 end Support_For_Libraries;
274 end MLib.Tgt;