Update of the localization templates
[scilab.git] / scilab / modules / scicos / Makefile.modelica.am
1 # Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 # Copyright (C) 2008 - INRIA - Sylvestre Ledru <sylvestre.ledru@inria.fr>
3 # Copyright (C) 2010 - DIGITEO - Sylvestre Ledru
4 #
5 # This file must be used under the terms of the CeCILL.
6 # This source file is licensed as described in the file COPYING, which
7 # you should have received as part of this distribution.  The terms
8 # are also available at
9 # http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10
11 # TODO:
12 # * see if we can do more factorisation (on the lexer for example)
13
14 ######### Common Modelica elements #############
15
16 if XCOS
17 if OCAML
18 TARGET = modelicac XML2Modelica modelicat
19 BASE_PATH = $(srcdir)/src/
20 bin_PROGRAMS = $(TARGET)
21 OCAMLLIBS=nums.cma
22
23
24 ### XML2Modelica
25
26 XML2Modelica_SOURCES = $(MLS_XML2Modelica)
27 MLS_XML2Modelica= $(srcdir)/src/xml2modelica/xMLTree.ml $(srcdir)/src/xml2modelica/linenum.ml $(srcdir)/src/xml2modelica/stringParser.ml $(srcdir)/src/xml2modelica/stringLexer.ml $(srcdir)/src/xml2modelica/xMLParser.ml $(srcdir)/src/xml2modelica/xMLLexer.ml\
28         $(srcdir)/src/xml2modelica/modelicaCodeGenerator.ml $(srcdir)/src/xml2modelica/xML2Modelica.ml
29
30 BASE_PATH_XML2Modelica = $(srcdir)/src/xml2modelica
31
32
33 ### Translator 
34
35 modelicat_SOURCES = $(MLS_modelicat)
36
37 MLS_modelicat =  $(srcdir)/src/translator/compilation/types.ml \
38  $(srcdir)/src/translator/compilation/nameResolve.ml \
39  $(srcdir)/src/translator/instantiation/instantiation.ml \
40  $(srcdir)/src/translator/exceptionHandling/msgDico.ml \
41  $(srcdir)/src/translator/exceptionHandling/errorDico.ml \
42  $(srcdir)/src/translator/exceptionHandling/exceptHandler.ml \
43  $(srcdir)/src/translator/translation/libraryManager.ml \
44  $(srcdir)/src/translator/translation/codeGeneration.ml \
45  $(srcdir)/src/translator/translation/versiondate.ml \
46  $(srcdir)/src/translator/translation/translator.ml
47
48
49 MLS_SPECIFIC_PRE_modelicat = $(srcdir)/src/translator/parsing/syntax.ml \
50 $(srcdir)/src/translator/parsing/parser.ml \
51 $(srcdir)/src/translator/parsing/lexer.ml \
52 $(srcdir)/src/translator/parsing/linenum.ml
53
54 PARSER_SRC_modelicat = $(srcdir)/src/translator/parsing/parser.mly
55 LEXER_SRC_modelicat = $(srcdir)/src/translator/parsing/lexer.mll
56
57
58 INCLUDE_modelicat = -I $(srcdir)/src/translator/compilation \
59 -I $(srcdir)/src/translator/exceptionHandling \
60 -I $(srcdir)/src/translator/parsing \
61 -I $(srcdir)/src/translator/instantiation \
62 -I $(srcdir)/src/translator/translation
63
64 ### Modelicac
65
66 modelicac_SOURCES = $(MLS)
67
68
69 MLS = $(srcdir)/src/modelica_compiler/parseTree.ml \
70         $(srcdir)/src/modelica_compiler/linenum.ml \
71         $(srcdir)/src/modelica_compiler/parser.ml \
72         $(srcdir)/src/modelica_compiler/lexer.ml \
73         $(srcdir)/src/modelica_compiler/precompilation.ml \
74         $(srcdir)/src/modelica_compiler/compilation.ml \
75         $(srcdir)/src/modelica_compiler/instantiation.ml \
76         $(srcdir)/src/modelica_compiler/graphNodeSet.ml \
77         $(srcdir)/src/modelica_compiler/symbolicExpression.ml \
78         $(srcdir)/src/modelica_compiler/squareSparseMatrix.ml \
79         $(srcdir)/src/modelica_compiler/bipartiteGraph.ml \
80         $(srcdir)/src/modelica_compiler/hungarianMethod.ml \
81         $(srcdir)/src/modelica_compiler/causalityGraph.ml \
82         $(srcdir)/src/modelica_compiler/optimization.ml \
83         $(srcdir)/src/modelica_compiler/xMLCodeGeneration.ml \
84         $(srcdir)/src/modelica_compiler/optimizingCompiler.ml \
85         $(srcdir)/src/modelica_compiler/scicosCodeGeneration.ml \
86         $(srcdir)/src/modelica_compiler/scicosOptimizingCompiler.ml
87
88 # This is a basic copy of MLS with some elements removed
89 MLIS = $(srcdir)/src/modelica_compiler/parseTree.mli \
90         $(srcdir)/src/modelica_compiler/precompilation.mli \
91         $(srcdir)/src/modelica_compiler/compilation.mli \
92         $(srcdir)/src/modelica_compiler/instantiation.mli \
93         $(srcdir)/src/modelica_compiler/graphNodeSet.mli \
94         $(srcdir)/src/modelica_compiler/symbolicExpression.mli \
95         $(srcdir)/src/modelica_compiler/squareSparseMatrix.mli \
96         $(srcdir)/src/modelica_compiler/bipartiteGraph.mli \
97         $(srcdir)/src/modelica_compiler/hungarianMethod.mli \
98         $(srcdir)/src/modelica_compiler/causalityGraph.mli \
99         $(srcdir)/src/modelica_compiler/optimization.mli \
100         $(srcdir)/src/modelica_compiler/xMLCodeGeneration.mli \
101         $(srcdir)/src/modelica_compiler/optimizingCompiler.mli \
102         $(srcdir)/src/modelica_compiler/scicosCodeGeneration.mli
103
104 PARSER_SRC = $(srcdir)/src/modelica_compiler/parser.mly
105 LEXER_SRC = $(srcdir)/src/modelica_compiler/lexer.mll
106 BASE_PATH_MODELICAC = $(srcdir)/src/modelica_compiler
107
108 INCLUDE = -I $(BASE_PATH_MODELICAC) -I $(BASE_PATH_XML2Modelica)
109
110 ########## COMMON
111 SUFFIXES += .ml .mli .mll .mly .cmo .cmi .cmx
112
113
114 # @TODO check how to avoid the rebuild of the parser/lexer
115
116 .ml.cmo:
117         @if echo "$<"|grep src/translator; then \
118                 echo $(OCAMLC) $(INCLUDE_modelicat)  -c $<; \
119                 $(OCAMLC) $(INCLUDE_modelicat)  -c $<; \
120         else \
121                 echo $(OCAMLC) $(INCLUDE)  -c $<; \
122                 $(OCAMLC) $(INCLUDE)  -c $<; \
123         fi
124
125 .ml.cmx:
126         @if echo "$<"|grep src/translator; then \
127                 echo $(OCAMLOPT) $(INCLUDE_modelicat) -c $<; \
128                 $(OCAMLOPT) $(INCLUDE_modelicat) -c $<; \
129         else \
130                 echo $(OCAMLOPT) $(INCLUDE) -c $<; \
131                 $(OCAMLOPT) $(INCLUDE) -c $<; \
132         fi
133
134
135 .mli.cmi:
136         @if echo "$<"|grep src/translator; then \
137                 echo $(OCAMLC) $(INCLUDE_modelicat) -c $<; \
138                 $(OCAMLC) $(INCLUDE_modelicat) -c $<; \
139         else \
140                 echo $(OCAMLC) $(INCLUDE) -c $<; \
141                 $(OCAMLC) $(INCLUDE) -c $<; \
142         fi
143
144 .ml.mli:
145         @if echo "$<"|grep src/translator; then \
146                 echo $(OCAMLC) $(INCLUDE_modelicat) -c $<; \
147                 $(OCAMLC) $(INCLUDE_modelicat) -c $<; \
148         else \
149                 echo $(OCAMLC) $(INCLUDE) -c $<; \
150                 $(OCAMLC) $(INCLUDE) -c $<; \
151         fi
152
153
154 .mll.ml:
155         $(OCAMLLEX) $<
156
157 .mly.ml:
158         $(OCAMLYACC) $<
159
160 # call the ocaml/Yacc
161 generate-parser: $(PARSER_SRC)
162         $(OCAMLYACC) $(<)
163         $(RM) -f $(<:.mly=.mli)
164 # Crappy workaround to avoid bug 8013
165         touch src/modelica_compiler/*.mli
166
167 # Call the lexer
168 generate-lexer: $(LEXER_SRC)
169         $(OCAMLLEX) $(<)
170
171 # Build the binaries
172
173 modelicac:generate-parser generate-lexer $(MLIS:.mli=.cmi) $(MLS:.ml=.cmo) $(MLS:.ml=.cmx)
174         $(OCAMLOPT) -o modelicac $(INCLUDE) $(OCAMLLIBS:.cma=.cmxa) $(MLS:.ml=.cmx)
175
176
177 XML2Modelica: $(MLS_XML2Modelica:.ml=.cmo) $(MLS_XML2Modelica:.ml=.cmx) 
178         $(OCAMLOPT) -o XML2Modelica $(INCLUDE) $(OCAMLLIBS:.cma=.cmxa) $(MLS_XML2Modelica:.ml=.cmx) 
179
180
181
182 # call the ocaml/Yacc
183 generate-parser_modelicat: $(PARSER_SRC_modelicat)
184         $(OCAMLYACC) $(<)
185         $(RM) -f $(<:.mly=.ml)i
186 # Crappy workaround to avoid bug 8013
187         touch $(srcdir)/src/modelica_compiler/scicosCodeGeneration.mli
188
189
190 # Call the lexer
191 generate-lexer_modelicat: $(LEXER_SRC_modelicat)
192         $(OCAMLLEX) $(<)
193
194 modelicat: generate-parser_modelicat generate-lexer_modelicat $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmo)  $(MLS_modelicat:.ml=.mli) $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmx) $(MLS_modelicat:.ml=.cmo)  $(MLS_modelicat:.ml=.cmx) 
195         $(OCAMLOPT) -o modelicat $(INCLUDE_modelicat) $(OCAMLLIBS:.cma=.cmxa) $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmx) $(MLS_modelicat:.ml=.cmx) 
196
197
198 CLEANFILES = $(BASE_PATH)/*/*.cmi \
199         $(BASE_PATH)/*/*.o \
200         $(BASE_PATH)/*/*.cmo \
201         $(BASE_PATH)/*/*.cm[aiox] \
202         $(BASE_PATH)/*/parser.mli \
203         $(BASE_PATH)/*/lexer.mli \
204         $(BASE_PATH)/*/parser.ml \
205         $(BASE_PATH)/*/lexer.ml \
206         $(BASE_PATH)/translator/*/*.cmi \
207         $(BASE_PATH)/translator/*/*.o \
208         $(BASE_PATH)/translator/*/*.a \
209         $(BASE_PATH)/translator/*/*.cmo \
210         $(BASE_PATH)/translator/*/*.cmxa \
211         $(BASE_PATH)/translator/*/*.cm[aiox] \
212         $(BASE_PATH)/translator/*/parser.mli \
213         $(BASE_PATH)/translator/*/lexer.mli \
214         $(BASE_PATH)/translator/*/parser.ml \
215         $(BASE_PATH)/translator/*/lexer.ml \
216         $(TARGET)
217
218 endif # OCAML
219 endif # XCOS