makefile.tmplt 11.5 KB
Newer Older
1
2
3
@@-- The up to date list of tags available for this template is available here:
@@-- https://taste.tuxfamily.org/wiki/index.php?title=Kazoo_Templates_Documentation#templates.2Fskeletons.2Fmakefile.tmplt
@@-- If you are using vim, go over the URL and pres gx in to follow the link
Maxime Perrotin's avatar
Maxime Perrotin committed
4
5
@@-- If you have no internet access you can also use (with vim) Ctrl-W-f then Ctrl-W-L (or gf)
@@-- in vim to open the doc: $HOME/tool-inst/share/kazoo/doc/templates_skeletons_makefile.ascii
6
@@--
7
8
# MAKEFILE_PATH   := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_PATH   := $(lastword $(MAKEFILE_LIST))
9
TOOL_INST       := $(shell taste-config --prefix)
Maxime Perrotin's avatar
Maxime Perrotin committed
10
OUTDIR          := $(dir $(MAKEFILE_PATH))
11
12
ASN1_FILES      := @_REPLACE_ALL(,/):ASN1_Files_@
CP_FILES        := @_REPLACE_ALL(,/):CP_Files_@      # Context parameters
Maxime Perrotin's avatar
Maxime Perrotin committed
13
14
DATAVIEW_PATH   := ${OUTDIR}/dataview
DATAVIEW_UNIQ   := ${DATAVIEW_PATH}/dataview-uniq.asn
15
16
@@IF@@ @_ACN_Files'Length_@ > 0
DATAVIEW_ACN    := ${DATAVIEW_PATH}/dataview-uniq.acn
Maxime Perrotin's avatar
Maxime Perrotin committed
17
18
@@ELSE@@
DATAVIEW_ACN    :=
19
@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
20
DATAVIEW_AADLV1 := ${DATAVIEW_PATH}/dataview_aadlv1.aadl
21
DATAVIEW_AADLV2 := ${DATAVIEW_PATH}/dataview_aadlv2.aadl
Maxime Perrotin's avatar
Maxime Perrotin committed
22

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

Maxime Perrotin's avatar
Maxime Perrotin committed
26
@@IF@@ @_Target_@ /= SIMU
27
all:	build-default
Maxime Perrotin's avatar
Maxime Perrotin committed
28
@@ELSE@@
29
30
@@-- for pure simulation target, force the generation of the Ada dataview
@@SET@@ Need_Ada = TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
31
# Build a simulator of the system (experimental)
32
all:	aadl2glueC build/system_config.h ${DATAVIEW_PATH}/built 
Maxime Perrotin's avatar
Maxime Perrotin committed
33
	cd dataview && taste-asn1-iterators --raw dataview-uniq.asn
34
	$(MAKE) -j -C build -f Makefile.taste simu
Maxime Perrotin's avatar
Maxime Perrotin committed
35
@@END_IF@@
36

37
@@-- global check to check which dataviews are neeeded
Maxime Perrotin's avatar
Maxime Perrotin committed
38
@@TABLE@@
39
  @@IF@@ @_Unique_Languages_@ = Ada or @_Unique_Languages_@ = SDL
Maxime Perrotin's avatar
Maxime Perrotin committed
40
     @@SET@@ Need_Ada=TRUE
41
  @@ELSIF@@ @_Unique_Languages_@ /= C and @_Unique_Languages_@ /= CPP and @_Unique_Languages_@ /= Blackbox_C and @_Unique_Languages_@ /= GUI and @_Unique_Languages_@ /= Timer_Manager
Maxime Perrotin's avatar
Maxime Perrotin committed
42
43
44
     @@SET@@ Other_DataViews=TRUE
  @@ELSIF@@ @_Unique_Languages_@ = GUI
     @@SET@@ Has_GUI=TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
45
46
  @@END_IF@@
@@END_TABLE@@
47
# Generate the language-specific data view needed before editing user code
Maxime Perrotin's avatar
Maxime Perrotin committed
48
49
50
@@IF@@ not @_Need_Ada_@ and not @_Other_DataViews_@
dataview:	dataview/C/built
@@END_IF@@
51
@@INLINE(dataview:	dataview/C/built )( )()@@
Maxime Perrotin's avatar
Maxime Perrotin committed
52
53
54
   @@IF@@ @_Need_Ada_@ = TRUE
      dataview/Ada/built
   @@END_IF@@
55
   @@TABLE@@  @@-- Exclude Python because it depends on information from the deployment view and it is not needed for the skeletons
56
      @@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 and @_Unique_Languages_@ /= Timer_Manager
57
58
59
60
         dataview/@_Unique_Languages_@/built
      @@END_IF@@
   @@END_TABLE@@
@@END_INLINE@@
61
62
63
64
65
66
67
68
69
70
71
72
@@-- for SDL, copy the dataview to the function folder
@@TABLE@@
  @@IF@@ @_Language_@ = SDL
    @@IF@@ @_Has_Context_Param_@
	# SDL function with context parameters: put them in dataview
	sed -e '$$s/$$/\n/' -s ${DATAVIEW_UNIQ} @_LOWER:Function_Names_@/SDL/Context-@_LOWER:REPLACE_ALL(_/-):Function_Names_@.asn > @_LOWER:Function_Names_@/SDL/src/dataview-uniq.asn
    @@ELSE@@
	# Copy the dataview to SDL function @_Function_Names_@ (no context parameters)
	cp -u ${DATAVIEW_UNIQ} @_LOWER:Function_Names_@/SDL/src
    @@END_IF@@
  @@END_IF@@
@@END_TABLE@@
73
74

# Generate the complete dataview, including Python bindings if there is a GUI
Maxime Perrotin's avatar
Maxime Perrotin committed
75
76
77
78
79
@@IF@@ @_Has_GUI_@
${DATAVIEW_PATH}/built:	dataview dataview/Python/built
@@ELSE@@
${DATAVIEW_PATH}/built:	dataview
@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
80
81
	touch $@

82
# Build based on the deployment view
83
build-default:	aadl2glueC build/system_config.h ${DATAVIEW_PATH}/built build/deploymentview_final/Makefile
Maxime Perrotin's avatar
Maxime Perrotin committed
84
	$(MAKE) -j -C build -f Makefile.taste
Maxime Perrotin's avatar
Maxime Perrotin committed
85

86
# Force build with RTEMS/Leon, even if deployment view does not specify it
87
build-rtems-ada:	aadl2glueC build/system_config.h ${DATAVIEW_PATH}/built build/deploymentview_final/Makefile
Maxime Perrotin's avatar
Maxime Perrotin committed
88
	$(MAKE) -j -C build -f Makefile.taste rtems_ada
Maxime Perrotin's avatar
Maxime Perrotin committed
89

90
# Force build with AIR (TSP), even if deployment view does not specify it
91
air:	aadl2glueC build/system_config.h ${DATAVIEW_PATH}/built build/deploymentview_final/Makefile
Maxime Perrotin's avatar
Maxime Perrotin committed
92
	$(MAKE) -j -C build -f Makefile.taste air
93

94
# Rule to invoke Ocarina (generation of POHI middleware code)
95
build/deploymentview_final/Makefile:	build/main.aadl ${DATAVIEW_AADLV2} ../ConcurrencyView_Properties.aadl
96
	cd build ; ocarina -x main.aadl
97

98
99
@@-- ConcurrencyView_Properties is normally always present (even if empty) as
@@-- it is generated by the GUIs... Just in case it is not there, create it.
100
# Optionally hold thread priorities, offset, stack size. Create if not present
101
102
103
../ConcurrencyView_Properties.aadl:
	touch $@

104
105
106
107
108
109
110
@@-- SQL Database: can be created by taste-create-database
@@-- Add a dependency to make sure that if is is modified, the GUIs
@@-- Using it are properly updated
# Optionally manage SQL Database (run taste-create-database to enable)
sql_db/DV.py:
	mkdir -p sql_db && touch $@

