Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gpr/src/gpr-attr.adb
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,13 @@ package body GPR.Attr is
Var_Kind => List,
Attr_Kind => Case_Insensitive_Associative_Array,
Conf_Conc => True);
Add_Attribute
(Name_Object_File_Prefix,
Var_Kind => Single,
Attr_Kind => Case_Insensitive_Associative_Array,
Conf_Conc => False);
-- FIXME: SNM: Object_File_Prefix
-- Conf_Conc => False); check this
Add_Attribute
(Name_Object_File_Suffix,
Var_Kind => Single,
Expand Down
25 changes: 21 additions & 4 deletions gpr/src/gpr-nmsc.adb
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,10 @@ package body GPR.Nmsc is
Id.File := File_Name;
Id.Display_File := Display_File;
Id.Dep_Name := Dependency_Name
(File_Name, Lang_Id.Config.Dependency_Kind);
(File_Name, Lang_Id.Config.Dependency_Kind);
Id.Naming_Exception := Naming_Exception;
Id.Object := Object_Name
(File_Name, Config.Object_File_Suffix);
(File_Name, Config.Object_File_Prefix, Config.Object_File_Suffix);
Id.Switches := Switches_Name (File_Name);

-- Add the source id to the Unit_Sources_HT hash table, if the unit name
Expand Down Expand Up @@ -1699,6 +1699,20 @@ package body GPR.Nmsc is
From_List => Element.Value.Values,
In_Tree => Data.Tree);

-- Attribute Object_File_Prefix (<language>)

elsif Current_Array.Name = Name_Object_File_Prefix then
if Get_Name_String (Element.Value.Value) = "" then
Error_Msg
(Data.Flags,
"FIXME: SNM: object file prefix may be empty",
Element.Value.Location, Project);

else
Lang_Index.Config.Object_File_Prefix :=
Element.Value.Value;
end if;

-- Attribute Object_File_Suffix (<language>)

elsif Current_Array.Name = Name_Object_File_Suffix then
Expand Down Expand Up @@ -9034,8 +9048,11 @@ package body GPR.Nmsc is
Id.Dep_Name :=
Dependency_Name (Id.File, Id.Language.Config.Dependency_Kind);
Id.Naming_Exception := Src.Naming_Exception;
Id.Object :=
Object_Name (Id.File, Id.Language.Config.Object_File_Suffix);
Id.Object := Object_Name
(Id.File,
Id.Language.Config.Object_File_Prefix,
Id.Language.Config.Object_File_Suffix);

Id.Switches := Switches_Name (Id.File);

-- Add the source id to the Unit_Sources_HT hash table, if the
Expand Down
1 change: 1 addition & 0 deletions gpr/src/gpr-snames.adb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ package body GPR.Snames is
Add_Name ("naming");
Add_Name ("none");
Add_Name ("object_artifact_extensions");
Add_Name ("object_file_prefix");
Add_Name ("object_file_suffix");
Add_Name ("object_file_switches");
Add_Name ("object_generated");
Expand Down
1 change: 1 addition & 0 deletions gpr/src/gpr-snames.ads
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ package GPR.Snames is
Name_Naming : constant Name_Id := Name_Id (L) - N;
Name_None : constant Name_Id := Name_Id (L) - N;
Name_Object_Artifact_Extensions : constant Name_Id := Name_Id (L) - N;
Name_Object_File_Prefix : constant Name_Id := Name_Id (L) - N;
Name_Object_File_Suffix : constant Name_Id := Name_Id (L) - N;
Name_Object_File_Switches : constant Name_Id := Name_Id (L) - N;
Name_Object_Generated : constant Name_Id := Name_Id (L) - N;
Expand Down
6 changes: 5 additions & 1 deletion gpr/src/gpr-util.adb
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,9 @@ package body GPR.Util is
Main_Source_File := Other_Part (Source).File;
Source.Object :=
Object_Name
(Main_Source_File, Source.Language.Config.Object_File_Suffix);
(Main_Source_File,
Source.Language.Config.Object_File_Prefix,
Source.Language.Config.Object_File_Suffix);
Source.Dep_Name :=
Dependency_Name
(Source.Object, Source.Language.Config.Dependency_Kind);
Expand All @@ -2057,6 +2059,8 @@ package body GPR.Util is
Source_Index => Source.Index,
Index_Separator =>
Source.Language.Config.Multi_Unit_Object_Separator,
Object_File_Prefix =>
Source.Language.Config.Object_File_Prefix,
Object_File_Suffix =>
Source.Language.Config.Object_File_Suffix);

