makefile.tmplt 5.89 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
13
14
MAKEFILE_PATH   := $(abspath $(lastword $(MAKEFILE_LIST)))
OUTDIR          := $(dir $(MAKEFILE_PATH))
DATAVIEW_PATH   := ${OUTDIR}/dataview
DATAVIEW_UNIQ   := ${DATAVIEW_PATH}/dataview-uniq.asn
DATAVIEW_AADLV1 := ${DATAVIEW_PATH}/dataview_aadlv1.aadl
Maxime Perrotin's avatar
Maxime Perrotin committed
15

Maxime Perrotin's avatar
Maxime Perrotin committed
16
17
# Project cache folder is used to speed up all ASN.1-related processing
export PROJECT_CACHE=${HOME}/.taste_AST_cache
18

Maxime Perrotin's avatar
Maxime Perrotin committed
19
all:	build-native
Maxime Perrotin's avatar
Maxime Perrotin committed
20

Maxime Perrotin's avatar
Maxime Perrotin committed
21
22
23
24
25
26
@@-- global check to see if dataview in Ada is needed
@@TABLE@@
  @@IF@@ @_Unique_Languages_@ = "Ada" or @_Unique_Languages_@ = "SDL"
     @@SET@@ Need_Ada=TRUE
  @@END_IF@@
@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
27

Maxime Perrotin's avatar
Maxime Perrotin committed
28
dataview:	${DATAVIEW_PATH}/built
Maxime Perrotin's avatar
Maxime Perrotin committed
29

Maxime Perrotin's avatar
Maxime Perrotin committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@@INLINE(${DATAVIEW_PATH}/built:	dataview/C/built )( )()@@
   @@IF@@ @_Need_Ada_@ = TRUE
      dataview/Ada/built
   @@END_IF@@
   @@TABLE@@
      @@IF@@ @_Unique_Languages_@ /= "Ada" and @_Unique_Languages_@ /= "SDL" and @_Unique_Languages_@ /= "C" and @_Unique_Languages_@ /= "CPP" and @_Unique_Languages_@ /= "Blackbox_C" and @_Unique_Languages_@ /= "GUI"
      dataview/@_Unique_Languages_@/built
      @@END_IF@@
   @@END_TABLE@@
   # Build dataviews for all languages
@@END_INLINE@@
	touch $@

build-native:	aadl2glueC build/system_config.h | ${DATAVIEW_PATH}/built
Maxime Perrotin's avatar
Maxime Perrotin committed
44
	$(MAKE) -j -C build -f Makefile.taste
Maxime Perrotin's avatar
Maxime Perrotin committed
45
46

build-rtems-ada:	aadl2glueC build/system_config.h | ${DATAVIEW_PATH}/built
Maxime Perrotin's avatar
Maxime Perrotin committed
47
	$(MAKE) -j -C build -f Makefile.taste rtems_ada
Maxime Perrotin's avatar
Maxime Perrotin committed
48

Maxime Perrotin's avatar
Maxime Perrotin committed
49
air:	aadl2glueC build/system_config.h | ${DATAVIEW_PATH}/built
Maxime Perrotin's avatar
Maxime Perrotin committed
50
	$(MAKE) -j -C build -f Makefile.taste air
51

Maxime Perrotin's avatar
Maxime Perrotin committed
52
@@INLINE(${DATAVIEW_UNIQ}:	)( )()@@
Maxime Perrotin's avatar
Maxime Perrotin committed
53
54
55
56
        @@TABLE@@
           @_ASN1_Files_@
        @@END_TABLE@@
@@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
57
	mkdir -p ${PROJECT_CACHE} && mkdir -p ${DATAVIEW_PATH}
Maxime Perrotin's avatar
Maxime Perrotin committed
58
59
	@@-- Create dataview-uniq.asn
	@@INLINE(	)( )(\n)@@
Maxime Perrotin's avatar
Maxime Perrotin committed
60
        for f in $^ ; do cat "$$f"; echo; done > $@
Maxime Perrotin's avatar
Maxime Perrotin committed
61
	@@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
62
63

build/system_config.h:  # This is fast, no need to have dependencies
64
65
66
67
	@@-- Create system_config.h by concatenating all functions partial system config files
	@@INLINE(	)( )(\n)@@
        for f in
        @@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
68
	@@IF@@ not @_Is_Type_@
69
	    @_LOWER:Function_Names_@/@_Language_@/wrappers/@_LOWER:Function_Names_@_system_config.h
Maxime Perrotin's avatar
Maxime Perrotin committed
70
	@@END_IF@@
71
        @@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
72
; do cat $$f; echo; done > build/system_config.h
73
	@@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
74
75
76
77
78
79
80
81
82
83

@@INLINE(aadl2glueC:	)( )()@@
        @@TABLE@@
	@@IF@@ not @_Is_Type_@
            @_LOWER:Function_Names_@/@_Language_@/wrappers/aadl2glueC_built
	@@END_IF@@
	@@END_TABLE@@
@@END_INLINE@@

${DATAVIEW_AADLV1}: ${DATAVIEW_UNIQ}
84
	@@-- Generate DataView.aadl in AADLV1 as this is needed by aadl2glueC
Maxime Perrotin's avatar
Maxime Perrotin committed
85
86
87
	asn2aadlPlus $< $@

@@-- For each function generate the glue code from DMT based on the dataview
88
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
89
	@@IF@@ not @_Is_Type_@
