Initial commit
[SXSI/xpathcomp.git] / Makefile
1 DEBUG=false
2 PROFILE=true
3
4 MLSRCS = memory.ml tag.ml tagSet.ml  tree.ml automaton.ml ulexer.ml  xPath.ml main.ml
5 MLISRCS = memory.mli automaton.mli  tag.mli tagSet.mli tree.mli ulexer.mli xPath.mli
6 MLOBJS = $(MLSRCS:.ml=.cmx)
7 MLCINT = $(MLISRCS:.mli=.cmi)
8
9
10 OCAMLPACKAGES = unix,ulex,camlp4
11
12 PPINCLUDES=$(OCAMLINCLUDES:%=-ppopt %)
13
14 CXXSOURCES =  XMLDocShredder.cpp OCamlStorageInterface.cpp StorageInterface.cpp OCamlDriver.cpp
15 CXXOBJECTS = $(CXXSOURCES:.cpp=.o)
16
17 CXXINCLUDES =   \
18         -I/usr/include/libxml++-2.6 \
19         -I/usr/include/libxml2 \
20         -I/usr/include/glibmm-2.4 \
21         -I/usr/include/glib-2.0 \
22         -I/usr/include/sigc++-2.0 \
23         -I/usr/lib/libxml++-2.6/include \
24         -I/usr/lib/glibmm-2.4/include \
25         -I/usr/lib/sigc++-2.0/include \
26         -I/usr/lib/glib-2.0/include\
27         -I`ocamlc -where`
28
29 CXXFLAGS = -O3 -Wall $(INCLUDEDIRS) -fPIC -std=c++0x
30 CXX = g++
31
32 ifeq ($(DEBUG), true)
33 OCAMLOPT = ocamlopt -g -cc "$(CXX)" 
34 SYNT_DEBUG = -ppopt -DDEBUG
35 else
36 OCAMLOPT = ocamlopt -cc "$(CXX)" -noassert -inline 10000
37 endif
38 ifeq ($(PROFILE), true)
39 SYNT_PROF = $(SYNT_DEBUG) -ppopt -DPROFILE
40 endif
41
42
43 OCAMLFIND = ocamlfind
44 OCAMLMKLIB = ocamlmklib
45 OCAMLDEP = ocamldep
46 LINK=$(OCAMLOPT) -linkpkg camlp4lib.cmxa
47 SYNTAX= -syntax camlp4o $(PPINCLUDES) -ppopt pa_macro.cmo $(SYNT_PROF) 
48
49
50
51 LIBS= -lxml2 -lxml++-2.6 -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lsigc-2.0
52
53 all: libcamlshredder.a  $(MLOBJS)
54         $(OCAMLFIND) $(LINK) -o main -package "$(OCAMLPACKAGES)" $(SYNTAX) -cclib \
55         "$(LIBS) ./libcamlshredder.a"  $(MLOBJS)
56
57 .SUFFIXES: .ml .mli .cmx .cmi .cpp
58 .PHONY:compute_depend
59
60 .cpp.o:
61         $(CXX) $(CXXINCLUDES) -c $(CXXFLAGS)  $<
62 .ml.cmx:
63         $(OCAMLFIND) $(OCAMLOPT) -package "$(OCAMLPACKAGES)"  $(SYNTAX) -c $<
64 .mli.cmi:
65         $(OCAMLFIND) $(OCAMLOPT) -package "$(OCAMLPACKAGES)"  $(SYNTAX) -c $<
66
67 libcamlshredder.a: $(CXXOBJECTS)
68         $(OCAMLMKLIB) -o camlshredder -custom $(CXXOBJECTS) $(LIBS)
69
70 clean:
71         rm -f *~ *.cm* *.[oa] *.so main
72
73
74 OCamlStorageInterface.o: OCamlStorageInterface.h OCamlStorageInterface.cpp StorageInterface.h
75 StorageInterface.o: StorageInterface.h
76 XMLDocShredder.o: XMLDocShredder.h XMLDocShredder.cpp OCamlStorageInterface.h StorageInterface.h
77 OCamlDriver.o: XMLDocShredder.h StorageInterface.h
78
79 compute_depend:
80         $(OCAMLFIND) $(OCAMLDEP) -package "$(OCAMLPACKAGES)" $(SYNTAX)  $(MLSRCS) $(MLISRCS) >depend
81
82
83
84 include depend