makefile.tmplt 6.36 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
10
11
# MAKEFILE_PATH   := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_PATH   := $(lastword $(MAKEFILE_LIST))
Maxime Perrotin's avatar
Maxime Perrotin committed
12
13
14
15
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
16

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

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

Maxime Perrotin's avatar
Maxime Perrotin committed
22
23
24
25
26
27
@@-- 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
28

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

Maxime Perrotin's avatar
Maxime Perrotin committed
31
32
33
34
35
36
37
@@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
38
39
      @@ELSIF@@ @_Unique_Languages_@ = GUI
      dataview/Python/built
Maxime Perrotin's avatar
Maxime Perrotin committed
40
41
42
43
44
45
      @@END_IF@@
   @@END_TABLE@@
   # Build dataviews for all languages
@@END_INLINE@@
	touch $@

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

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

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
52
air:	aadl2glueC build/system_config.h ${DATAVIEW_PATH}/built
Maxime Perrotin's avatar
Maxime Perrotin committed
53
	$(MAKE) -j -C build -f Makefile.taste air
54

Maxime Perrotin's avatar
Maxime Perrotin committed
55
@@INLINE(${DATAVIEW_UNIQ}:	)( )()@@
Maxime Perrotin's avatar
Maxime Perrotin committed
56
57
58
59
        @@TABLE@@
           @_ASN1_Files_@
        @@END_TABLE@@
@@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
60
	mkdir -p ${PROJECT_CACHE} && mkdir -p ${DATAVIEW_PATH}
Maxime Perrotin's avatar
Maxime Perrotin committed
61
62
	@@-- Create dataview-uniq.asn
	@@INLINE(	)( )(\n)@@
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
63
        cat $^ > $@
Maxime Perrotin's avatar
Maxime Perrotin committed
64
	@@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
65

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
66
67
build/system_config.h:	$(wildcard */*/wrappers/*_system_config.h)
	cat $^ > $@
Maxime Perrotin's avatar
Maxime Perrotin committed
68
69
70
71
72
73
74
75
76
77

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

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

@@-- For each function generate the glue code from DMT based on the dataview
82
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
83
	@@IF@@ not @_Is_Type_@
Maxime Perrotin's avatar
Maxime Perrotin committed
84
@_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
85
	aadl2glueC -o $(dir $@) $^
Maxime Perrotin's avatar
Maxime Perrotin committed
86
87
	touch $@

Maxime Perrotin's avatar
Maxime Perrotin committed
88
	@@END_IF@@
89
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
90
91

@@-- Then generate Dataviews once per target language - first for C, it is needed in any case
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
92
dataview/C/built: ${DATAVIEW_UNIQ}
93
94
	mkdir -p $(dir $@)
	asn2dataModel -o $(dir $@) -toC ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
95
96
97
98
	@@INLINE(	)( \\\n	)(\n)@@
	    @@TABLE@@
               @_REPLACE(,/ ):CP_Files_@
	    @@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
99
	@@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
100
101
102

	cp $(shell taste-config --prefix)/share/AutoGUI/debug_messages.? dataview/C
	cp $(shell taste-config --prefix)/share/AutoGUI/timeInMS.? dataview/C
103
104
	cd dataview/C && msgPrinter ../dataview-uniq.asn
	cd dataview/C && msgPrinterASN1  ../dataview-uniq.asn
Maxime Perrotin's avatar
Maxime Perrotin committed
105
	touch $@
106

Maxime Perrotin's avatar
Maxime Perrotin committed
107
        @@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
108
	   @@IF@@ @_Unique_Languages_@ = "Ada" or @_Unique_Languages_@ = "SDL"
Maxime Perrotin's avatar
Maxime Perrotin committed
109
              @@SET@@ Need_Ada=TRUE
110
	   @@ELSIF@@ @_Unique_Languages_@ = "C" or @_Unique_Languages_@ = "CPP" or @_Unique_Languages_@ = "Blackbox_C"
111
           @@--  do nothing, C is always done, only once
112
	   @@ELSIF@@ @_Unique_Languages_@ = "GUI"
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
           @@--  for DMT, GUI means Python
dataview/Python/built: ${DATAVIEW_UNIQ}
	mkdir -p $(dir $@)
	asn2dataModel -o $(dir $@) -toPython ${DATAVIEW_UNIQ}  @@-- Ignore context parameters for python interface
	$(MAKE) -C dataview/Python -f Makefile.python
        @@TABLE@@
        @@IF@@ @_Language_@ = GUI
	cp  dataview/Python/* @_LOWER:Function_Names_@/GUI/wrappers/python
	cp  dataview/C/* @_LOWER:Function_Names_@/GUI/wrappers/python
	cp  dataview/C/* @_LOWER:Function_Names_@/GUI/wrappers/python
	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 && \
	   gcc -g -shared -o PythonAccess.so gui_api.o queue_manager.o timeInMS.o debug_messages.o `python-config --ldflags` -lrt
        @@END_IF@@
        @@END_TABLE@@
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
129
	   @@ELSE@@
130
dataview/@_Unique_Languages_@/built: ${DATAVIEW_UNIQ}
Maxime Perrotin's avatar
Maxime Perrotin committed
131
               @@INLINE(	)(\n	)(\n)@@
132
                  mkdir -p $(dir $@) && asn2dataModel -o $(dir $@) -to@_Unique_Languages_@ ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
133
134
135
136
137
138
                  @@INLINE(	)( \\\n	)(\n	)@@
                     @@TABLE@@
                        @_REPLACE(,/ ):CP_Files_@
                     @@END_TABLE@@
                  @@END_INLINE@@
               @@END_INLINE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
139
	touch $@
Maxime Perrotin's avatar
Maxime Perrotin committed
140
141
	   @@END_IF@@
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
142

Maxime Perrotin's avatar
Maxime Perrotin committed
143
	@@IF@@ @_Need_Ada_@=TRUE
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
144
dataview/Ada/built: ${DATAVIEW_UNIQ}
145
146
	mkdir -p $(dir $@)
	asn2dataModel -o $(dir $@) -toAda ${DATAVIEW_UNIQ} \
Maxime Perrotin's avatar
Maxime Perrotin committed
147
148
149
150
	@@INLINE(	)( \\\n	)(\n)@@
	    @@TABLE@@
               @_REPLACE(,/ ):CP_Files_@
	    @@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
151
152
	@@END_INLINE@@

Maxime Perrotin's avatar
Maxime Perrotin committed
153
	touch $@
154
155
	cd dataview/Ada
	rm -f gnat.cfg GPS_project.gpr IgnoredExaminerWarnings.wrn runSpark.sh
Maxime Perrotin's avatar
Maxime Perrotin committed
156
        @@END_IF@@
157
158
	@@-- Then symlink the files for each function
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
159
	@@IF@@ @_Language_@ = "SDL"
160
	ln -fs ../../../${DATAVIEW_UNIQ} @_LOWER:Function_Names_@/@_Language_@/src
161
	@@END_IF@@
162
	@@END_TABLE@@
163

Maxime Perrotin's avatar
Maxime Perrotin committed
164
function-types-linux:
Maxime Perrotin's avatar
Maxime Perrotin committed
165
	@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
166
	@@IF@@ @_Is_Type_@
167
	$(MAKE) -j -C @_LOWER:Function_Names_@/@_Language_@ compile-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
168
	@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
169
	@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
170

Maxime Perrotin's avatar
Maxime Perrotin committed
171
function-instances-linux:	function-types-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
172
173
	@@TABLE@@
	@@IF@@ not @_Is_Type_@
174
	$(MAKE) -C @_LOWER:Function_Names_@/@_Language_@ -j compile-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
175
176
177
	@@END_IF@@
	@@END_TABLE@@

Maxime Perrotin's avatar
Maxime Perrotin committed
178
compile-all-linux:	dataviews function-instances-linux
Maxime Perrotin's avatar
Maxime Perrotin committed
179
180
181

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

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