OSDN Git Service

* doc/invoke.texi (Optimize Options): Correct description of -O0.
[pf3gnuchains/gcc-fork.git] / gcc / ada / mlib-tgt-lynxos.adb
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-2006 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,  51  Franklin  Street,  Fifth  Floor, --
21 -- Boston, MA 02110-1301, 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 ------------------------------------------------------------------------------
27
28 --  This package provides a set of target dependent routines to build
29 --  static libraries.
30
31 --  This is the LynxOS version of the body
32
33 with MLib.Fil;
34 with Namet;  use Namet;
35 with Prj.Com;
36
37 package body MLib.Tgt is
38
39    ---------------------
40    -- Archive_Builder --
41    ---------------------
42
43    function Archive_Builder return String is
44    begin
45       return "ar";
46    end Archive_Builder;
47
48    -----------------------------
49    -- Archive_Builder_Options --
50    -----------------------------
51
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;
56
57    -----------------
58    -- Archive_Ext --
59    -----------------
60
61    function Archive_Ext return String is
62    begin
63       return "a";
64    end Archive_Ext;
65
66    ---------------------
67    -- Archive_Indexer --
68    ---------------------
69
70    function Archive_Indexer return String is
71    begin
72       return "ranlib";
73    end Archive_Indexer;
74
75    -----------------------------
76    -- Archive_Indexer_Options --
77    -----------------------------
78
79    function Archive_Indexer_Options return String_List_Access is
80    begin
81       return new String_List (1 .. 0);
82    end Archive_Indexer_Options;
83
84    ---------------------------
85    -- Build_Dynamic_Library --
86    ---------------------------
87
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)
101    is
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);
114
115    begin
116       null;
117    end Build_Dynamic_Library;
118
119    -------------
120    -- DLL_Ext --
121    -------------
122
123    function DLL_Ext return String is
124    begin
125       return "";
126    end DLL_Ext;
127
128    ----------------
129    -- DLL_Prefix --
130    ----------------
131
132    function DLL_Prefix return String is
133    begin
134       return "lib";
135    end DLL_Prefix;
136
137    --------------------
138    -- Dynamic_Option --
139    --------------------
140
141    function Dynamic_Option return String is
142    begin
143       return "";
144    end Dynamic_Option;
145
146    -------------------
147    -- Is_Object_Ext --
148    -------------------
149
150    function Is_Object_Ext (Ext : String) return Boolean is
151    begin
152       return Ext = ".o";
153    end Is_Object_Ext;
154
155    --------------
156    -- Is_C_Ext --
157    --------------
158
159    function Is_C_Ext (Ext : String) return Boolean is
160    begin
161       return Ext = ".c";
162    end Is_C_Ext;
163
164    --------------------
165    -- Is_Archive_Ext --
166    --------------------
167
168    function Is_Archive_Ext (Ext : String) return Boolean is
169    begin
170       return Ext = ".a";
171    end Is_Archive_Ext;
172
173    -------------
174    -- Libgnat --
175    -------------
176
177    function Libgnat return String is
178    begin
179       return "libgnat.a";
180    end Libgnat;
181
182    ------------------------
183    -- Library_Exists_For --
184    ------------------------
185
186    function Library_Exists_For
187      (Project : Project_Id;
188       In_Tree : Project_Tree_Ref) return Boolean
189    is
190    begin
191       if not In_Tree.Projects.Table (Project).Library then
192          Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
193                        "for non library project");
194          return False;
195
196       else
197          declare
198             Lib_Dir  : constant String :=
199                          Get_Name_String
200                            (In_Tree.Projects.Table (Project).Library_Dir);
201             Lib_Name : constant String :=
202                          Get_Name_String
203                            (In_Tree.Projects.Table (Project).Library_Name);
204
205          begin
206             if In_Tree.Projects.Table (Project).Library_Kind = Static then
207                return Is_Regular_File
208                  (Lib_Dir & Directory_Separator & "lib" &
209                   Fil.Append_To (Lib_Name, Archive_Ext));
210
211             else
212                return Is_Regular_File
213                  (Lib_Dir & Directory_Separator & "lib" &
214                   Fil.Append_To (Lib_Name, DLL_Ext));
215             end if;
216          end;
217       end if;
218    end Library_Exists_For;
219
220    ---------------------------
221    -- Library_File_Name_For --
222    ---------------------------
223
224    function Library_File_Name_For
225      (Project : Project_Id;
226       In_Tree : Project_Tree_Ref) return Name_Id
227    is
228    begin
229       if not In_Tree.Projects.Table (Project).Library then
230          Prj.Com.Fail ("INTERNAL ERROR: Library_File_Name_For called " &
231                        "for non library project");
232          return No_Name;
233
234       else
235          declare
236             Lib_Name : constant String :=
237                          Get_Name_String
238                            (In_Tree.Projects.Table (Project).Library_Name);
239
240          begin
241             Name_Len := 3;
242             Name_Buffer (1 .. Name_Len) := "lib";
243
244             if In_Tree.Projects.Table (Project).Library_Kind =
245               Static
246             then
247                Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
248             else
249                Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
250             end if;
251
252             return Name_Find;
253          end;
254       end if;
255    end Library_File_Name_For;
256
257    ----------------
258    -- Object_Ext --
259    ----------------
260
261    function Object_Ext return String is
262    begin
263       return "o";
264    end Object_Ext;
265
266    ----------------
267    -- PIC_Option --
268    ----------------
269
270    function PIC_Option return String is
271    begin
272       return "";
273    end PIC_Option;
274
275    -----------------------------------------------
276    -- Standalone_Library_Auto_Init_Is_Supported --
277    -----------------------------------------------
278
279    function Standalone_Library_Auto_Init_Is_Supported return Boolean is
280    begin
281       return False;
282    end Standalone_Library_Auto_Init_Is_Supported;
283
284    ---------------------------
285    -- Support_For_Libraries --
286    ---------------------------
287
288    function Support_For_Libraries return Library_Support is
289    begin
290       return Static_Only;
291    end Support_For_Libraries;
292
293 end MLib.Tgt;