OSDN Git Service

2007-08-31 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / mlib-tgt-vxworks.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                    M L I B . T G T . S P E C I F I C                     --
6 --                            (VxWorks Version)                             --
7 --                                                                          --
8 --                                 B o d y                                  --
9 --                                                                          --
10 --           Copyright (C) 2003-2007, 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 is the VxWorks version of the body
29
30 with Sdefault;
31
32 package body MLib.Tgt.Specific is
33
34    -----------------------
35    -- Local Subprograms --
36    -----------------------
37
38    function Get_Target_Suffix return String;
39    --  Returns the required suffix for some utilities
40    --  (such as ar and ranlib) that depend on the real target.
41
42    --  Non default subprograms
43
44    function Archive_Builder return String;
45
46    function Archive_Indexer return String;
47
48    procedure Build_Dynamic_Library
49      (Ofiles       : Argument_List;
50       Options      : Argument_List;
51       Interfaces   : Argument_List;
52       Lib_Filename : String;
53       Lib_Dir      : String;
54       Symbol_Data  : Symbol_Record;
55       Driver_Name  : Name_Id := No_Name;
56       Lib_Version  : String  := "";
57       Auto_Init    : Boolean := False);
58
59    function DLL_Ext return String;
60
61    function Dynamic_Option return String;
62
63    function Library_Major_Minor_Id_Supported return Boolean;
64
65    function PIC_Option return String;
66
67    function Standalone_Library_Auto_Init_Is_Supported return Boolean;
68
69    function Support_For_Libraries return Library_Support;
70
71    ---------------------
72    -- Archive_Builder --
73    ---------------------
74
75    function Archive_Builder return String is
76    begin
77       return "ar" & Get_Target_Suffix;
78    end Archive_Builder;
79
80    ---------------------
81    -- Archive_Indexer --
82    ---------------------
83
84    function Archive_Indexer return String is
85    begin
86       return "ranlib" & Get_Target_Suffix;
87    end Archive_Indexer;
88
89    ---------------------------
90    -- Build_Dynamic_Library --
91    ---------------------------
92
93    procedure Build_Dynamic_Library
94      (Ofiles       : Argument_List;
95       Options      : Argument_List;
96       Interfaces   : Argument_List;
97       Lib_Filename : String;
98       Lib_Dir      : String;
99       Symbol_Data  : Symbol_Record;
100       Driver_Name  : Name_Id := No_Name;
101       Lib_Version  : String  := "";
102       Auto_Init    : Boolean := False)
103    is
104       pragma Unreferenced (Ofiles);
105       pragma Unreferenced (Options);
106       pragma Unreferenced (Interfaces);
107       pragma Unreferenced (Lib_Filename);
108       pragma Unreferenced (Lib_Dir);
109       pragma Unreferenced (Symbol_Data);
110       pragma Unreferenced (Driver_Name);
111       pragma Unreferenced (Lib_Version);
112       pragma Unreferenced (Auto_Init);
113
114    begin
115       null;
116    end Build_Dynamic_Library;
117
118    -------------
119    -- DLL_Ext --
120    -------------
121
122    function DLL_Ext return String is
123    begin
124       return "";
125    end DLL_Ext;
126
127    --------------------
128    -- Dynamic_Option --
129    --------------------
130
131    function Dynamic_Option return String is
132    begin
133       return "";
134    end Dynamic_Option;
135
136    -----------------------------
137    -- Get_Target_Suffix --
138    -----------------------------
139
140    function Get_Target_Suffix return String is
141       Target_Name : constant String := Sdefault.Target_Name.all;
142       Index       : Positive   := Target_Name'First;
143
144    begin
145       while Index < Target_Name'Last
146         and then Target_Name (Index + 1) /= '-'
147       loop
148          Index := Index + 1;
149       end loop;
150
151       if Target_Name (Target_Name'First .. Index) = "m68k" then
152          return "68k";
153       elsif Target_Name (Target_Name'First .. Index) = "mips" then
154          return "mips";
155       elsif Target_Name (Target_Name'First .. Index) = "powerpc" then
156          return "ppc";
157       elsif Target_Name (Target_Name'First .. Index) = "sparc" then
158          return "sparc";
159       elsif Target_Name (Target_Name'First .. Index) = "sparc64" then
160          return "sparc64";
161       elsif Target_Name (Target_Name'First .. Index) = "xscale" then
162          return "arm";
163       elsif Target_Name (Target_Name'First .. Index) = "i586" then
164          return "pentium";
165       else
166          return "";
167       end if;
168    end Get_Target_Suffix;
169
170    --------------------------------------
171    -- Library_Major_Minor_Id_Supported --
172    --------------------------------------
173
174    function Library_Major_Minor_Id_Supported return Boolean is
175    begin
176       return False;
177    end Library_Major_Minor_Id_Supported;
178
179    ----------------
180    -- PIC_Option --
181    ----------------
182
183    function PIC_Option return String is
184    begin
185       return "";
186    end PIC_Option;
187
188    -----------------------------------------------
189    -- Standalone_Library_Auto_Init_Is_Supported --
190    -----------------------------------------------
191
192    function Standalone_Library_Auto_Init_Is_Supported return Boolean is
193    begin
194       return False;
195    end Standalone_Library_Auto_Init_Is_Supported;
196
197    ---------------------------
198    -- Support_For_Libraries --
199    ---------------------------
200
201    function Support_For_Libraries return Library_Support is
202    begin
203       return Static_Only;
204    end Support_For_Libraries;
205
206 begin
207    Archive_Builder_Ptr := Archive_Builder'Access;
208    Archive_Indexer_Ptr := Archive_Indexer'Access;
209    Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
210    DLL_Ext_Ptr := DLL_Ext'Access;
211    Dynamic_Option_Ptr := Dynamic_Option'Access;
212    PIC_Option_Ptr := PIC_Option'Access;
213    Library_Major_Minor_Id_Supported_Ptr :=
214                                 Library_Major_Minor_Id_Supported'Access;
215    Standalone_Library_Auto_Init_Is_Supported_Ptr :=
216      Standalone_Library_Auto_Init_Is_Supported'Access;
217    Support_For_Libraries_Ptr := Support_For_Libraries'Access;
218 end MLib.Tgt.Specific;