gnatdll.adb (Parse_Command_Line): handle -g option to be passed to the binder and linker.

* gnatdll.adb (Parse_Command_Line): handle -g option to be passed
	to the binder and linker.
	Minor style fix.

	* mdll.ads: Fix layout.  Update copyright notice.

	* mdll.adb: Fix layout.  Update copyright notice.

From-SVN: r46662
This commit is contained in:
Pascal Obry 2001-10-31 00:21:37 +00:00 committed by Geert Bosch
parent 1753e0ad5f
commit 5e25717852
4 changed files with 101 additions and 84 deletions

View File

@ -1,3 +1,13 @@
2001-10-30 Pascal Obry <obry@gnat.com>
* gnatdll.adb (Parse_Command_Line): handle -g option to be passed
to the binder and linker.
Minor style fix.
* mdll.ads: Fix layout. Update copyright notice.
* mdll.adb: Fix layout. Update copyright notice.
2001-10-30 Robert Dewar <dewar@gnat.com>
* usage.adb: Minor fix to output for -gnaty.

View File

@ -6,9 +6,9 @@
-- --
-- B o d y --
-- --
-- $Revision: 1.6 $
-- $Revision$
-- --
-- Copyright (C) 1997-2000, Free Software Foundation, Inc. --
-- Copyright (C) 1997-2001, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -52,7 +52,7 @@ procedure Gnatdll is
procedure Syntax;
-- print out usage.
procedure Check (Filename : in String);
procedure Check (Filename : String);
-- check that filename exist.
procedure Parse_Command_Line;
@ -61,8 +61,6 @@ procedure Gnatdll is
procedure Check_Context;
-- check the context before runing any commands to build the library.
Syntax_Error : exception;
Context_Error : exception;
@ -98,7 +96,6 @@ procedure Gnatdll is
Largs_Options : Argument_List_Access := Null_Argument_List_Access;
Bargs_Options : Argument_List_Access := Null_Argument_List_Access;
type Build_Mode_State is (Import_Lib, Dynamic_Lib, Nil);
Build_Mode : Build_Mode_State := Nil;
@ -111,31 +108,33 @@ procedure Gnatdll is
procedure Syntax is
use Text_IO;
procedure P (Str : in String) renames Text_IO.Put_Line;
begin
Put_Line ("Usage : gnatdll [options] [list-of-files]");
P ("Usage : gnatdll [options] [list-of-files]");
New_Line;
Put_Line
("[list-of-files] a list of Ada libraries (.ali) and/or " &
P ("[list-of-files] a list of Ada libraries (.ali) and/or " &
"foreign object files");
New_Line;
Put_Line ("[options] can be");
Put_Line (" -h help - display this message");
Put_Line (" -v verbose");
Put_Line (" -q quiet");
Put_Line (" -k remove @nn suffix from exported names");
Put_Line (" -Idir Specify source and object files search path");
Put_Line (" -l file " &
"file contains a list-of-files to be added to the library");
Put_Line (" -e file definition file containing exports");
Put_Line
(" -d file put objects in the relocatable dynamic library <file>");
Put_Line (" -a[addr] build non-relocatable DLL at address <addr>");
Put_Line (" if <addr> is not specified use " &
Default_DLL_Address);
Put_Line (" -n no-import - do not create the import library");
Put_Line (" -bargs binder option");
Put_Line (" -largs linker (library builder) option");
P ("[options] can be");
P (" -h Help - display this message");
P (" -v Verbose");
P (" -q Quiet");
P (" -k Remove @nn suffix from exported names");
P (" -g Generate debugging information");
P (" -Idir Specify source and object files search path");
P (" -l file File contains a list-of-files to be added to "
& "the library");
P (" -e file Definition file containing exports");
P (" -d file Put objects in the relocatable dynamic "
& "library <file>");
P (" -a[addr] Build non-relocatable DLL at address <addr>");
P (" if <addr> is not specified use "
& Default_DLL_Address);
P (" -n No-import - do not create the import library");
P (" -bargs opts opts are passed to the binder");
P (" -largs opts opts are passed to the linker");
end Syntax;
-----------
@ -273,7 +272,7 @@ procedure Gnatdll is
-- scan gnatdll switches
loop
case Getopt ("h v q k a? d: e: l: n I:") is
case Getopt ("g h v q k a? d: e: l: n I:") is
when ASCII.Nul =>
exit;
@ -281,6 +280,10 @@ procedure Gnatdll is
when 'h' =>
Help := True;
when 'g' =>
Gopts (G) := new String'("-g");
G := G + 1;
when 'v' =>
-- verbose mode on.
@ -501,8 +504,9 @@ begin
case Build_Mode is
when Import_Lib =>
MDLL.Build_Import_Library (To_String (Lib_Filename),
To_String (Def_Filename));
MDLL.Build_Import_Library
(To_String (Lib_Filename),
To_String (Def_Filename));
when Dynamic_Lib =>
MDLL.Build_Dynamic_Library

View File

@ -6,9 +6,9 @@
-- --
-- B o d y --
-- --
-- $Revision: 1.4 $
-- $Revision$
-- --
-- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -44,16 +44,16 @@ package body MDLL is
---------------------------
procedure Build_Dynamic_Library
(Ofiles : in Argument_List;
Afiles : in Argument_List;
Options : in Argument_List;
Bargs_Options : in Argument_List;
Largs_Options : in Argument_List;
Lib_Filename : in String;
Def_Filename : in String;
Lib_Address : in String := "";
Build_Import : in Boolean := False;
Relocatable : in Boolean := False)
(Ofiles : Argument_List;
Afiles : Argument_List;
Options : Argument_List;
Bargs_Options : Argument_List;
Largs_Options : Argument_List;
Lib_Filename : String;
Def_Filename : String;
Lib_Address : String := "";
Build_Import : Boolean := False;
Relocatable : Boolean := False)
is
use type OS_Lib.Argument_List;
@ -73,20 +73,19 @@ package body MDLL is
All_Options : constant Argument_List := Options & Largs_Options;
procedure Build_Reloc_DLL;
-- build a relocatable DLL with only objects file specified.
-- Build a relocatable DLL with only objects file specified.
-- this use the well known 5 steps build. (see GNAT User's Guide).
procedure Ada_Build_Reloc_DLL;
-- build a relocatable DLL with Ada code.
-- Build a relocatable DLL with Ada code.
-- this use the well known 5 steps build. (see GNAT User's Guide).
procedure Build_Non_Reloc_DLL;
-- build a non relocatable DLL containing no Ada code.
-- Build a non relocatable DLL containing no Ada code.
procedure Ada_Build_Non_Reloc_DLL;
-- build a non relocatable DLL with Ada code.
-- Build a non relocatable DLL with Ada code.
---------------------
-- Build_Reloc_DLL --
@ -94,7 +93,7 @@ package body MDLL is
procedure Build_Reloc_DLL is
-- objects plus the export table (.exp) file
-- Objects plus the export table (.exp) file
Objects_Exp_File : OS_Lib.Argument_List
:= Exp_File'Unchecked_Access & Ofiles;
@ -111,7 +110,7 @@ package body MDLL is
end if;
end if;
-- 1) build base file with objects files.
-- 1) Build base file with objects files.
Tools.Gcc (Output_File => Jnk_File,
Files => Ofiles,
@ -119,14 +118,14 @@ package body MDLL is
Base_File => Bas_File,
Build_Lib => True);
-- 2) build exp from base file.
-- 2) Build exp from base file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => False);
-- 3) build base file with exp file and objects files.
-- 3) Build base file with exp file and objects files.
Tools.Gcc (Output_File => Jnk_File,
Files => Objects_Exp_File,
@ -134,14 +133,14 @@ package body MDLL is
Base_File => Bas_File,
Build_Lib => True);
-- 4) build new exp from base file and the lib file (.a)
-- 4) Build new exp from base file and the lib file (.a)
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
-- 5) build the dynamic library
-- 5) Build the dynamic library
Tools.Gcc (Output_File => Dll_File,
Files => Objects_Exp_File,
@ -177,7 +176,7 @@ package body MDLL is
end if;
end if;
-- 1) build base file with objects files.
-- 1) Build base file with objects files.
Tools.Gnatbind (Afiles, Options & Bargs_Options);
@ -191,14 +190,14 @@ package body MDLL is
Params);
end;
-- 2) build exp from base file.
-- 2) Build exp from base file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => False);
-- 3) build base file with exp file and objects files.
-- 3) Build base file with exp file and objects files.
Tools.Gnatbind (Afiles, Options & Bargs_Options);
@ -215,14 +214,14 @@ package body MDLL is
Params);
end;
-- 4) build new exp from base file and the lib file (.a)
-- 4) Build new exp from base file and the lib file (.a)
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Base_File => Bas_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
-- 5) build the dynamic library
-- 5) Build the dynamic library
Tools.Gnatbind (Afiles, Options & Bargs_Options);
@ -268,13 +267,13 @@ package body MDLL is
end if;
end if;
-- build exp table and the lib .a file.
-- Build exp table and the lib .a file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
-- build the DLL
-- Build the DLL
Tools.Gcc (Output_File => Dll_File,
Files => Exp_File'Unchecked_Access & Ofiles,
@ -293,7 +292,7 @@ package body MDLL is
-- Ada_Build_Non_Reloc_DLL --
-----------------------------
-- build a non relocatable DLL with Ada code.
-- Build a non relocatable DLL with Ada code.
procedure Ada_Build_Non_Reloc_DLL is
begin
@ -309,13 +308,13 @@ package body MDLL is
end if;
end if;
-- build exp table and the lib .a file.
-- Build exp table and the lib .a file.
Tools.Dlltool (Def_File, Dll_File, Lib_File,
Exp_Table => Exp_File,
Build_Import => Build_Import);
-- build the DLL
-- Build the DLL
Tools.Gnatbind (Afiles, Options & Bargs_Options);
@ -363,11 +362,13 @@ package body MDLL is
-- Build_Import_Library --
--------------------------
procedure Build_Import_Library (Lib_Filename : in String;
Def_Filename : in String) is
procedure Build_Import_Library
(Lib_Filename : String;
Def_Filename : String)
is
procedure Build_Import_Library (Def_Base_Filename : in String);
-- build an import library.
procedure Build_Import_Library (Def_Base_Filename : String);
-- Build an import library.
-- this is to build only a .a library to link against a DLL.
Base_Filename : constant String := MDLL.Files.Ext_To (Lib_Filename);
@ -376,7 +377,7 @@ package body MDLL is
-- Build_Import_Library --
--------------------------
procedure Build_Import_Library (Def_Base_Filename : in String) is
procedure Build_Import_Library (Def_Base_Filename : String) is
Def_File : String renames Def_Filename;
Dll_File : constant String := Def_Base_Filename & ".dll";
@ -395,7 +396,7 @@ package body MDLL is
end Build_Import_Library;
begin
-- if the library has the form lib<name>.a then the def file should
-- If the library has the form lib<name>.a then the def file should
-- be <name>.def and the DLL to link against <name>.dll
-- this is a Windows convention and we try as much as possible to
-- follow the platform convention.

View File

@ -6,9 +6,9 @@
-- --
-- S p e c --
-- --
-- $Revision: 1.5 $
-- $Revision$
-- --
-- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -52,17 +52,18 @@ package MDLL is
Kill_Suffix : Boolean := False;
procedure Build_Dynamic_Library (Ofiles : in Argument_List;
Afiles : in Argument_List;
Options : in Argument_List;
Bargs_Options : in Argument_List;
Largs_Options : in Argument_List;
Lib_Filename : in String;
Def_Filename : in String;
Lib_Address : in String := "";
Build_Import : in Boolean := False;
Relocatable : in Boolean := False);
-- build a DLL and the import library to link against the DLL.
procedure Build_Dynamic_Library
(Ofiles : Argument_List;
Afiles : Argument_List;
Options : Argument_List;
Bargs_Options : Argument_List;
Largs_Options : Argument_List;
Lib_Filename : String;
Def_Filename : String;
Lib_Address : String := "";
Build_Import : Boolean := False;
Relocatable : Boolean := False);
-- Build a DLL and the import library to link against the DLL.
-- this function handles relocatable and non relocatable DLL.
-- If the Afiles argument list contains some Ada units then it will
-- generate the right adainit and adafinal and integrate it in the DLL.
@ -70,8 +71,9 @@ package MDLL is
-- provided) then it will not try to build a binder file. This is ok to
-- build DLL containing no Ada code.
procedure Build_Import_Library (Lib_Filename : in String;
Def_Filename : in String);
procedure Build_Import_Library
(Lib_Filename : String;
Def_Filename : String);
-- Build an import library (.a) from a definition files. An import library
-- is needed to link against a DLL.