Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
8dbaec92
Commit
8dbaec92
authored
Feb 13, 2016
by
Jerome Hugues
Browse files
* Rework circuitry to handle the case of system-in-system models
For issue #61
parent
77687a24
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/backends/ocarina-backends-build_utils.adb
View file @
8dbaec92
...
...
@@ -31,10 +31,9 @@
with
Ada
.
Unchecked_Deallocation
;
with
GNAT
.
Table
;
with
GNAT
.
OS_Lib
;
with
GNAT
.
Directory_Operations
;
with
GNAT
.
OS_Lib
;
with
GNAT
.
Table
;
with
Ocarina
.
Namet
;
with
Ocarina
.
Output
;
...
...
@@ -306,6 +305,9 @@ package body Ocarina.Backends.Build_Utils is
Current_Process
:
Node_Id
:=
No_Node
;
Appli_Name
:
Name_Id
:=
No_Name
;
-- Denotes the application name, derived from the AADL root system name
type
Makefile_Rec
is
record
Appli_Name
:
Name_Id
;
-- The distributed application name
...
...
@@ -314,7 +316,7 @@ package body Ocarina.Backends.Build_Utils is
-- The node name (in lower case)
Execution_Platform
:
Supported_Execution_Platform
:=
Platform_None
;
Execution_Platform_Name
:
Name_Id
:=
No_Name
;
Execution_Platform_Name
:
Name_Id
:=
No_Name
;
-- The execution platform of the processor the current node
-- is bound to.
...
...
@@ -924,7 +926,6 @@ package body Ocarina.Backends.Build_Utils is
procedure
Visit_Process_Instance
(
E
:
Node_Id
)
is
C
:
Node_Id
;
S
:
constant
Node_Id
:=
Parent_Subcomponent
(
E
);
A
:
constant
Node_Id
:=
Parent_Component
(
Parent_Subcomponent
(
E
));
M
:
constant
Makefile_Type
:=
new
Makefile_Rec
;
SC
:
Node_Id
;
Current_Device
:
Node_Id
;
...
...
@@ -945,7 +946,7 @@ package body Ocarina.Backends.Build_Utils is
Makefiles
.
Set
(
E
,
M
);
M
.
Appli_Name
:=
Normalize_Name
(
Name
(
Identifier
(
A
)))
;
M
.
Appli_Name
:=
Appli_Name
;
M
.
Node_Name
:=
Normalize_Name
(
Name
(
Identifier
(
S
)));
M
.
Use_Transport
:=
False
;
M
.
Use_Simulink
:=
False
;
...
...
@@ -1075,6 +1076,15 @@ package body Ocarina.Backends.Build_Utils is
S
:
Node_Id
;
begin
if
Appli_Name
=
No_Name
then
-- We need a unique application name, derived from the
-- root system. The application name is used to derive
-- the name of the root directory in which files are
-- generated.
Appli_Name
:=
Normalize_Name
(
Name
(
Identifier
(
E
)));
end
if
;
-- Visit all the subcomponents of the system
if
not
AAU
.
Is_Empty
(
Subcomponents
(
E
))
then
...
...
@@ -1382,68 +1392,53 @@ package body Ocarina.Backends.Build_Utils is
Fd
:
File_Descriptor
;
begin
if
Is_Directory
(
Get_Name_String
(
Dir_Name
))
then
-- Create the file
Enter_Directory
(
Dir_Name
);
Fd
:=
Create_File
(
"Makefile"
,
Text
);
Write_Eol
;
if
Fd
=
Invalid_FD
then
raise
Program_Error
;
end
if
;
-- Setting the output
-- If the current system is not the root system
-- (e.g. case of a deep hierarchy with systems inside
-- systems, no source has been generated, we exit
-- immediatly,
Set_Output
(
Fd
);
if
not
Is_Directory
(
Get_Name_String
(
Dir_Name
))
then
return
;
end
if
;
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
;
-- else, we create the makefile
Write_Str
(
"SUBDIRS = "
);
if
not
AAU
.
Is_Empty
(
Subcomponents
(
E
))
then
S
:=
First_Node
(
Subcomponents
(
E
));
Enter_Directory
(
Dir_Name
);
while
Present
(
S
)
loop
if
AAU
.
Is_Process
(
Corresponding_Instance
(
S
))
then
Write_Name
(
Normalize_Name
(
Name
(
Identifier
(
S
))));
Write_Str
(
" "
);
-- Corresponding_Instance (S)))));
Fd
:=
Create_File
(
"Makefile"
,
Text
);
if
Fd
=
Invalid_FD
then
raise
Program_Error
;
end
if
;
end
if
;
S
:=
Next_Node
(
S
);
end
loop
;
end
if
;
Write_Eol
;
-- Setting the output
Write_Line
(
"all:"
);
Write_Line
(
ASCII
.
HT
&
"set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done"
);
Set_Output
(
Fd
);
Write_Line
(
"clean:"
);
Write_Line
(
ASCII
.
HT
&
" set -e; for d in $(SUBDIRS); do $(MAKE) "
&
"clean -C $$d ; done"
);
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 = $(filter-out Makefile, $(wildcard *))"
);
Write_Eol
;
Write_Line
(
"all:"
);
Write_Line
(
ASCII
.
HT
&
"set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done"
);
Write_Eol
;
Write_Line
(
"clean:"
);
Write_Line
(
ASCII
.
HT
&
"set -e; for d in $(SUBDIRS); do $(MAKE) "
&
"clean -C $$d ; done"
);
-- Close the file
-- Close the file
Close
(
Fd
);
Set_Standard_Output
;
Leave_Directory
;
end
if
;
Close
(
Fd
);
Set_Standard_Output
;
Leave_Directory
;
-- Generate the makefiles of all process subcomponents
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment