makefile.tmplt 3.16 KB
Newer Older
1
2
3
4
@@-- The following tags are available in this template:
@@--
@@-- @_Function_Names_@      : Combined table: list of fuction names...
@@-- @_Language_@            : ... and corresponding implementation language
5
6
@@-- @_Is_Type_@             : ... and flag if it is a function type
@@-- @_CP_Files_@            : List of all context parameters ASN.1 files
7
@@-- @_Unique_Languages_@    : List of all languages used in the system
8
9
@@-- @_ASN1_Files_@          : List of all ASN.1 files
@@-- @_ASN1_Modules_@        : List of all ASN.1 modules
Maxime Perrotin's avatar
Maxime Perrotin committed
10
11
12
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
OUTDIR := $(dir $(MAKEFILE_PATH))

13
all: dataviews
Maxime Perrotin's avatar
Maxime Perrotin committed
14

15
dataviews:
16
	mkdir -p dataview/.cache
Maxime Perrotin's avatar
Maxime Perrotin committed
17
18
	@@-- Create dataview-uniq.asn
	@@INLINE(	)( )(\n)@@
Maxime Perrotin's avatar
Maxime Perrotin committed
19
        for f in
Maxime Perrotin's avatar
Maxime Perrotin committed
20
21
22
        @@TABLE@@
           @_ASN1_Files_@ 
        @@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
23
; do cat $$f; echo; done > dataview/dataview-uniq.asn
Maxime Perrotin's avatar
Maxime Perrotin committed
24
	@@END_INLINE@@
25
26
27
28
29
30
31
32
33
	@@-- Create system_config.h by concatenating all functions partial system config files
	@@INLINE(	)( )(\n)@@
        for f in
        @@TABLE@@
	    @_LOWER:Function_Names_@/@_Language_@/wrappers/@_LOWER:Function_Names_@_system_config.h
        @@END_TABLE@@
; do cat $$f; echo; done > system_config.h
	@@END_INLINE@@
	
34
35
36
37
38
39
	@@-- Generate DataView.aadl in AADLV1 as this is needed by aadl2glueC
	PROJECT_CACHE=dataview/.cache asn2aadlPlus dataview/dataview-uniq.asn dataview/dataview_aadlv1.aadl
	@@-- For each function generate the glue code from DMT based on the dataview
	@@TABLE@@
	aadl2glueC -o @_LOWER:Function_Names_@/@_Language_@/wrappers dataview/dataview_aadlv1.aadl @_LOWER:Function_Names_@/@_Language_@/wrappers/@_LOWER:Function_Names_@_mini_cv.aadl
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
40
	@@-- Then generate Dataviews once per target language
41
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	   @@IF@@ @_Unique_Languages_@ = "Ada" or @_Unique_Languages_@ = "SDL"
	      @@SET@@ Lang=Ada
	      @@SET@@ Post=cd dataview/Ada && rm -f gnat.cfg GPS_project.gpr IgnoredExaminerWarnings.wrn runSpark.sh
	   @@ELSIF@@ @_Unique_Languages_@ = "C" or @_Unique_Languages_@ = "CPP" or @_Unique_Languages_@ = "Blackbox_C" or @_Unique_Languages_@ = "GUI"
	      @@SET@@ Lang=C
	      @@SET@@ Post=# Blackboxes, C, GUI, and C++ all use the same C data model
	   @@ELSE@@
              @@SET@@ Lang=@_Unique_Languages_@
	   @@END_IF@@
	   @@INLINE(	)(\n	)(\n)@@
              mkdir -p dataview/@_Lang_@
              PROJECT_CACHE=dataview/.cache asn2dataModel -o dataview/@_Lang_@ -to@_Lang_@ dataview/dataview-uniq.asn \
	      @@INLINE(	)( \\\n	)(\n	)@@
	         @@TABLE@@
56
57
58
                    @_REPLACE(,/ ):CP_Files_@
    	         @@END_TABLE@@
	      @@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
59
60
              @_Post_@
	   @@END_INLINE@@
61
62
63
        @@END_TABLE@@
	@@-- Then symlink the files for each function
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
64
	@@IF@@ @_Language_@ = "SDL"
Maxime Perrotin's avatar
Maxime Perrotin committed
65
	ln -fs ${OUTDIR}/dataview/dataview-uniq.asn @_LOWER:Function_Names_@/@_Language_@/src
66
	@@END_IF@@
67
	@@END_TABLE@@
68

Maxime Perrotin's avatar
Maxime Perrotin committed
69
function-types-linux:
Maxime Perrotin's avatar
Maxime Perrotin committed
70
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
71
	@@IF@@ @_Is_Type_@
Maxime Perrotin's avatar
Maxime Perrotin committed
72
	cd @_LOWER:Function_Names_@/@_Language_@ && make compile-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
73
	@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
74
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
75
76
77
78
79
80
81
82
83

function-instances-linux: function-types-linux
	@@TABLE@@
	@@IF@@ not @_Is_Type_@
	cd @_LOWER:Function_Names_@/@_Language_@ && make compile-linux
	@@END_IF@@
	@@END_TABLE@@

compile-all-linux: dataviews function-instances-linux