From 7cf0f365b0afa4dc3f1b0676d86d6334f04db620 Mon Sep 17 00:00:00 2001 From: Vincent COUVERT Date: Fri, 14 Mar 2014 16:05:59 +0100 Subject: [PATCH] Scicos OCaml part: generated bytecode executables This reverts commit e55d01de5738e1af9d01b23fd6a02d4146c6e295. Change-Id: I945c1326a289e95a22d4937e4174a23beb6c1017 --- scilab/modules/scicos/.gitignore | 5 +++ scilab/modules/scicos/Makefile.in | 53 +++++++++++++---------- scilab/modules/scicos/Makefile.modelica.am | 64 +++++++++++++++++----------- 3 files changed, 74 insertions(+), 48 deletions(-) create mode 100644 scilab/modules/scicos/src/xml2modelica/linenum.mli diff --git a/scilab/modules/scicos/.gitignore b/scilab/modules/scicos/.gitignore index 89cc584..00bdf74 100644 --- a/scilab/modules/scicos/.gitignore +++ b/scilab/modules/scicos/.gitignore @@ -1,4 +1,7 @@ +# ignore some generated files + modelicac +modelicac.ocamlc *.cmi *.cma *.cmo @@ -20,11 +23,13 @@ src/modelica_compiler/*.obj *.mli XML2Modelica +XML2Modelica.ocamlc xml2modelica.exe #translator modelicat +modelicat.ocamlc modelicat.exe src/translator/*/*.a src/translator/parsing/lexer.ml diff --git a/scilab/modules/scicos/Makefile.in b/scilab/modules/scicos/Makefile.in index ebf4ad8..630e634 100644 --- a/scilab/modules/scicos/Makefile.in +++ b/scilab/modules/scicos/Makefile.in @@ -3300,38 +3300,38 @@ distclean-local: @OCAML_TRUE@@XCOS_TRUE@%.cmo: %.ml %.cmi @OCAML_TRUE@@XCOS_TRUE@ @if echo "$<"|grep src/translator; then \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ @OCAML_TRUE@@XCOS_TRUE@ else \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE) -c $<; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ @OCAML_TRUE@@XCOS_TRUE@ fi @OCAML_TRUE@@XCOS_TRUE@.ml.cmx: @OCAML_TRUE@@XCOS_TRUE@ @if echo "$<"|grep src/translator; then \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLOPT) $(INCLUDE_modelicat) -c $<; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) $(INCLUDE_modelicat) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLOPT) $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) -c $<; \ @OCAML_TRUE@@XCOS_TRUE@ else \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLOPT) $(INCLUDE) -c $<; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) $(INCLUDE) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLOPT) $(INCLUDE) $(OCAMLOPTFLAGS) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) $(INCLUDE) $(OCAMLOPTFLAGS) -c $<; \ @OCAML_TRUE@@XCOS_TRUE@ fi @OCAML_TRUE@@XCOS_TRUE@.mli.cmi: @OCAML_TRUE@@XCOS_TRUE@ @if echo "$<"|grep src/translator; then \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ @OCAML_TRUE@@XCOS_TRUE@ else \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE) -c $<; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ @OCAML_TRUE@@XCOS_TRUE@ fi @OCAML_TRUE@@XCOS_TRUE@.ml.mli: @OCAML_TRUE@@XCOS_TRUE@ @if echo "$<"|grep src/translator; then \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE_modelicat) -i $< > $@; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE_modelicat) -i $< > $@; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -i $< > $@; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -i $< > $@; \ @OCAML_TRUE@@XCOS_TRUE@ else \ -@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE) -i $< > $@; \ -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE) -i $< > $@; \ +@OCAML_TRUE@@XCOS_TRUE@ echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -i $< > $@; \ +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -i $< > $@; \ @OCAML_TRUE@@XCOS_TRUE@ fi @OCAML_TRUE@@XCOS_TRUE@.mll.ml: @@ -3342,14 +3342,23 @@ distclean-local: # Build the binaries -@OCAML_TRUE@@XCOS_TRUE@modelicac:$(MLIS:.mli=.cmi) $(MLS:.ml=.cmo) $(MLS:.ml=.cmx) -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) -o modelicac $(INCLUDE) $(OCAMLLIBS:.cma=.cmxa) $(MLS:.ml=.cmx) +@OCAML_TRUE@@XCOS_TRUE@modelicac: $(MLS:.ml=.cmx) +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) -o $@ $(INCLUDE) $(OCAMLOPTFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^ -@OCAML_TRUE@@XCOS_TRUE@XML2Modelica: $(MLS_XML2Modelica:.ml=.cmo) $(MLS_XML2Modelica:.ml=.cmx) -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) -o XML2Modelica $(INCLUDE) $(OCAMLLIBS:.cma=.cmxa) $(MLS_XML2Modelica:.ml=.cmx) +@OCAML_TRUE@@XCOS_TRUE@modelicac.ocamlc: $(MLS:.ml=.cmo) +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) -o $@ $(INCLUDE) $(OCAMLOPTFLAGS) $(OCAMLLIBS) $^ -@OCAML_TRUE@@XCOS_TRUE@modelicat: $(MLIS_modelicat:.mli=.cmi) $(MLS_modelicat:.ml=.cmo) $(MLS_modelicat:.ml=.cmx) -@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) -o modelicat $(INCLUDE_modelicat) $(OCAMLLIBS:.cma=.cmxa) $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmx) $(MLS_modelicat:.ml=.cmx) +@OCAML_TRUE@@XCOS_TRUE@XML2Modelica: $(MLS_XML2Modelica:.ml=.cmx) +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) -o $@ $(INCLUDE) $(OCAMLCFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^ + +@OCAML_TRUE@@XCOS_TRUE@XML2Modelica.ocamlc: $(MLS_XML2Modelica:.ml=.cmo) +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) -o $@ $(INCLUDE) $(OCAMLCFLAGS) $(OCAMLLIBS) $^ + +@OCAML_TRUE@@XCOS_TRUE@modelicat: $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmx) $(MLS_modelicat:.ml=.cmx) +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLOPT) -o $@ $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^ + +@OCAML_TRUE@@XCOS_TRUE@modelicat.ocamlc: $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmo) $(MLS_modelicat:.ml=.cmo) +@OCAML_TRUE@@XCOS_TRUE@ $(OCAMLC) -o $@ $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) $(OCAMLLIBS) $^ #BUILT_SOURCES = depend diff --git a/scilab/modules/scicos/Makefile.modelica.am b/scilab/modules/scicos/Makefile.modelica.am index 56149a2..d7c387b 100644 --- a/scilab/modules/scicos/Makefile.modelica.am +++ b/scilab/modules/scicos/Makefile.modelica.am @@ -24,8 +24,15 @@ OCAMLLIBS=nums.cma ### XML2Modelica XML2Modelica_SOURCES = $(MLS_XML2Modelica) -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\ - $(srcdir)/src/xml2modelica/modelicaCodeGenerator.ml $(srcdir)/src/xml2modelica/xML2Modelica.ml +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 \ + $(srcdir)/src/xml2modelica/modelicaCodeGenerator.ml \ + $(srcdir)/src/xml2modelica/xML2Modelica.ml BASE_PATH_XML2Modelica = $(srcdir)/src/xml2modelica @@ -95,42 +102,40 @@ SUFFIXES += .ml .mli .mll .mly .cmo .cmi .cmx %.cmo: %.ml %.cmi @if echo "$<"|grep src/translator; then \ - echo $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ - $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ + echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ + $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ else \ - echo $(OCAMLC) $(INCLUDE) -c $<; \ - $(OCAMLC) $(INCLUDE) -c $<; \ + echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ + $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ fi .ml.cmx: @if echo "$<"|grep src/translator; then \ - echo $(OCAMLOPT) $(INCLUDE_modelicat) -c $<; \ - $(OCAMLOPT) $(INCLUDE_modelicat) -c $<; \ + echo $(OCAMLOPT) $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) -c $<; \ + $(OCAMLOPT) $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) -c $<; \ else \ - echo $(OCAMLOPT) $(INCLUDE) -c $<; \ - $(OCAMLOPT) $(INCLUDE) -c $<; \ + echo $(OCAMLOPT) $(INCLUDE) $(OCAMLOPTFLAGS) -c $<; \ + $(OCAMLOPT) $(INCLUDE) $(OCAMLOPTFLAGS) -c $<; \ fi - .mli.cmi: @if echo "$<"|grep src/translator; then \ - echo $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ - $(OCAMLC) $(INCLUDE_modelicat) -c $<; \ + echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ + $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -c $<; \ else \ - echo $(OCAMLC) $(INCLUDE) -c $<; \ - $(OCAMLC) $(INCLUDE) -c $<; \ + echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ + $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -c $<; \ fi .ml.mli: @if echo "$<"|grep src/translator; then \ - echo $(OCAMLC) $(INCLUDE_modelicat) -i $< > $@; \ - $(OCAMLC) $(INCLUDE_modelicat) -i $< > $@; \ + echo $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -i $< > $@; \ + $(OCAMLC) $(INCLUDE_modelicat) $(OCAMLCFLAGS) -i $< > $@; \ else \ - echo $(OCAMLC) $(INCLUDE) -i $< > $@; \ - $(OCAMLC) $(INCLUDE) -i $< > $@; \ + echo $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -i $< > $@; \ + $(OCAMLC) $(INCLUDE) $(OCAMLCFLAGS) -i $< > $@; \ fi - .mll.ml: $(OCAMLLEX) $< @@ -139,16 +144,23 @@ SUFFIXES += .ml .mli .mll .mly .cmo .cmi .cmx # Build the binaries -modelicac:$(MLIS:.mli=.cmi) $(MLS:.ml=.cmo) $(MLS:.ml=.cmx) - $(OCAMLOPT) -o modelicac $(INCLUDE) $(OCAMLLIBS:.cma=.cmxa) $(MLS:.ml=.cmx) +modelicac: $(MLS:.ml=.cmx) + $(OCAMLOPT) -o $@ $(INCLUDE) $(OCAMLOPTFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^ + +modelicac.ocamlc: $(MLS:.ml=.cmo) + $(OCAMLC) -o $@ $(INCLUDE) $(OCAMLOPTFLAGS) $(OCAMLLIBS) $^ +XML2Modelica: $(MLS_XML2Modelica:.ml=.cmx) + $(OCAMLOPT) -o $@ $(INCLUDE) $(OCAMLCFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^ -XML2Modelica: $(MLS_XML2Modelica:.ml=.cmo) $(MLS_XML2Modelica:.ml=.cmx) - $(OCAMLOPT) -o XML2Modelica $(INCLUDE) $(OCAMLLIBS:.cma=.cmxa) $(MLS_XML2Modelica:.ml=.cmx) +XML2Modelica.ocamlc: $(MLS_XML2Modelica:.ml=.cmo) + $(OCAMLC) -o $@ $(INCLUDE) $(OCAMLCFLAGS) $(OCAMLLIBS) $^ -modelicat: $(MLIS_modelicat:.mli=.cmi) $(MLS_modelicat:.ml=.cmo) $(MLS_modelicat:.ml=.cmx) - $(OCAMLOPT) -o modelicat $(INCLUDE_modelicat) $(OCAMLLIBS:.cma=.cmxa) $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmx) $(MLS_modelicat:.ml=.cmx) +modelicat: $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmx) $(MLS_modelicat:.ml=.cmx) + $(OCAMLOPT) -o $@ $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) $(OCAMLLIBS:.cma=.cmxa) $^ +modelicat.ocamlc: $(MLS_SPECIFIC_PRE_modelicat:.ml=.cmo) $(MLS_modelicat:.ml=.cmo) + $(OCAMLC) -o $@ $(INCLUDE_modelicat) $(OCAMLOPTFLAGS) $(OCAMLLIBS) $^ CLEANFILES = $(BASE_PATH)/*/*.cmi \ $(BASE_PATH)/*/*.o \ diff --git a/scilab/modules/scicos/src/xml2modelica/linenum.mli b/scilab/modules/scicos/src/xml2modelica/linenum.mli new file mode 100644 index 0000000..e69de29 -- 1.7.9.5