1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
6 -- (VxWorks Version) --
10 -- Copyright (C) 2003 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, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, 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 -- 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 Interfaces : Argument_List;
94 Lib_Filename : String;
96 Driver_Name : Name_Id := No_Name;
97 Lib_Address : String := "";
98 Lib_Version : String := "";
99 Relocatable : Boolean := False;
100 Auto_Init : Boolean := False)
102 pragma Unreferenced (Ofiles);
103 pragma Unreferenced (Foreign);
104 pragma Unreferenced (Afiles);
105 pragma Unreferenced (Options);
106 pragma Unreferenced (Interfaces);
107 pragma Unreferenced (Lib_Filename);
108 pragma Unreferenced (Lib_Dir);
109 pragma Unreferenced (Driver_Name);
110 pragma Unreferenced (Lib_Address);
111 pragma Unreferenced (Lib_Version);
112 pragma Unreferenced (Relocatable);
113 pragma Unreferenced (Auto_Init);
117 end Build_Dynamic_Library;
119 -------------------------
120 -- Default_DLL_Address --
121 -------------------------
123 function Default_DLL_Address return String is
126 end Default_DLL_Address;
132 function DLL_Ext return String is
141 function Dynamic_Option return String is
146 -----------------------------
147 -- Get_Target_Suffix --
148 -----------------------------
150 function Get_Target_Suffix return String is
151 Target_Name : String_Ptr := Sdefault.Target_Name;
152 Index : Positive := Target_Name'First;
154 while ((Index < Target_Name'Last) and then
155 (Target_Name (Index + 1) /= '-')) loop
159 if Target_Name (Target_Name'First .. Index) = "m68k" then
161 elsif Target_Name (Target_Name'First .. Index) = "mips" then
163 elsif Target_Name (Target_Name'First .. Index) = "powerpc" then
165 elsif Target_Name (Target_Name'First .. Index) = "sparc" then
167 elsif Target_Name (Target_Name'First .. Index) = "sparc64" then
169 elsif Target_Name (Target_Name'First .. Index) = "xscale" then
174 end Get_Target_Suffix;
180 function Is_Object_Ext (Ext : String) return Boolean is
189 function Is_C_Ext (Ext : String) return Boolean is
198 function Is_Archive_Ext (Ext : String) return Boolean is
207 function Libgnat return String is
212 ------------------------
213 -- Library_Exists_For --
214 ------------------------
216 function Library_Exists_For (Project : Project_Id) return Boolean is
218 if not Projects.Table (Project).Library then
219 Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
220 "for non library project");
221 return False; -- To avoid warning;
225 Lib_Dir : constant String :=
226 Get_Name_String (Projects.Table (Project).Library_Dir);
227 Lib_Name : constant String :=
228 Get_Name_String (Projects.Table (Project).Library_Name);
231 if Projects.Table (Project).Library_Kind = Static then
232 return Is_Regular_File
233 (Lib_Dir & Directory_Separator & "lib" &
234 Fil.Ext_To (Lib_Name, Archive_Ext));
237 return Is_Regular_File
238 (Lib_Dir & Directory_Separator & "lib" &
239 Fil.Ext_To (Lib_Name, DLL_Ext));
243 end Library_Exists_For;
245 ---------------------------
246 -- Library_File_Name_For --
247 ---------------------------
249 function Library_File_Name_For (Project : Project_Id) return Name_Id is
251 if not Projects.Table (Project).Library then
252 Prj.Com.Fail ("INTERNAL ERROR: Library_File_Name_For called " &
253 "for non library project");
258 Lib_Name : constant String :=
259 Get_Name_String (Projects.Table (Project).Library_Name);
263 Name_Buffer (1 .. Name_Len) := "lib";
265 if Projects.Table (Project).Library_Kind = Static then
266 Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
269 Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
275 end Library_File_Name_For;
277 --------------------------------
278 -- Linker_Library_Path_Option --
279 --------------------------------
281 function Linker_Library_Path_Option return String_Access is
283 return new String'("-Wl,-R,");
284 end Linker_Library_Path_Option;
290 function Object_Ext return String is
299 function PIC_Option return String is
304 -----------------------------------------------
305 -- Standalone_Library_Auto_Init_Is_Supported --
306 -----------------------------------------------
308 function Standalone_Library_Auto_Init_Is_Supported return Boolean is
311 end Standalone_Library_Auto_Init_Is_Supported;
313 ---------------------------
314 -- Support_For_Libraries --
315 ---------------------------
317 function Support_For_Libraries return Library_Support is
320 end Support_For_Libraries;