[Ada] Fix handling of gnatmake -u with library project

Arnaud Charlet charlet@adacore.com
Mon Jan 3 16:13:00 GMT 2005


Tested on x86-linux, committed on mainline.

When -u is used, no attempt should be made to compile only the
specified sources. However, if a specified source was part of
a library, then all the sources of the library were checked and
compiled if not up to date.
The test consists of one library project file asis_bld.gpr and two
empty package asis.ads and toto.ads. The command
   $ gnatmake -f -u -c -P asis_bld.gpr asis.ads
should only compile asis.ads, never toto.ads.
--
package Toto is
end Toto;
package Asis is
end Asis;
project Asis_Bld is
   for Library_Name use "asis";
   for Library_Dir use "lib";
   for Library_Kind use "static";
end Asis_Bld;

2005-01-03  Vincent Celier  <celier@adacore.com>

	* make.adb (Collect_Arguments_And_Compile): Do not attempt to build
	libraries when Unique_Compile is True (-u switch).
	(Gnatmake): ditto.

-------------- next part --------------
Index: make.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/make.adb,v
retrieving revision 1.48
diff -u -p -r1.48 make.adb
--- make.adb	8 Dec 2004 11:25:38 -0000	1.48
+++ make.adb	3 Jan 2005 15:15:18 -0000
@@ -2224,7 +2224,9 @@ package body Make is
             if not Projects.Table (Arguments_Project).Externally_Built then
                Prj.Env.Set_Ada_Paths (Arguments_Project, True);
 
-               if MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None then
+               if not Unique_Compile
+                 and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
+               then
                   declare
                      The_Data : Project_Data :=
                                   Projects.Table (Arguments_Project);
@@ -4352,7 +4354,9 @@ package body Make is
          --  put all the project sources in the queue, and flag the project
          --  so that the library is generated.
 
-         if MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None then
+         if not Unique_Compile
+           and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
+         then
             for Proj in Projects.First .. Projects.Last loop
                if Projects.Table (Proj).Library then
                   Projects.Table (Proj).Need_To_Build_Lib :=


More information about the Gcc-patches mailing list