Xcos MVC: fix namespace comment
[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.1-en.txt
10
11 # TODO:
12 # * see if we can do more factorization (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= \
28         $(srcdir)/src/xml2modelica/xMLTree.ml \
29         $(srcdir)/src/xml2modelica/linenum.ml \
30         $(srcdir)/src/xml2modelica/stringParser.ml \
31         $(srcdir)/src/xml2modelica/stringLexer.ml \
32         $(srcdir)/src/xml2modelica/xMLParser.ml \
33         $(srcdir)/src/xml2modelica/xMLLexer.ml \
34         $(srcdir)/src/xml2modelica/modelicaCodeGenerator.ml \
35         $(srcdir)/src/xml2modelica/xML2Modelica.ml
36
37 BASE_PATH_XML2Modelica = $(srcdir)/src/xml2modelica
38
39
40 ### Translator 
41
42 modelicat_SOURCES = \
43         $(srcdir)/src/translator/parsing/syntax.ml \
44         $(srcdir)/src/translator/parsing/parser.mly \
45         $(srcdir)/src/translator/parsing/lexer.mll \
46         $(srcdir)/src/translator/parsing/linenum.ml \
47         $(srcdir)/src/translator/compilation/types.ml \
48         $(srcdir)/src/translator/compilation/nameResolve.ml \
49         $(srcdir)/src/translator/instantiation/instantiation.ml \
50         $(srcdir)/src/translator/exceptionHandling/msgDico.ml \
51         $(srcdir)/src/translator/exceptionHandling/errorDico.ml \
52         $(srcdir)/src/translator/exceptionHandling/exceptHandler.ml \
53         $(srcdir)/src/translator/translation/libraryManager.ml \
54         $(srcdir)/src/translator/translation/codeGeneration.ml \
55         $(srcdir)/src/translator/translation/versiondate.ml \
56         $(srcdir)/src/translator/translation/translator.ml
57
58 modelicat_SOURCES_mly = $(modelicat_SOURCES:.mly=.ml)
59 MLS_modelicat = $(modelicat_SOURCES_mly:.mll=.ml)
60 MLIS_modelicat = $(MLS_modelicat:.ml=.mli)
61
62 INCLUDE_modelicat = -I $(srcdir)/src/translator/compilation \
63 -I $(srcdir)/src/translator/exceptionHandling \
64 -I $(srcdir)/src/translator/parsing \
65 -I $(srcdir)/src/translator/instantiation \
66 -I $(srcdir)/src/translator/translation
67
68 ### Modelicac
69
70 modelicac_SOURCES = \
71         $(srcdir)/src/modelica_compiler/parseTree.ml \
72         $(srcdir)/src/modelica_compiler/linenum.ml \
73         $(srcdir)/src/modelica_compiler/parser.mly \
74         $(srcdir)/src/modelica_compiler/lexer.mll \
75         $(srcdir)/src/modelica_compiler/precompilation.ml \
76         $(srcdir)/src/modelica_compiler/compilation.ml \
77         $(srcdir)/src/modelica_compiler/instantiation.ml \
78         $(srcdir)/src/modelica_compiler/graphNodeSet.ml \
79         $(srcdir)/src/modelica_compiler/symbolicExpression.ml \
80         $(srcdir)/src/modelica_compiler/squareSparseMatrix.ml \
81         $(srcdir)/src/modelica_compiler/bipartiteGraph.ml \
82         $(srcdir)/src/modelica_compiler/hungarianMethod.ml \
83         $(srcdir)/src/modelica_compiler/causalityGraph.ml \
84         $(srcdir)/src/modelica_compiler/optimization.ml \
85         $(srcdir)/src/modelica_compiler/xMLCodeGeneration.ml \
86         $(srcdir)/src/modelica_compiler/optimizingCompiler.ml \
87         $(srcdir)/src/modelica_compiler/scicosCodeGeneration.ml \
88         $(srcdir)/src/modelica_compiler/scicosOptimizingCompiler.ml
89
90 modelicac_SOURCES_mly = $(modelicac_SOURCES:.mly=.ml)
91 MLS = $(modelicac_SOURCES_mly:.mll=.ml)
92 MLIS = $(MLS:.ml=.mli)
93
94 BASE_PATH_MODELICAC = $(srcdir)/src/modelica_compiler
95
96 INCLUDE = -I $(BASE_PATH_MODELICAC) -I $(BASE_PATH_XML2Modelica)
97
98 ########## COMMON
99 SUFFIXES += .ml .mli .mll .mly .cmo .cmi .cmx
100
101 # @TODO check how to avoid the rebuild of the parser/lexer
102
103 %.cmo: %.ml %.cmi
104         @if echo "$<"|grep src/translator; then \
105                 echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \
106                 $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \
107         else \
108                 echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \
109                 $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \
110         fi
111
112 .ml.cmx:
113         @if echo "$<"|grep src/translator; then \
114                 echo $(OCAMLOPT) $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) -c $<; \
115                 $(OCAMLOPT) $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) -c $<; \
116         else \
117                 echo $(OCAMLOPT) $(INCLUDE) $(OCAMLOPTFLAGS) -c $<; \
118                 $(OCAMLOPT) $(INCLUDE) $(OCAMLOPTFLAGS) -c $<; \
119         fi
120
121 .mli.cmi:
122         @if echo "$<"|grep src/translator; then \
123                 echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \
124                 $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \
125         else \
126                 echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \
127                 $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \
128         fi
129
130 .ml.mli:
131         @if echo "$<"|grep src/translator; then \
132                 echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -i $< > $@; \
133                 $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -i $< > $@; \
134         else \
135                 echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -i $< > $@; \
136                 $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -i $< > $@; \
137         fi
138
139 .mll.ml:
140         $(OCAMLLEX) $<
141
142 .mly.ml:
143         $(OCAMLYACC) $<
144
145 # Build the binaries
146
147 modelicac: $(MLS:.ml=.cmx)
148         $(OCAMLOPT) -o $@ $(INCLUDE) $(OCAMLOPTFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^
149
150 modelicac.ocamlc: $(MLS:.ml=.cmo)
151         $(OCAMLC) -o $@ $(INCLUDE) $(OCAMLOPTFLAGS) $(OCAMLLIBS) $^
152
153 XML2Modelica: $(MLS_XML2Modelica:.ml=.cmx) 
154         $(OCAMLOPT) -o $@ $(INCLUDE) $(OCAMLCFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^
155
156 XML2Modelica.ocamlc: $(MLS_XML2Modelica:.ml=.cmo)
157         $(OCAMLC) -o $@ $(INCLUDE) $(OCAMLCFLAGS) $(OCAMLLIBS) $^
158
159 modelicat: $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmx) $(MLS_modelicat:.ml=.cmx)
160         $(OCAMLOPT) -o $@ $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^
161
162 modelicat.ocamlc: $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmo) $(MLS_modelicat:.ml=.cmo)
163         $(OCAMLC) -o $@ $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) $(OCAMLLIBS) $^
164
165 CLEANFILES = $(BASE_PATH)/*/*.cmi \
166         $(BASE_PATH)/*/*.o \
167         $(BASE_PATH)/*/*.cmo \
168         $(BASE_PATH)/*/*.cm[aiox] \
169         $(BASE_PATH)/*/parser.mli \
170         $(BASE_PATH)/*/lexer.mli \
171         $(BASE_PATH)/*/parser.ml \
172         $(BASE_PATH)/*/lexer.ml \
173         $(BASE_PATH)/translator/*/*.cmi \
174         $(BASE_PATH)/translator/*/*.o \
175         $(BASE_PATH)/translator/*/*.a \
176         $(BASE_PATH)/translator/*/*.cmo \
177         $(BASE_PATH)/translator/*/*.cmxa \
178         $(BASE_PATH)/translator/*/*.cm[aiox] \
179         $(BASE_PATH)/translator/*/parser.mli \
180         $(BASE_PATH)/translator/*/lexer.mli \
181         $(BASE_PATH)/translator/*/parser.ml \
182         $(BASE_PATH)/translator/*/linenum.ml \
183         $(BASE_PATH)/translator/*/lexer.ml \
184         $(TARGET) \
185         $(BASE_PATH)/modelica_compiler/linenum.mli \
186         $(BASE_PATH)/modelica_compiler/scicosOptimizingCompiler.mli \
187         $(BASE_PATH)/translator/compilation/nameResolve.mli \
188         $(BASE_PATH)/translator/compilation/types.mli \
189         $(BASE_PATH)/translator/exceptionHandling/errorDico.mli \
190         $(BASE_PATH)/translator/exceptionHandling/exceptHandler.mli \
191         $(BASE_PATH)/translator/exceptionHandling/msgDico.mli \
192         $(BASE_PATH)/translator/instantiation/instantiation.mli \
193         $(BASE_PATH)/translator/parsing/linenum.mli \
194         $(BASE_PATH)/translator/parsing/syntax.mli \
195         $(BASE_PATH)/translator/translation/codeGeneration.mli \
196         $(BASE_PATH)/translator/translation/libraryManager.mli \
197         $(BASE_PATH)/translator/translation/translator.mli \
198         $(BASE_PATH)/translator/translation/versiondate.mli
199
200 #BUILT_SOURCES = depend
201
202 depend: 
203         $(OCAMLDEP) $(INCLUDE_modelicat) $(INCLUDE) $(MLIS) $(MLS) $(MLIS_XML2Modelica) $(MLS_XML2Modelica) $(MLIS_modelicat) $(MLS_modelicat) > .depend
204
205 include .depend
206
207 endif # OCAML
208 endif # XCOS