Implement the bridge to call Tatoo from java. Very slow at the moment.
[tatoo.git] / src / bindings / java / Makefile
diff --git a/src/bindings/java/Makefile b/src/bindings/java/Makefile
new file mode 100644 (file)
index 0000000..0c8978c
--- /dev/null
@@ -0,0 +1,34 @@
+CXX = g++
+ASMRUN = asmrun_shared
+
+all: libtatoo-java.so
+#      cp $< ../../bin
+
+
+%.class: %.java
+       javac -cp . $<
+
+fxslt_memory_Tree.stamp: fxslt/memory/TatooEngine.class fxslt/memory/MutableNodeList.class
+       javah -jni fxslt.memory.TatooEngine
+       touch fxslt_memory_Tree.stamp
+
+fxslt_memory_TatooEngine.h: fxslt/memory/TatooEngine.class fxslt/memory/MutableNodeList.class
+
+TatooEngine.o: TatooEngine.cc fxslt_memory_Tree.stamp tatoo.h
+       $(CXX) -I `ocamlc -where` -DNDEBUG=1 -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -fPIC \
+           -DPIC -std=c++0x -c -O3 -o $@ $< -Wall -Wextra -Wno-unused-parameter -g3
+
+libtatoo-java.so: TatooEngine.o tatoo-java.o
+       $(CXX) -shared -o $@ -O3 tatoo-java.o TatooEngine.o  `ocamlc -where`/libasmrun.a `ocamlc -where`/libunix.a `ocamlc -where`/libbigarray.a -Wl,-soname,libtatoo-java.so
+tatoo_driver.depx tatoo_driver.cmx: tatoo_driver.ml
+       ../../../remake $@
+
+tatoo-java.o: tatoo_driver.cmx tatoo_driver.depx 
+       ocamlfind ocamlopt -output-obj -o $@  -I ../.. -cc g++ -linkall -linkpkg -package bigarray,ulex,unix $(shell cat tatoo_driver.depx | sed -e 's:src:../..:g' | sed -e 's:depx:cmx:g' ) $<
+
+test: TatooTest.class libtatoo-java.so
+       java -cp . -Xss80m  -Djava.library.path=. TatooTest ../../../tests/xmark_0.50.xml '/descendant::keyword[ancestor::listitem]/*'
+
+clean:
+       rm -f $(GEN_HEADERS) fxslt/memory/*.class
+       rm -f *.cm* *.depx *.o TatooTest.class *.so