1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
6 -- (VxWorks Version) --
10 -- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
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. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
26 ------------------------------------------------------------------------------
28 -- This package provides a set of target dependent routines to build
31 -- This is the VxWorks version of the body
34 with Namet; use Namet;
38 package body MLib.Tgt is
40 -----------------------
41 -- Local Subprograms --
42 -----------------------
44 function Get_Target_Suffix return String;
45 -- Returns the required suffix for some utilities
46 -- (such as ar and ranlib) that depend on the real target.
52 function Archive_Builder return String is
54 return "ar" & Get_Target_Suffix;
57 -----------------------------
58 -- Archive_Builder_Options --
59 -----------------------------
61 function Archive_Builder_Options return String_List_Access is
63 return new String_List'(1 => new String'("cr"));
64 end Archive_Builder_Options;
70 function Archive_Ext return String is
79 function Archive_Indexer return String is
81 return "ranlib" & Get_Target_Suffix;
84 -----------------------------
85 -- Archive_Indexer_Options --
86 -----------------------------
88 function Archive_Indexer_Options return String_List_Access is
90 return new String_List (1 .. 0);
91 end Archive_Indexer_Options;
93 ---------------------------
94 -- Build_Dynamic_Library --
95 ---------------------------
97 procedure Build_Dynamic_Library
98 (Ofiles : Argument_List;
99 Foreign : Argument_List;
100 Afiles : Argument_List;
101 Options : Argument_List;
102 Options_2 : Argument_List;
103 Interfaces : Argument_List;
104 Lib_Filename : String;
106 Symbol_Data : Symbol_Record;
107 Driver_Name : Name_Id := No_Name;
108 Lib_Version : String := "";
109 Auto_Init : Boolean := False)
111 pragma Unreferenced (Ofiles);
112 pragma Unreferenced (Foreign);
113 pragma Unreferenced (Afiles);
114 pragma Unreferenced (Options);
115 pragma Unreferenced (Options_2);
116 pragma Unreferenced (Interfaces);
117 pragma Unreferenced (Lib_Filename);
118 pragma Unreferenced (Lib_Dir);
119 pragma Unreferenced (Symbol_Data);
120 pragma Unreferenced (Driver_Name);
121 pragma Unreferenced (Lib_Version);
122 pragma Unreferenced (Auto_Init);
126 end Build_Dynamic_Library;
132 function DLL_Ext return String is
141 function DLL_Prefix return String is
150 function Dynamic_Option return String is
155 -----------------------------
156 -- Get_Target_Suffix --
157 -----------------------------
159 function Get_Target_Suffix return String is
160 Target_Name : constant String_Ptr := Sdefault.Target_Name;
161 Index : Positive := Target_Name'First;
164 while Index < Target_Name'Last
165 and then Target_Name (Index + 1) /= '-'
170 if Target_Name (Target_Name'First .. Index) = "m68k" then
172 elsif Target_Name (Target_Name'First .. Index) = "mips" then
174 elsif Target_Name (Target_Name'First .. Index) = "powerpc" then
176 elsif Target_Name (Target_Name'First .. Index) = "sparc" then
178 elsif Target_Name (Target_Name'First .. Index) = "sparc64" then
180 elsif Target_Name (Target_Name'First .. Index) = "xscale" then
185 end Get_Target_Suffix;
191 function Is_Object_Ext (Ext : String) return Boolean is
200 function Is_C_Ext (Ext : String) return Boolean is
209 function Is_Archive_Ext (Ext : String) return Boolean is
218 function Libgnat return String is
223 ------------------------
224 -- Library_Exists_For --
225 ------------------------
227 function Library_Exists_For
228 (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
231 if not In_Tree.Projects.Table (Project).Library then
232 Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
233 "for non library project");
238 Lib_Dir : constant String :=
240 (In_Tree.Projects.Table (Project).Library_Dir);
241 Lib_Name : constant String :=
243 (In_Tree.Projects.Table (Project).Library_Name);
246 if In_Tree.Projects.Table (Project).Library_Kind =
249 return Is_Regular_File
250 (Lib_Dir & Directory_Separator & "lib" &
251 Fil.Ext_To (Lib_Name, Archive_Ext));
254 return Is_Regular_File
255 (Lib_Dir & Directory_Separator & "lib" &
256 Fil.Ext_To (Lib_Name, DLL_Ext));
260 end Library_Exists_For;
262 ---------------------------
263 -- Library_File_Name_For --
264 ---------------------------
266 function Library_File_Name_For
267 (Project : Project_Id;
268 In_Tree : Project_Tree_Ref) return Name_Id
271 if not In_Tree.Projects.Table (Project).Library then
272 Prj.Com.Fail ("INTERNAL ERROR: Library_File_Name_For called " &
273 "for non library project");
278 Lib_Name : constant String :=
280 (In_Tree.Projects.Table (Project).Library_Name);
284 Name_Buffer (1 .. Name_Len) := "lib";
286 if In_Tree.Projects.Table (Project).Library_Kind =
289 Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
292 Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
298 end Library_File_Name_For;
304 function Object_Ext return String is
313 function PIC_Option return String is
318 -----------------------------------------------
319 -- Standalone_Library_Auto_Init_Is_Supported --
320 -----------------------------------------------
322 function Standalone_Library_Auto_Init_Is_Supported return Boolean is
325 end Standalone_Library_Auto_Init_Is_Supported;
327 ---------------------------
328 -- Support_For_Libraries --
329 ---------------------------
331 function Support_For_Libraries return Library_Support is
334 end Support_For_Libraries;