File : mlib-tgt-specific-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-2013, 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 3,  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 COPYING3.  If not, go to --
  20 -- http://www.gnu.org/licenses for a complete copy of the license.          --
  21 --                                                                          --
  22 -- GNAT was originally developed  by the GNAT team at  New York University. --
  23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  24 --                                                                          --
  25 ------------------------------------------------------------------------------
  26 
  27 --  This is the VxWorks version of the body
  28 
  29 with Sdefault;
  30 
  31 package body MLib.Tgt.Specific is
  32 
  33    -----------------------
  34    -- Local Subprograms --
  35    -----------------------
  36 
  37    function Get_Target_Suffix return String;
  38    --  Returns the required suffix for some utilities
  39    --  (such as ar and ranlib) that depend on the real target.
  40 
  41    --  Non default subprograms
  42 
  43    function Archive_Builder return String;
  44 
  45    function Archive_Indexer return String;
  46 
  47    procedure Build_Dynamic_Library
  48      (Ofiles       : Argument_List;
  49       Options      : Argument_List;
  50       Interfaces   : Argument_List;
  51       Lib_Filename : String;
  52       Lib_Dir      : String;
  53       Symbol_Data  : Symbol_Record;
  54       Driver_Name  : Name_Id := No_Name;
  55       Lib_Version  : String  := "";
  56       Auto_Init    : Boolean := False);
  57 
  58    function DLL_Ext return String;
  59 
  60    function Dynamic_Option return String;
  61 
  62    function Library_Major_Minor_Id_Supported return Boolean;
  63 
  64    function PIC_Option return String;
  65 
  66    function Standalone_Library_Auto_Init_Is_Supported return Boolean;
  67 
  68    function Support_For_Libraries return Library_Support;
  69 
  70    ---------------------
  71    -- Archive_Builder --
  72    ---------------------
  73 
  74    function Archive_Builder return String is
  75    begin
  76       return "ar" & Get_Target_Suffix;
  77    end Archive_Builder;
  78 
  79    ---------------------
  80    -- Archive_Indexer --
  81    ---------------------
  82 
  83    function Archive_Indexer return String is
  84    begin
  85       return "ranlib" & Get_Target_Suffix;
  86    end Archive_Indexer;
  87 
  88    ---------------------------
  89    -- Build_Dynamic_Library --
  90    ---------------------------
  91 
  92    procedure Build_Dynamic_Library
  93      (Ofiles       : Argument_List;
  94       Options      : Argument_List;
  95       Interfaces   : Argument_List;
  96       Lib_Filename : String;
  97       Lib_Dir      : String;
  98       Symbol_Data  : Symbol_Record;
  99       Driver_Name  : Name_Id := No_Name;
 100       Lib_Version  : String  := "";
 101       Auto_Init    : Boolean := False)
 102    is
 103       pragma Unreferenced (Ofiles);
 104       pragma Unreferenced (Options);
 105       pragma Unreferenced (Interfaces);
 106       pragma Unreferenced (Lib_Filename);
 107       pragma Unreferenced (Lib_Dir);
 108       pragma Unreferenced (Symbol_Data);
 109       pragma Unreferenced (Driver_Name);
 110       pragma Unreferenced (Lib_Version);
 111       pragma Unreferenced (Auto_Init);
 112 
 113    begin
 114       null;
 115    end Build_Dynamic_Library;
 116 
 117    -------------
 118    -- DLL_Ext --
 119    -------------
 120 
 121    function DLL_Ext return String is
 122    begin
 123       return "";
 124    end DLL_Ext;
 125 
 126    --------------------
 127    -- Dynamic_Option --
 128    --------------------
 129 
 130    function Dynamic_Option return String is
 131    begin
 132       return "";
 133    end Dynamic_Option;
 134 
 135    -----------------------
 136    -- Get_Target_Suffix --
 137    -----------------------
 138 
 139    function Get_Target_Suffix return String is
 140       Target_Name : constant String := Sdefault.Target_Name.all;
 141       Index       : Positive   := Target_Name'First;
 142 
 143    begin
 144       while Index < Target_Name'Last
 145         and then Target_Name (Index + 1) /= '-'
 146       loop
 147          Index := Index + 1;
 148       end loop;
 149 
 150       if Target_Name (Target_Name'First .. Index) = "m68k" then
 151          return "68k";
 152       elsif Target_Name (Target_Name'First .. Index) = "mips" then
 153          return "mips";
 154       elsif Target_Name (Target_Name'First .. Index) = "powerpc" then
 155          return "ppc";
 156       elsif Target_Name (Target_Name'First .. Index) = "sparc" then
 157          return "sparc";
 158       elsif Target_Name (Target_Name'First .. Index) = "sparc64" then
 159          return "sparc64";
 160       elsif Target_Name (Target_Name'First .. Index) = "arm" then
 161          return "arm";
 162       elsif Target_Name (Target_Name'First .. Index) = "i586" then
 163          return "pentium";
 164       else
 165          return "";
 166       end if;
 167    end Get_Target_Suffix;
 168 
 169    --------------------------------------
 170    -- Library_Major_Minor_Id_Supported --
 171    --------------------------------------
 172 
 173    function Library_Major_Minor_Id_Supported return Boolean is
 174    begin
 175       return False;
 176    end Library_Major_Minor_Id_Supported;
 177 
 178    ----------------
 179    -- PIC_Option --
 180    ----------------
 181 
 182    function PIC_Option return String is
 183    begin
 184       return "";
 185    end PIC_Option;
 186 
 187    -----------------------------------------------
 188    -- Standalone_Library_Auto_Init_Is_Supported --
 189    -----------------------------------------------
 190 
 191    function Standalone_Library_Auto_Init_Is_Supported return Boolean is
 192    begin
 193       return False;
 194    end Standalone_Library_Auto_Init_Is_Supported;
 195 
 196    ---------------------------
 197    -- Support_For_Libraries --
 198    ---------------------------
 199 
 200    function Support_For_Libraries return Library_Support is
 201    begin
 202       return Static_Only;
 203    end Support_For_Libraries;
 204 
 205 begin
 206    Archive_Builder_Ptr := Archive_Builder'Access;
 207    Archive_Indexer_Ptr := Archive_Indexer'Access;
 208    Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
 209    DLL_Ext_Ptr := DLL_Ext'Access;
 210    Dynamic_Option_Ptr := Dynamic_Option'Access;
 211    PIC_Option_Ptr := PIC_Option'Access;
 212    Library_Major_Minor_Id_Supported_Ptr :=
 213                                 Library_Major_Minor_Id_Supported'Access;
 214    Standalone_Library_Auto_Init_Is_Supported_Ptr :=
 215      Standalone_Library_Auto_Init_Is_Supported'Access;
 216    Support_For_Libraries_Ptr := Support_For_Libraries'Access;
 217 end MLib.Tgt.Specific;