Commit f893b20c authored by yoogx's avatar yoogx

* Generate top-level makefile

        Fixes issue #9
parent 96498576
......@@ -192,8 +192,8 @@ package body Ocarina.Backends.Build_Utils is
-----------------------
function Get_Internal_Name (P : Node_Id) return Name_Id is
begin
pragma Assert (AAU.Is_Process (P));
begin
Set_Nat_To_Name_Buffer (Nat (P));
Add_Str_To_Name_Buffer ('%' & Id & '%');
......@@ -1078,6 +1078,7 @@ package body Ocarina.Backends.Build_Utils is
procedure Visit_System_Instance (E : Node_Id) is
S : Node_Id;
begin
-- Visit all the subcomponents of the system
......@@ -1386,7 +1387,59 @@ package body Ocarina.Backends.Build_Utils is
procedure Generate_System_Instance (E : Node_Id) is
S : Node_Id;
Fd : File_Descriptor;
begin
-- Create the file
Enter_Directory (Normalize_Name (Name (Identifier (E))));
Fd := Create_File ("Makefile", Text);
Write_Eol;
if Fd = Invalid_FD then
raise Program_Error;
end if;
-- Setting the output
Set_Output (Fd);
Write_Line ("###################################################");
Write_Line ("# This Makefile has been generated automatically #");
Write_Line ("# by the Ocarina AADL toolsuite. #");
Write_Line ("# Do not edit this file, all your changes will #");
Write_Line ("# be overridden at the next code generation. #");
Write_Line ("###################################################");
Write_Eol;
Write_Str ("SUBDIRS = ");
if not AAU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
if AAU.Is_Process (Corresponding_Instance (S)) then
Write_Name
(Normalize_Name
(Name (Identifier (S))));
Write_Str (" ");
-- Corresponding_Instance (S)))));
end if;
S := Next_Node (S);
end loop;
end if;
Write_Eol;
Write_Line ("all:");
Write_Line
(ASCII.HT
& "set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done");
-- Close the file
Close (Fd);
Set_Standard_Output;
Leave_Directory;
-- Generate the makefiles of all process subcomponents
if not AAU.Is_Empty (Subcomponents (E)) then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment