makefile.tmplt 8.9 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
@@-- @_ASN1_Files_@          : List of all ASN.1 files
9
@@-- @_ACN_Files_@           : List of all ACN files
10
@@-- @_ASN1_Modules_@        : List of all ASN.1 modules
11 12
# MAKEFILE_PATH   := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_PATH   := $(lastword $(MAKEFILE_LIST))
Maxime Perrotin's avatar
Maxime Perrotin committed
13 14 15
OUTDIR          := $(dir $(MAKEFILE_PATH))
DATAVIEW_PATH   := ${OUTDIR}/dataview
DATAVIEW_UNIQ   := ${DATAVIEW_PATH}/dataview-uniq.asn
16 17
@@IF@@ @_ACN_Files'Length_@ > 0
DATAVIEW_ACN    := ${DATAVIEW_PATH}/dataview-uniq.acn
Maxime Perrotin's avatar
Maxime Perrotin committed
18 19
@@ELSE@@
DATAVIEW_ACN    :=
20
@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
21
DATAVIEW_AADLV1 := ${DATAVIEW_PATH}/dataview_aadlv1.aadl
22
DATAVIEW_AADLV2 := ${DATAVIEW_PATH}/dataview_aadlv2.aadl
Maxime Perrotin's avatar
Maxime Perrotin committed
23

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

27
all:	build-default
Maxime Perrotin's avatar
Maxime Perrotin committed
28

29
@@-- global check to check which dataviews are neeeded
Maxime Perrotin's avatar
Maxime Perrotin committed
30 31 32
@@TABLE@@
  @@IF@@ @_Unique_Languages_@ = "Ada" or @_Unique_Languages_@ = "SDL"
     @@SET@@ Need_Ada=TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
33 34 35 36
  @@ELSIF@@ @_Unique_Languages_@ /= "C" and @_Unique_Languages_@ /= "CPP" and @_Unique_Languages_@ /= "Blackbox_C" and @_Unique_Languages_@ /= "GUI"
     @@SET@@ Other_DataViews=TRUE
  @@ELSIF@@ @_Unique_Languages_@ = GUI
     @@SET@@ Has_GUI=TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
37 38
  @@END_IF@@
@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
39

40
# Generate the language-specific data view needed before editing user code
Maxime Perrotin's avatar
Maxime Perrotin committed
41 42 43
@@IF@@ not @_Need_Ada_@ and not @_Other_DataViews_@
dataview:	dataview/C/built
@@END_IF@@
44
@@INLINE(dataview:	dataview/C/built )( )()@@
Maxime Perrotin's avatar
Maxime Perrotin committed
45 46 47
   @@IF@@ @_Need_Ada_@ = TRUE
      dataview/Ada/built
   @@END_IF@@
48
   @@TABLE@@  @@-- Exclude Python because it depends on information from the deployment view and it is not needed for the skeletons
Maxime Perrotin's avatar
Maxime Perrotin committed
49
      @@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"
50 51 52 53 54 55
         dataview/@_Unique_Languages_@/built
      @@END_IF@@
   @@END_TABLE@@
@@END_INLINE@@

# Generate the complete dataview, including Python bindings if there is a GUI
Maxime Perrotin's avatar
Maxime Perrotin committed
56 57 58 59 60
@@IF@@ @_Has_GUI_@
${DATAVIEW_PATH}/built:	dataview dataview/Python/built
@@ELSE@@
${DATAVIEW_PATH}/built:	dataview
@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
61 62
	touch $@

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

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

70
air:	aadl2glueC build/system_config.h ${DATAVIEW_PATH}/built build/deploymentview_final/Makefile
Maxime Perrotin's avatar
Maxime Perrotin committed
71
	$(MAKE) -j -C build -f Makefile.taste air
72

73
# Rule to invoke Ocarina (generation of POHI middleware code)
74 75
build/deploymentview_final/Makefile:	build/main.aadl ${DATAVIEW_AADLV2} ../ConcurrencyView_Properties.aadl
	taste-patch-cv-properties.py build/system.aadl ../ConcurrencyView_Properties.aadl
76 77
	cd build && ocarina -x main.aadl

78 79 80 81 82
@@-- 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.
../ConcurrencyView_Properties.aadl:
	touch $@

83 84
# Create dataview-uniq.asn by concatenating all asn1 input files
${DATAVIEW_UNIQ}:	@_REPLACE_ALL(,/):ASN1_Files_@
Maxime Perrotin's avatar
Maxime Perrotin committed
85
	mkdir -p ${PROJECT_CACHE} && mkdir -p ${DATAVIEW_PATH}
Maxime Perrotin's avatar
Maxime Perrotin committed
86
	@@-- Don't use cat, because files need newlines in between
Maxime Perrotin's avatar
Maxime Perrotin committed
87 88 89 90 91 92 93 94 95
	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
96

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
97 98
build/system_config.h:	$(wildcard */*/wrappers/*_system_config.h)
	cat $^ > $@
Maxime Perrotin's avatar
Maxime Perrotin committed
99 100 101 102 103 104 105 106 107 108

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

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

112 113
${DATAVIEW_AADLV2}: ${DATAVIEW_UNIQ}
	@@-- Generate DataView.aadl in AADLV2 without -f flag
Maxime Perrotin's avatar
Maxime Perrotin committed
114
	asn2aadlPlus --aadlv2  $< $@
115

Maxime Perrotin's avatar
Maxime Perrotin committed
116
@@-- For each function generate the glue code from DMT based on the dataview
117
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
118
	@@IF@@ not @_Is_Type_@
Maxime Perrotin's avatar
Maxime Perrotin committed
119
@_LOWER:Function_Names_@/@_Language_@/wrappers/aadl2glueC_built: @_LOWER:Function_Names_@/@_Language_@/wrappers/@_LOWER:Function_Names_@_mini_cv.aadl ${DATAVIEW_AADLV1}
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
120
	aadl2glueC -o $(dir $@) $^
Maxime Perrotin's avatar
Maxime Perrotin committed
121 122
	touch $@

Maxime Perrotin's avatar
Maxime Perrotin committed
123
	@@END_IF@@
124
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
125 126

@@-- Then generate Dataviews once per target language - first for C, it is needed in any case
Maxime Perrotin's avatar
Maxime Perrotin committed
127
dataview/C/built: ${DATAVIEW_UNIQ} ${DATAVIEW_ACN}
128
	mkdir -p $(dir $@)
Maxime Perrotin's avatar
Maxime Perrotin committed
129 130 131
	# asn2dataModel does not take the ACN files, and only calls asn1.exe
	# asn2dataModel -o $(dir $@) -toC ${DATAVIEW_UNIQ} ${DATAVIEW_ACN}
	asn1.exe -typePrefix asn1Scc -equal -fp AUTO -o $(dir $@) -c -uPER -ACN ${DATAVIEW_UNIQ} ${DATAVIEW_ACN} @_REPLACE_ALL(,/):CP_Files_@
Maxime Perrotin's avatar
Maxime Perrotin committed
132 133
	cp $(shell taste-config --prefix)/share/AutoGUI/debug_messages.? dataview/C
	cp $(shell taste-config --prefix)/share/AutoGUI/timeInMS.? dataview/C
134 135
	cd dataview/C && msgPrinter ../dataview-uniq.asn
	cd dataview/C && msgPrinterASN1  ../dataview-uniq.asn
Maxime Perrotin's avatar
Maxime Perrotin committed
136
	touch $@
137

Maxime Perrotin's avatar
Maxime Perrotin committed
138
        @@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
139
	   @@IF@@ @_Unique_Languages_@ = "Ada" or @_Unique_Languages_@ = "SDL"
Maxime Perrotin's avatar
Maxime Perrotin committed
140
              @@SET@@ Need_Ada=TRUE
141
	   @@ELSIF@@ @_Unique_Languages_@ = "C" or @_Unique_Languages_@ = "CPP" or @_Unique_Languages_@ = "Blackbox_C"
142
           @@--  do nothing, C is always done, only once
143
	   @@ELSIF@@ @_Unique_Languages_@ = "GUI"
144
           @@--  for DMT, GUI means Python
145 146 147 148 149 150 151 152 153
@@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@@
@@END_INLINE@@
154 155
	mkdir -p $(dir $@)
	asn2dataModel -o $(dir $@) -toPython ${DATAVIEW_UNIQ}  @@-- Ignore context parameters for python interface
156
	$(MAKE) -C dataview/Python -f Makefile.python
157 158
        @@TABLE@@
        @@IF@@ @_Language_@ = GUI
159 160
	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
161 162
	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
163 164 165 166 167
	   gcc -g -shared -o PythonAccess.so gui_api.o queue_manager.o timeInMS.o debug_messages.o `python-config --ldflags` -lrt
	mkdir -p binaries/@_LOWER:Function_Names_@_GUI 
	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
168 169 170
        @@END_IF@@
        @@END_TABLE@@
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
171
	   @@ELSE@@
172
dataview/@_Unique_Languages_@/built: ${DATAVIEW_UNIQ}
Maxime Perrotin's avatar
Maxime Perrotin committed
173
               @@INLINE(	)(\n	)(\n)@@
174
                  mkdir -p $(dir $@) && asn2dataModel -o $(dir $@) -to@_Unique_Languages_@ ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
175 176 177 178 179 180
                  @@INLINE(	)( \\\n	)(\n	)@@
                     @@TABLE@@
                        @_REPLACE(,/ ):CP_Files_@
                     @@END_TABLE@@
                  @@END_INLINE@@
               @@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
181
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
182 183
	   @@END_IF@@
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
184

Maxime Perrotin's avatar
Maxime Perrotin committed
185
	@@IF@@ @_Need_Ada_@=TRUE
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
186
dataview/Ada/built: ${DATAVIEW_UNIQ}
187 188
	mkdir -p $(dir $@)
	asn2dataModel -o $(dir $@) -toAda ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
189 190 191 192
	@@INLINE(	)( \\\n	)(\n)@@
	    @@TABLE@@
               @_REPLACE(,/ ):CP_Files_@
	    @@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
193 194
	@@END_INLINE@@

Maxime Perrotin's avatar
Maxime Perrotin committed
195
	touch $@
196 197
	cd dataview/Ada
	rm -f gnat.cfg GPS_project.gpr IgnoredExaminerWarnings.wrn runSpark.sh
Maxime Perrotin's avatar
Maxime Perrotin committed
198
        @@END_IF@@
199 200
	@@-- Then symlink the files for each function
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
201
	@@IF@@ @_Language_@ = "SDL"
202
	ln -fs ../../../${DATAVIEW_UNIQ} @_LOWER:Function_Names_@/@_Language_@/src
203
	@@END_IF@@
204
	@@END_TABLE@@
205

Maxime Perrotin's avatar
Maxime Perrotin committed
206
function-types-linux:
Maxime Perrotin's avatar
Maxime Perrotin committed
207
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
208
	@@IF@@ @_Is_Type_@
209
	$(MAKE) -j -C @_LOWER:Function_Names_@/@_Language_@ compile-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
210
	@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
211
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
212

Maxime Perrotin's avatar
Maxime Perrotin committed
213
function-instances-linux:	function-types-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
214 215
	@@TABLE@@
	@@IF@@ not @_Is_Type_@
216
	$(MAKE) -C @_LOWER:Function_Names_@/@_Language_@ -j compile-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
217 218 219
	@@END_IF@@
	@@END_TABLE@@

Maxime Perrotin's avatar
Maxime Perrotin committed
220
compile-all-linux:	dataviews function-instances-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
221 222

clean:
223
	rm -rf binaries dataview
Maxime Perrotin's avatar
Maxime Perrotin committed
224
	$(MAKE) -C build -f Makefile.taste clean
Maxime Perrotin's avatar
Maxime Perrotin committed
225

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