From 3429710e69836c0eb5cf71c2f22ec7c6ca073db7 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 25 Nov 2015 16:10:52 +0100 Subject: [multiple changes] 2015-11-25 Vincent Celier * gnatcmd.adb: When -gnat is called with switch -P and a GPR tool is invoked, invoke the GPR tool with switch --target=. 2015-11-25 Hristian Kirtchev * opt.adb, bcheck.adb: Minor reformatting. From-SVN: r230876 --- gcc/ada/gnatcmd.adb | 61 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 23 deletions(-) (limited to 'gcc/ada/gnatcmd.adb') diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index df64831..451f202 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -58,13 +58,8 @@ with GNAT.OS_Lib; use GNAT.OS_Lib; procedure GNATCmd is Gprbuild : constant String := "gprbuild"; - Gnatmake : constant String := "gnatmake"; - - Gprclean : constant String := "gprclean"; - Gnatclean : constant String := "gnatclean"; - + Gprclean : constant String := "gprclean"; Gprname : constant String := "gprname"; - Gnatname : constant String := "gnatname"; Normal_Exit : exception; -- Raise this exception for normal program termination @@ -1170,8 +1165,9 @@ begin end loop; declare - Program : String_Access; - Exec_Path : String_Access; + Program : String_Access; + Exec_Path : String_Access; + Get_Target : Boolean := False; begin if The_Command = Stack then @@ -1188,9 +1184,10 @@ begin -- instead of gnatmake/gnatclean. -- Ditto for gnatname -> gprname. - if Program.all = Gnatmake - or else Program.all = Gnatclean - or else Program.all = Gnatname + if The_Command = Make + or else The_Command = Compile + or else The_Command = Clean + or else The_Command = Name then declare Project_File_Used : Boolean := False; @@ -1208,19 +1205,37 @@ begin end loop; if Project_File_Used then - if Program.all = Gnatmake - and then Locate_Exec_On_Path (Gprbuild) /= null - then - Program := new String'(Gprbuild); - elsif Program.all = Gnatclean - and then Locate_Exec_On_Path (Gprclean) /= null - then - Program := new String'(Gprclean); + case The_Command is + when Make | Compile => + if Locate_Exec_On_Path (Gprbuild) /= null then + Program := new String'(Gprbuild); + Get_Target := True; + end if; - elsif Program.all = Gnatname - and then Locate_Exec_On_Path (Gprname) /= null - then - Program := new String'(Gprname); + when Clean => + if Locate_Exec_On_Path (Gprclean) /= null then + Program := new String'(Gprclean); + Get_Target := True; + end if; + + when Name => + if Locate_Exec_On_Path (Gprname) /= null then + Program := new String'(Gprname); + Get_Target := True; + end if; + + when others => + null; + end case; + + if Get_Target then + Find_Program_Name; + + if Name_Len > 5 then + First_Switches.Append + (new String' + ("--target=" & Name_Buffer (1 .. Name_Len - 5))); + end if; end if; end if; end; -- cgit v1.1