-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2016, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2017, 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- --
------------------------------------------------------------------------------
with Debug; use Debug;
-with Makeutl; use Makeutl;
with Osint; use Osint;
with Opt; use Opt;
-with Prj; use Prj;
-with Prj.Env; use Prj.Env;
with Table;
with System.Multiprocessors; use System.Multiprocessors;
Global_Switches : Argument_List_Access := null;
-- Used by function Normalize_Compiler_Switches
+ Subdirs_Option : constant String := "--subdirs=";
+
---------------------------------
-- Normalize_Compiler_Switches --
---------------------------------
------------------------
procedure Scan_Make_Switches
- (Env : in out Prj.Tree.Environment;
- Switch_Chars : String;
+ (Switch_Chars : String;
Success : out Boolean)
is
Ptr : Integer := Switch_Chars'First;
-- Multiple character switches
+ -- To preserve building gnat_util, it is not possible to use the
+ -- constant Strings declare in Make_Util, as Make_Util is not in
+ -- gnat_util.
+
if Switch_Chars'Length > 2 then
if Switch_Chars = "--create-missing-dirs" then
Setup_Projects := True;
Subdirs_Option
then
Subdirs :=
- new String'
- (Switch_Chars
- (Switch_Chars'First + Subdirs_Option'Length ..
- Switch_Chars'Last));
+ new String'(Switch_Chars
+ (Switch_Chars'First + Subdirs_Option'Length ..
+ Switch_Chars'Last));
- elsif Switch_Chars = Makeutl.Unchecked_Shared_Lib_Imports then
+ elsif Switch_Chars = "--unchecked-shared-lib-imports" then
Opt.Unchecked_Shared_Lib_Imports := True;
- elsif Switch_Chars = Makeutl.Single_Compile_Per_Obj_Dir_Switch then
+ elsif Switch_Chars = "--single-compile-per-obj-dir" then
Opt.One_Compilation_Per_Obj_Dir := True;
- elsif Switch_Chars = Makeutl.No_Exit_Message_Option then
+ elsif Switch_Chars = "--no-exit-message" then
Opt.No_Exit_Message := True;
- elsif Switch_Chars = Makeutl.Keep_Temp_Files_Option then
+ elsif Switch_Chars = "--keep-temp-files" then
Opt.Keep_Temporary_Files := True;
elsif Switch_Chars (Ptr) = '-' then
elsif Switch_Chars'Length > 3
and then Switch_Chars (Ptr .. Ptr + 1) = "aP"
then
- Add_Directories
- (Env.Project_Path,
- Switch_Chars (Ptr + 2 .. Switch_Chars'Last));
+ null;
+ -- This is only used by gprbuild
elsif C = 'v' and then Switch_Chars'Length = 3 then
Ptr := Ptr + 1;
Verbose_Mode := True;
case Switch_Chars (Ptr) is
- when 'l' => Verbosity_Level := Opt.Low;
- when 'm' => Verbosity_Level := Opt.Medium;
- when 'h' => Verbosity_Level := Opt.High;
- when others => Success := False;
+ when 'l' => Verbosity_Level := Opt.Low;
+ when 'm' => Verbosity_Level := Opt.Medium;
+ when 'h' => Verbosity_Level := Opt.High;
+ when others => Success := False;
end case;
elsif C = 'd' then
-- Processing for eI switch
- when 'I' =>
- Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Main_Index, C);
+ when 'I' =>
+ Ptr := Ptr + 1;
+ Scan_Pos (Switch_Chars, Max, Ptr, Main_Index, C);
- if Ptr <= Max then
- Bad_Switch (Switch_Chars);
- end if;
+ if Ptr <= Max then
+ Bad_Switch (Switch_Chars);
+ end if;
-- Processing for eL switch
- when 'L' =>
- if Ptr /= Max then
- Bad_Switch (Switch_Chars);
+ when 'L' =>
+ if Ptr /= Max then
+ Bad_Switch (Switch_Chars);
- else
- Follow_Links_For_Files := True;
- Follow_Links_For_Dirs := True;
- end if;
+ else
+ Follow_Links_For_Files := True;
+ Follow_Links_For_Dirs := True;
+ end if;
-- Processing for eS switch
- when 'S' =>
- if Ptr /= Max then
- Bad_Switch (Switch_Chars);
+ when 'S' =>
+ if Ptr /= Max then
+ Bad_Switch (Switch_Chars);
- else
- Commands_To_Stdout := True;
- end if;
+ else
+ Commands_To_Stdout := True;
+ end if;
- when others =>
- Bad_Switch (Switch_Chars);
+ when others =>
+ Bad_Switch (Switch_Chars);
end case;
elsif C = 'j' then