111
# Create dataview-uniq.asn by concatenating all asn1 input files
112
${DATAVIEW_UNIQ}:	${ASN1_FILES}
Maxime Perrotin's avatar
Maxime Perrotin committed
113
	mkdir -p ${PROJECT_CACHE} && mkdir -p ${DATAVIEW_PATH}
Maxime Perrotin's avatar
Maxime Perrotin committed
114
	@@-- Don't use cat, because files need newlines in between
Maxime Perrotin's avatar
Maxime Perrotin committed
115
116
117
118
119
120
121
122
123
	sed -e '$$s/$$/\n/' -s $^ > $@

@@IF@@ @_ACN_Files'Length_@ > 0
# Create dataview-uniq.acn by concatenating all input files
${DATAVIEW_ACN}:	@_REPLACE_ALL(,/):ACN_Files_@
	mkdir -p ${DATAVIEW_PATH}
	@@-- Don't use cat, because files need newlines in between
	sed -e '$$s/$$/\n/' -s $^ > $@
@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
124

125
# system_config.h is used to filter out non-needed ASN.1 encoder/decoders
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
126
127
build/system_config.h:	$(wildcard */*/wrappers/*_system_config.h)
	cat $^ > $@
Maxime Perrotin's avatar
Maxime Perrotin committed
128

129
#  Call DMT/aadl2glueC to generate glue code from the mini-cv.aadl files
Maxime Perrotin's avatar
Maxime Perrotin committed
130
131
132
133
134
135
136
137
@@INLINE(aadl2glueC:	)( )()@@
        @@TABLE@@
	@@IF@@ not @_Is_Type_@
            @_LOWER:Function_Names_@/@_Language_@/wrappers/aadl2glueC_built
	@@END_IF@@
	@@END_TABLE@@
@@END_INLINE@@

138
# Build dataview.aadl in AADLv1 format, used by DMT to generate glue code
Maxime Perrotin's avatar
Maxime Perrotin committed
139
${DATAVIEW_AADLV1}: ${DATAVIEW_UNIQ}
140
	@@-- Generate DataView.aadl in AADLV1 as this is needed by aadl2glueC
141
	asn2aadlPlus  $< $@
Maxime Perrotin's avatar
Maxime Perrotin committed
142

143
# Build dataview.aadl in AADLv2 format, used by Ocarina to generate glue code
144
145
${DATAVIEW_AADLV2}: ${DATAVIEW_UNIQ}
	@@-- Generate DataView.aadl in AADLV2 without -f flag
Maxime Perrotin's avatar
Maxime Perrotin committed
146
	asn2aadlPlus --aadlv2  $< $@
147

Maxime Perrotin's avatar
Maxime Perrotin committed
148
@@-- For each function generate the glue code from DMT based on the dataview
149
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
150
	@@IF@@ not @_Is_Type_@
Maxime Perrotin's avatar
Maxime Perrotin committed
151
@_LOWER:Function_Names_@/@_Language_@/wrappers/aadl2glueC_built: @_LOWER:Function_Names_@/@_Language_@/wrappers/@_LOWER:Function_Names_@_mini_cv.aadl ${DATAVIEW_AADLV1}
152
	@@IF@@ @_Is_FPGA_@ and @_CPU_Platform_@ = PLATFORM_ZYNQZC706
153
154
	aadl2glueC -fpga ZYNQZC706 -o $(dir $@) $^
	@@ELSE@@
155
	aadl2glueC -allboards -o $(dir $@) $^
156
	@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
157
158
	touch $@

Maxime Perrotin's avatar
Maxime Perrotin committed
159
	@@END_IF@@
160
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
161
162

@@-- Then generate Dataviews once per target language - first for C, it is needed in any case
163
164
# Compile the ASN.1 models in C
dataview/C/built: ${DATAVIEW_UNIQ} ${DATAVIEW_ACN} ${CP_FILES}
165
	mkdir -p $(dir $@)
Maxime Perrotin's avatar
Maxime Perrotin committed
166
167
	# asn2dataModel does not take the ACN files, and only calls asn1.exe
	# asn2dataModel -o $(dir $@) -toC ${DATAVIEW_UNIQ} ${DATAVIEW_ACN}
168
	mono $(shell which asn1.exe) -typePrefix asn1Scc -equal -fp AUTO -o $(dir $@) -c -uPER -ACN $^
169
170
	cp ${TOOL_INST}/share/AutoGUI/debug_messages.? dataview/C
	cp ${TOOL_INST}/share/AutoGUI/timeInMS.? dataview/C
171
172
	cd dataview/C && msgPrinter ${DATAVIEW_UNIQ}
	cd dataview/C && msgPrinterASN1 ${DATAVIEW_UNIQ}
Maxime Perrotin's avatar
Maxime Perrotin committed
173
	touch $@
174

Maxime Perrotin's avatar
Maxime Perrotin committed
175
        @@TABLE@@
176
	   @@IF@@ @_Unique_Languages_@ = Ada or @_Unique_Languages_@ = SDL
Maxime Perrotin's avatar
Maxime Perrotin committed
177
              @@SET@@ Need_Ada=TRUE
178
	   @@ELSIF@@ @_Unique_Languages_@ = C or @_Unique_Languages_@ = CPP or @_Unique_Languages_@ = Blackbox_C or @_Unique_Languages_@ = Timer_Manager
179
           @@--  do nothing, C is always done, only once
180
	   @@ELSIF@@ @_Unique_Languages_@ = GUI
181
           @@--  for DMT, GUI means Python
182
# Compile the ASN.1 models in Python for the autogenerated GUIs
183
184
185
186
187
188
189
190
@@INLINE(dataview/Python/built:	dataview/C/built )( )()@@
        @@--  aadl2glueC has to be called before the python mapper is built
        @@--  because it depends on gui_api.c/etc.
        @@TABLE@@
          @@IF@@ @_Language_@ = GUI
             @_LOWER:Function_Names_@/GUI/wrappers/aadl2glueC_built
          @@END_IF@@
        @@END_TABLE@@
191
        sql_db/DV.py
192
@@END_INLINE@@
193
194
	mkdir -p $(dir $@)
	asn2dataModel -o $(dir $@) -toPython ${DATAVIEW_UNIQ}  @@-- Ignore context parameters for python interface
195
	$(MAKE) -C dataview/Python -f Makefile.python
196
197
        @@TABLE@@
        @@IF@@ @_Language_@ = GUI
198
199
	cp dataview/Python/* @_LOWER:Function_Names_@/GUI/wrappers/python
	cp dataview/C/timeInMS.[ch] dataview/C/debug_messages.c @_LOWER:Function_Names_@/GUI/wrappers/python
200
201
	cd @_LOWER:Function_Names_@/GUI/wrappers/python && \
	   gcc -g -fPIC -c `python-config --cflags`  gui_api.c ../../src/queue_manager.c timeInMS.c debug_messages.c -I. -I../../src && \
Maxime Perrotin's avatar
Maxime Perrotin committed
202
	   gcc -g -shared -o PythonAccess.so gui_api.o queue_manager.o timeInMS.o debug_messages.o `python-config --ldflags` -lrt
203
	mkdir -p binaries/@_LOWER:Function_Names_@_GUI
Maxime Perrotin's avatar
Maxime Perrotin committed
204
205
206
	cp -f @_LOWER:Function_Names_@/GUI/wrappers/python/* binaries/@_LOWER:Function_Names_@_GUI
	cp -f @_LOWER:Function_Names_@/GUI/wrappers/*.py binaries/@_LOWER:Function_Names_@_GUI
	cp -f @_LOWER:Function_Names_@/GUI/wrappers/*.ui binaries/@_LOWER:Function_Names_@_GUI
207
	@@-- Compute the error codes
Maxime Perrotin's avatar
Maxime Perrotin committed
208
209
	echo "errCodes = \\" >> binaries/@_LOWER:Function_Names_@_GUI/datamodel.py
	taste-asn1-errCodes binaries/@_LOWER:Function_Names_@_GUI/dataview-uniq.h >> binaries/@_LOWER:Function_Names_@_GUI/datamodel.py
210
211
212
        @@-- If system contains the PeekPoke component, copy the relevant code in the gui folder
        @@IF@@ @_LOWER:Function_Names_@ = taste_probe_console
	@# Peek-Poke function is placed in the gui folder
213
214
215
	cp ${TOOL_INST}/bin/taste-gnuplot-streams binaries/@_LOWER:Function_Names_@_GUI/driveGnuPlotsStreams.pl
	cp ${TOOL_INST}/share/peekpoke/peekpoke.py binaries/@_LOWER:Function_Names_@_GUI
	cp ${TOOL_INST}/share/peekpoke/PeekPoke.glade binaries/@_LOWER:Function_Names_@_GUI
216
217
218
        @@END_IF@@  @@-- End of PeekPoke-specifics
        @@-- Add symbolic link to the SQL Database interface for the GUIs, if needed
	if [ -f sql_db/db.info ]; then cd binaries/@_LOWER:Function_Names_@_GUI && ln -fs ../../sql_db; fi
219
220
        @@-- Copy default UserWidgets.py file for user to customise the GUI widgets
	# User can edit at will the customisable user widgets python module:
221
	cp -u ${TOOL_INST}/share/AutoGUI/UserWidgets.py binaries/@_LOWER:Function_Names_@_GUI
222
        @@-- Copy InterfaceView.aadl, it is needed to replay MSC scenarios
Maxime Perrotin's avatar
Maxime Perrotin committed
223
	#  Interface view must be placed in the gui folder to allow replaying MSCs
224
	cp -u ../InterfaceView.aadl binaries/@_LOWER:Function_Names_@_GUI
225
        @@END_IF@@  @@-- End of GUI-specifics
226
227
        @@END_TABLE@@
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
228
	   @@ELSE@@
229
dataview/@_Unique_Languages_@/built: ${DATAVIEW_UNIQ} # no context parameters except for C and Ada
230
	mkdir -p $(dir $@) && asn2dataModel -allboards -o $(dir $@) -to@_Unique_Languages_@ $^
231
	@@IF@@ @_Unique_Languages_@ = SIMULINK
Maxime Perrotin's avatar
Maxime Perrotin committed
232
233
234
	@@TABLE@@
	@@IF@@ @_Language_@ = SIMULINK
	cp -u $(dir $@)/* @_LOWER:Function_Names_@/SIMULINK/src
235
236
	@@END_IF@@
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
237
	@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
238
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
239
240
	   @@END_IF@@
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
241

Maxime Perrotin's avatar
Maxime Perrotin committed
242
	@@IF@@ @_Need_Ada_@=TRUE
243
dataview/Ada/built: ${DATAVIEW_UNIQ} ${CP_FILES}
244
	mkdir -p $(dir $@)
245
	asn2dataModel -allboards -o $(dir $@) -toAda $^
Maxime Perrotin's avatar
Maxime Perrotin committed
246
	touch $@
247
	cd dataview/Ada && rm -f gnat.cfg GPS_project.gpr IgnoredExaminerWarnings.wrn runSpark.sh
248
	@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
249
250

clean:
251
	rm -rf binaries dataview
Maxime Perrotin's avatar
Maxime Perrotin committed
252
	$(MAKE) -C build -f Makefile.taste clean
Maxime Perrotin's avatar
Maxime Perrotin committed
253

254
.PHONY: clean simu compile-all-linux function-instances-linux function-types-linux build-default dataview build-rtems-ada dataview