A new package Clean with attributes Object_Artifact_Extensions and Source_Artifact_Extensions is created in project files.
Tested on x86_64-pc-linux-gnu, committed on trunk 2012-04-26 Vincent Celier <cel...@adacore.com> * prj-attr.adb: New package Clean with attributes Object_Artifact_Extensions and Source_Artifact_Extensions. * prj-nmsc.adb (Process_Clean): Process new package Clean * prj.ads (Language_Config): New components Clean_Object_Artifacts and Clean_Source_Artifacts. * snames.ads-tmpl: New standard names Clean, Object_Artifact_Extensions and Source_Artifact_Extensions.
Index: prj.ads =================================================================== --- prj.ads (revision 186860) +++ prj.ads (working copy) @@ -606,6 +606,12 @@ Toolchain_Description : Name_Id := No_Name; -- Hold the value of attribute Toolchain_Description for the language + Clean_Object_Artifacts : Name_List_Index := No_Name_List; + -- List of object artifact extensions to be deleted by gprclean + + Clean_Source_Artifacts : Name_List_Index := No_Name_List; + -- List of source artifact extensions to be deleted by gprclean + end record; No_Language_Config : constant Language_Config := @@ -654,7 +660,9 @@ Binder_Required_Switches => No_Name_List, Binder_Prefix => No_Name, Toolchain_Version => No_Name, - Toolchain_Description => No_Name); + Toolchain_Description => No_Name, + Clean_Object_Artifacts => No_Name_List, + Clean_Source_Artifacts => No_Name_List); -- The following record ??? Index: prj-nmsc.adb =================================================================== --- prj-nmsc.adb (revision 186860) +++ prj-nmsc.adb (working copy) @@ -1101,6 +1101,9 @@ procedure Process_Builder (Attributes : Variable_Id); -- Process the simple attributes of package Builder + procedure Process_Clean (Arrays : Array_Id); + -- Process the associate array attributes of package Clean + procedure Process_Compiler (Arrays : Array_Id); -- Process the associate array attributes of package Compiler @@ -1223,6 +1226,71 @@ end loop; end Process_Builder; + ------------------- + -- Process_Clean -- + ------------------- + + procedure Process_Clean (Arrays : Array_Id) is + Current_Array_Id : Array_Id; + Current_Array : Array_Data; + Element_Id : Array_Element_Id; + Element : Array_Element; + List : String_List_Id; + + begin + -- Process the associative array attribute of package Clean + + Current_Array_Id := Arrays; + while Current_Array_Id /= No_Array loop + Current_Array := Shared.Arrays.Table (Current_Array_Id); + + Element_Id := Current_Array.Value; + while Element_Id /= No_Array_Element loop + Element := Shared.Array_Elements.Table (Element_Id); + + -- Get the name of the language + + Lang_Index := Get_Language_From_Name + (Project, Get_Name_String (Element.Index)); + + if Lang_Index /= No_Language_Index then + case Current_Array.Name is + + -- Attribute Object_Artifact_Extensions (<language>) + + when Name_Object_Artifact_Extensions => + List := Element.Value.Values; + + if List /= Nil_String then + Put (Into_List => + Lang_Index.Config.Clean_Object_Artifacts, + From_List => List, + In_Tree => Data.Tree); + end if; + + -- Attribute Source_Artifact_Extensions (<language>) + + when Name_Source_Artifact_Extensions => + List := Element.Value.Values; + + if List /= Nil_String then + Put (Into_List => + Lang_Index.Config.Clean_Source_Artifacts, + From_List => List, + In_Tree => Data.Tree); + end if; + when others => + null; + end case; + end if; + + Element_Id := Element.Next; + end loop; + + Current_Array_Id := Current_Array.Next; + end loop; + end Process_Clean; + ---------------------- -- Process_Compiler -- ---------------------- @@ -1832,6 +1900,12 @@ Process_Builder (Element.Decl.Attributes); + when Name_Clean => + + -- Process attributes of package Clean + + Process_Clean (Element.Decl.Arrays); + when Name_Compiler => -- Process attributes of package Compiler @@ -3217,7 +3291,9 @@ if Project.Library then Support_For_Libraries := Project.Config.Lib_Support; - if Support_For_Libraries = Prj.None then + if not Project.Externally_Built and then + Support_For_Libraries = Prj.None + then Error_Msg (Data.Flags, "?libraries are not supported on this platform", @@ -3405,7 +3481,9 @@ end if; if Project.Library_Kind /= Static then - if Support_For_Libraries = Prj.Static_Only then + if not Project.Externally_Built and then + Support_For_Libraries = Prj.Static_Only + then Error_Msg (Data.Flags, "only static libraries are supported " & Index: prj-attr.adb =================================================================== --- prj-attr.adb (revision 186860) +++ prj-attr.adb (working copy) @@ -281,6 +281,13 @@ "SVresponse_file_format#" & "LVresponse_file_switches#" & + -- package Clean + + "Pclean#" & + "LVswitches#" & + "Lasource_artifact_extensions#" & + "Laobject_artifact_extensions#" & + -- package Cross_Reference "Pcross_reference#" & Index: snames.ads-tmpl =================================================================== --- snames.ads-tmpl (revision 186860) +++ snames.ads-tmpl (working copy) @@ -1106,6 +1106,7 @@ Name_Binder : constant Name_Id := N + $; Name_Body_Suffix : constant Name_Id := N + $; Name_Builder : constant Name_Id := N + $; + Name_Clean : constant Name_Id := N + $; Name_Compiler : constant Name_Id := N + $; Name_Compiler_Command : constant Name_Id := N + $; -- GB Name_Config_Body_File_Name : constant Name_Id := N + $; @@ -1195,6 +1196,7 @@ Name_Multi_Unit_Switches : constant Name_Id := N + $; Name_Naming : constant Name_Id := N + $; Name_None : constant Name_Id := N + $; + Name_Object_Artifact_Extensions : constant Name_Id := N + $; Name_Object_File_Suffix : constant Name_Id := N + $; Name_Object_File_Switches : constant Name_Id := N + $; Name_Object_Generated : constant Name_Id := N + $; @@ -1224,6 +1226,7 @@ Name_Shared_Library_Prefix : constant Name_Id := N + $; Name_Shared_Library_Suffix : constant Name_Id := N + $; Name_Separate_Suffix : constant Name_Id := N + $; + Name_Source_Artifact_Extensions : constant Name_Id := N + $; Name_Source_Dirs : constant Name_Id := N + $; Name_Source_File_Switches : constant Name_Id := N + $; Name_Source_Files : constant Name_Id := N + $;