Expand Down
27 changes: 24 additions & 3 deletions gpr/src/gpr.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1293,29 +1293,50 @@ package body GPR is

function Object_Name
(Source_File_Name : File_Name_Type;
Object_File_Prefix : Name_Id := No_Name;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type
is
Prefixed_Source_File_Name : File_Name_Type;
begin
-- FIXME: SNM: Object_File_Prefix

-- New_Line;
-- Put_Line ("FIXME: SNM: Object_File_Prefix, Put_Lines Debuging:");
-- Put_Line ("Source_File_Name = " &
-- Get_Name_String (Source_File_Name));
-- Put_Line ("Object_File_Prefix = " &
-- Get_Name_String (Object_File_Prefix));
-- Put_Line ("Object_File_Suffix = " &
-- Get_Name_String (Object_File_Suffix));
-- New_Line;

Get_Name_String (Object_File_Prefix);
Get_Name_String_And_Append (Source_File_Name);
Prefixed_Source_File_Name := Name_Find;

if Object_File_Suffix = No_Name then
return Extend_Name
(Source_File_Name, Object_Suffix);
(Prefixed_Source_File_Name, Object_Suffix);
else
return Extend_Name
(Source_File_Name, Get_Name_String (Object_File_Suffix));
(Prefixed_Source_File_Name, Get_Name_String (Object_File_Suffix));
end if;
end Object_Name;

function Object_Name
(Source_File_Name : File_Name_Type;
Source_Index : Int;
Index_Separator : Character;
Object_File_Prefix : Name_Id := No_Name;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type
is
Index_Img : constant String := Source_Index'Img;
Last : Natural;

begin
Get_Name_String (Source_File_Name);
-- FIXME: SNM: Object_File_Prefix
Get_Name_String (Object_File_Prefix);
Get_Name_String_And_Append (Source_File_Name);

Last := Name_Len;
while Last > 1 and then Name_Buffer (Last) /= '.' loop
Expand Down
5 changes: 5 additions & 0 deletions gpr/src/gpr.ads
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,9 @@ package GPR is
-- path name is appended to the last switch in the list.
-- Example: ("-i", "");

Object_File_Prefix : Name_Id := No_Name;
-- Optional alternate object file prefix

Object_File_Suffix : Name_Id := No_Name;
-- Optional alternate object file suffix

Expand Down Expand Up @@ -2588,13 +2591,15 @@ package GPR is

function Object_Name
(Source_File_Name : File_Name_Type;
Object_File_Prefix : Name_Id := No_Name;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
-- Returns the object file name corresponding to a source file name

function Object_Name
(Source_File_Name : File_Name_Type;
Source_Index : Int;
Index_Separator : Character;
Object_File_Prefix : Name_Id := No_Name;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
-- Returns the object file name corresponding to a unit in a multi-source
-- file.
Expand Down
2 changes: 1 addition & 1 deletion src/gprbuild-post_compile.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ package body Gprbuild.Post_Compile is
Shared => Project_Tree.Shared);

if not Switches.Default
and then Switches.Kind = List
and then Switches.Kind = List
then
Write_List
(Gprexch.Binding_Options, Switches.Values);
Expand Down
8 changes: 4 additions & 4 deletions src/gprlib.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1546,13 +1546,13 @@ procedure Gprlib is
if Start_Retrieving then
-- Don't store -static and -shared flags, they may cause
-- issues when linking with the library.
-- Don't store -lgnat and -lgnarl for encapsulated because
-- libgnat.a and libgnarl.a already encapsulated.
-- Don't store -lgnat and -lgnarl for encapsulated
-- because libgnat.a and libgnarl.a already encapsulated.

if Line (9 .. Last) not in Dash_Static | Dash_Shared
and then not
(Standalone = Encapsulated
and then Line (9 .. Last) in Dash_Lgnat | Dash_Lgnarl)
(Standalone = Encapsulated
and then Line (9 .. Last) in Dash_Lgnat | Dash_Lgnarl)
then
Put_Line (IO_File, Line (9 .. Last));
end if;
Expand Down