bindusg.adb: Add line for @<response file> Add lines for new switches -R and -Z

2007-04-20  Vincent Celier  <celier@adacore.com>

	* bindusg.adb: Add line for @<response file>
	Add lines for new switches -R and -Z

	* gnatbind.adb (Gnatbind): Do not include sources from the GNAT
	hierarchy in the list of files of the closure when -R is used
	(Gnatbind): Accept arguments starting with '@' to indicate response
	files and take the arguments from the response files.
	If List_Closure is set, display the referenced files

From-SVN: r125387
This commit is contained in:
Vincent Celier 2007-06-06 12:22:30 +02:00 committed by Arnaud Charlet
parent 6644b368be
commit 47eb2d8d9a
2 changed files with 93 additions and 9 deletions

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2007, 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- --
@ -54,6 +54,11 @@ package body Bindusg is
Write_Eol;
Write_Eol;
-- Line for @response_file
Write_Line (" @<resp_file> Get arguments from response file");
Write_Eol;
-- Line for -aO switch
Write_Line (" -aOdir Specify library files search path");
@ -176,6 +181,11 @@ package body Bindusg is
Write_Line (" -r List restrictions that could be applied " &
"to this partition");
-- Line for -R switch
Write_Line
(" -R List sources referenced in closure (implies -c)");
-- Line for -s switch
Write_Line (" -s Require all source files to be present");
@ -233,6 +243,13 @@ package body Bindusg is
-- Line for --RTS
-- Line for -Z switch
Write_Line (" -Z " &
"Zero formatting in auxiliary outputs (-e, -K, -l, -R)");
-- Line for --RTS
Write_Line (" --RTS=dir specify the default source and " &
"object search path");

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2007, 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- --
@ -36,6 +36,7 @@ with Casing; use Casing;
with Csets;
with Debug; use Debug;
with Fmap;
with Fname; use Fname;
with Gnatvsn; use Gnatvsn;
with Namet; use Namet;
with Opt; use Opt;
@ -50,6 +51,9 @@ with Targparm; use Targparm;
with Types; use Types;
with System.Case_Util; use System.Case_Util;
with System.OS_Lib; use System.OS_Lib;
with Ada.Command_Line.Response_File; use Ada.Command_Line;
procedure Gnatbind is
@ -427,7 +431,28 @@ begin
Next_Argv : String (1 .. Len_Arg (Next_Arg));
begin
Fill_Arg (Next_Argv'Address, Next_Arg);
Scan_Bind_Arg (Next_Argv);
if Next_Argv'Length > 0 then
if Next_Argv (1) = '@' then
if Next_Argv'Length > 1 then
declare
Arguments : constant Argument_List :=
Response_File.Arguments_From
(Response_File_Name =>
Next_Argv (2 .. Next_Argv'Last),
Recursive => True,
Ignore_Non_Existing_Files => True);
begin
for J in Arguments'Range loop
Scan_Bind_Arg (Arguments (J).all);
end loop;
end;
end if;
else
Scan_Bind_Arg (Next_Argv);
end if;
end if;
end;
Next_Arg := Next_Arg + 1;
@ -666,7 +691,7 @@ begin
and then ALIs.Table (ALIs.First).Main_Program = None
and then not No_Main_Subprogram
then
Error_Msg_Name_1 := Main_Lib_File;
Error_Msg_File_1 := Main_Lib_File;
Error_Msg ("% does not contain a unit that can be a main program");
end if;
@ -689,26 +714,68 @@ begin
Find_Elab_Order;
if Errors_Detected = 0 then
-- Display elaboration order if -l was specified
if Elab_Order_Output then
Write_Eol;
Write_Str ("ELABORATION ORDER");
Write_Eol;
if not Zero_Formatting then
Write_Eol;
Write_Str ("ELABORATION ORDER");
Write_Eol;
end if;
for J in Elab_Order.First .. Elab_Order.Last loop
if not Units.Table (Elab_Order.Table (J)).SAL_Interface then
Write_Str (" ");
if not Zero_Formatting then
Write_Str (" ");
end if;
Write_Unit_Name
(Units.Table (Elab_Order.Table (J)).Uname);
Write_Eol;
end if;
end loop;
Write_Eol;
if not Zero_Formatting then
Write_Eol;
end if;
end if;
if not Check_Only then
Gen_Output_File (Output_File_Name.all);
end if;
-- Display list of sources in the closure (except predefined
-- sources) if -R was used.
if List_Closure then
if not Zero_Formatting then
Write_Eol;
Write_Str ("REFERENCED SOURCES");
Write_Eol;
end if;
for J in reverse Elab_Order.First .. Elab_Order.Last loop
-- Do not include the sources of the runtime
if not Is_Internal_File_Name
(Units.Table (Elab_Order.Table (J)).Sfile)
then
if not Zero_Formatting then
Write_Str (" ");
end if;
Write_Str
(Get_Name_String
(Units.Table (Elab_Order.Table (J)).Sfile));
Write_Eol;
end if;
end loop;
if not Zero_Formatting then
Write_Eol;
end if;
end if;
end if;
end if;