This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] new gnatmake switch -S


Tested on i686-linux, committed on trunk.

This change first is a code clean up/reorg to avoid duplicating the handling
of executable extensions in various places and fix inconsistencies.
Secondly, we introduce an extra mechanism in targparm to be able to override
the default executable extension dynamically by parsing system.ads, instead
of using a hard coded value which cannot be changed.
This is particularly useful under e.g. VxWorks 6 where multiple extension
are used: .out for kernel modules, and .vxe for RTPs.

This patch also implements a new switch -S for gnatmake that causes commands
to be echoed to stdout instead of stderr. All other messages still go to
stderr, and if the -S switch is not used, the behavior is unchanged (all
messages go to stderr), so that this change does not affect existing
scripts. This is particularly useful in an eclipse environment, where
different colors distinguish stderr (red) and stdout (green) lines.

To test, use the following simple program

procedure h is
begin
   null;
end;

The command gnatmake -S h.adb >log will generate no output to
stderr, but the file log will contain:

gcc -c h.adb
gnatbind -x h.ali
gnatlink h.ali

If you immediately repeat this command, the log file will be empty,
and the following message will appear on stderr:

gnatmake: "h.exe" up to date.

Finally, when Executable_Suffix and Executable ("<main>") are both specified in
package Builder of the main project, it is expected that the executable
name will end with the specified suffix. This patch ensures that it is
the case.
The test for that is to build the following project; the executable name
should be "main_ada.exe".

project Prj;
   for Main use ("dummy.adb");
   package Builder is
      for Executable ("dummy.adb") use "main_ada";
      for Executable_Suffix use ".exe";
   end Builder;
end Prj;

2006-10-31  Arnaud Charlet  <charlet@adacore.com>
	    Robert Dewar  <dewar@adacore.com>

	* gnatcmd.adb (Process_Link): Use Osint.Executable_Name instead of
	handling executable extension manually and duplicating code.

	* make.adb: Implement new -S switch
	(Gnatmake): Use new function Osint.Executable_Name instead
	of handling executable extension manually.

	* prj-util.adb (Executable_Of): Make sure that if an Executable_Suffix
	is specified, the executable name ends with this suffix.
	Take advantage of Osint.Executable_Name instead of duplicating code.

	* switch-m.adb: Recognize new gnatmake -S switch

	* targparm.ads, targparm.adb (Executable_Extension_On_Target): New
	variable.
	(Get_Target_Parameters): Set Executable_Extension_On_Target if
	available.

	* makeusg.adb: Add line for gnatmake -S switch

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]