Maxime Perrotin's avatar
Maxime Perrotin committed
90
@_LOWER:Function_Names_@/@_Language_@/wrappers/aadl2glueC_built: @_LOWER:Function_Names_@/@_Language_@/wrappers/@_LOWER:Function_Names_@_mini_cv.aadl ${DATAVIEW_AADLV1}
Maxime Perrotin's avatar
Maxime Perrotin committed
91
92
93
	aadl2glueC -o $(dir $@) ${DATAVIEW_AADLV1} $<
	touch $@

Maxime Perrotin's avatar
Maxime Perrotin committed
94
	@@END_IF@@
95
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
96
97
98
99

@@-- Then generate Dataviews once per target language - first for C, it is needed in any case
dataview/C/built: | ${DATAVIEW_UNIQ}
	mkdir -p $(dir $@) && asn2dataModel -o $(dir $@) -toC ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
100
101
102
103
	@@INLINE(	)( \\\n	)(\n)@@
	    @@TABLE@@
               @_REPLACE(,/ ):CP_Files_@
	    @@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
104
	@@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
105
106
107
108
109

	cp $(shell taste-config --prefix)/share/AutoGUI/debug_messages.? dataview/C
	cp $(shell taste-config --prefix)/share/AutoGUI/timeInMS.? dataview/C
	cd dataview/C && msgPrinter ${DATAVIEW_UNIQ} && msgPrinterASN1 ${DATAVIEW_UNIQ}
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
110
        @@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
111
	   @@IF@@ @_Unique_Languages_@ = "Ada" or @_Unique_Languages_@ = "SDL"
Maxime Perrotin's avatar
Maxime Perrotin committed
112
113
              @@SET@@ Enable=FALSE
              @@SET@@ Need_Ada=TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
114
	   @@ELSIF@@ @_Unique_Languages_@ = "C" or @_Unique_Languages_@ = "CPP" or @_Unique_Languages_@ = "Blackbox_C" or @_Unique_Languages_@ = "GUI"
Maxime Perrotin's avatar
Maxime Perrotin committed
115
              @@SET@@ Enable=FALSE
Maxime Perrotin's avatar
Maxime Perrotin committed
116
	   @@ELSE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
117
              @@SET@@ Enable=TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
118
119
              @@SET@@ Lang=@_Unique_Languages_@
	   @@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
120
           @@IF@@ Enable=TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
121
dataview/@_Lang_@/built: | ${DATAVIEW_UNIQ}
Maxime Perrotin's avatar
Maxime Perrotin committed
122
               @@INLINE(	)(\n	)(\n)@@
Maxime Perrotin's avatar
Maxime Perrotin committed
123
                  mkdir -p $(dir $@) && asn2dataModel -o $(dir $@) -to@_Lang_@ ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
124
125
126
127
128
129
                  @@INLINE(	)( \\\n	)(\n	)@@
                     @@TABLE@@
                        @_REPLACE(,/ ):CP_Files_@
                     @@END_TABLE@@
                  @@END_INLINE@@
               @@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
130
131

	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
132
133
	   @@END_IF@@
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
134

Maxime Perrotin's avatar
Maxime Perrotin committed
135
	@@IF@@ @_Need_Ada_@=TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
136
137
dataview/Ada/built: | ${DATAVIEW_UNIQ}
	mkdir -p $(dir $@) && asn2dataModel -o $(dir $@) -toAda ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
138
139
140
141
	@@INLINE(	)( \\\n	)(\n)@@
	    @@TABLE@@
               @_REPLACE(,/ ):CP_Files_@
	    @@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
142
143
	@@END_INLINE@@

Maxime Perrotin's avatar
Maxime Perrotin committed
144
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
145
	cd dataview/Ada && rm -f gnat.cfg GPS_project.gpr IgnoredExaminerWarnings.wrn runSpark.sh
Maxime Perrotin's avatar
Maxime Perrotin committed
146
        @@END_IF@@
147
148
	@@-- Then symlink the files for each function
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
149
	@@IF@@ @_Language_@ = "SDL"
Maxime Perrotin's avatar
Maxime Perrotin committed
150
	ln -fs ${DATAVIEW_UNIQ} @_LOWER:Function_Names_@/@_Language_@/src
151
	@@END_IF@@
152
	@@END_TABLE@@
153

Maxime Perrotin's avatar
Maxime Perrotin committed
154
function-types-linux:
Maxime Perrotin's avatar
Maxime Perrotin committed
155
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
156
	@@IF@@ @_Is_Type_@
Maxime Perrotin's avatar
Maxime Perrotin committed
157
	cd @_LOWER:Function_Names_@/@_Language_@ && $(MAKE) -j compile-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
158
	@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
159
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
160

Maxime Perrotin's avatar
Maxime Perrotin committed
161
function-instances-linux:	function-types-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
162
163
	@@TABLE@@
	@@IF@@ not @_Is_Type_@
Maxime Perrotin's avatar
Maxime Perrotin committed
164
	cd @_LOWER:Function_Names_@/@_Language_@ && $(MAKE) -j compile-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
165
166
167
	@@END_IF@@
	@@END_TABLE@@

Maxime Perrotin's avatar
Maxime Perrotin committed
168
compile-all-linux:	dataviews function-instances-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
169
170
171

clean:
	rm -rf binaries/*
Maxime Perrotin's avatar
Maxime Perrotin committed
172
	$(MAKE) -C build -f Makefile.taste clean
Maxime Perrotin's avatar
Maxime Perrotin committed
173
174

.PHONY: clean compile-all-linux function-instances-linux function-types-linux build-native dataview build-rtems-ada