Changed building of tag tables and format.
[SXSI/xpathcomp.git] / Makefile
index 6b15fff..5f225f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,14 @@
+INLINE=100
 DEBUG=false
-PROFILE=true
+PROFILE=false
 VERBOSE=false
 
-MLSRCS = memory.ml tag.ml tagSet.ml  tree.ml automaton.ml ulexer.ml  xPath.ml main.ml
-MLISRCS = memory.mli automaton.mli  tag.mli tagSet.mli tree.mli ulexer.mli xPath.mli
+BASESRC=uid.ml custom.ml hcons.ml hlist.ml ptset.ml finiteCofinite.ml tag.ml tagSet.ml options.ml tree.ml ata.ml
+BASEMLI=uid.mli sigs.mli hcons.mli hlist.mli ptset.mli finiteCofinite.mli tag.mli tagSet.mli options.mli tree.mli  ata.mli
+MLSRCS = memory.ml $(BASESRC)   ulexer.ml  xPath.ml main.ml
+MLISRCS = memory.mli $(BASEMLI)  ulexer.mli xPath.mli
+BASEOBJS= $(BASESRC:.ml=.cmx)
+BASEINT= $(BASEMLI:.ml=.cmi)
 MLOBJS = $(MLSRCS:.ml=.cmx)
 MLCINT = $(MLISRCS:.mli=.cmi)
 
@@ -12,10 +17,12 @@ OCAMLPACKAGES = str,unix,ulex,camlp4
 
 PPINCLUDES=$(OCAMLINCLUDES:%=-ppopt %)
 
-CXXSOURCES =  XMLDocShredder.cpp SXSIStorageInterface.cpp StorageInterface.cpp OCamlDriver.cpp
-CXXOBJECTS = $(CXXSOURCES:.cpp=.o)
+CXXSOURCES =  results.c XMLDocShredder.cpp  OCamlDriver.cpp
+CXXOBJECTS1 = $(CXXSOURCES:.cpp=.o)
+CXXOBJECTS = $(CXXOBJECTS1:.c=.o)
 
-CXXINCLUDES =  \
+CAMLINCLUDES= -I`ocamlc -where`
+LIBXMLINCLUDES=        \
        -I/usr/include/libxml++-2.6 \
        -I/usr/include/libxml2 \
        -I/usr/include/glibmm-2.4 \
@@ -25,12 +32,17 @@ CXXINCLUDES =       \
        -I/usr/lib/glibmm-2.4/include \
        -I/usr/lib/sigc++-2.0/include \
        -I/usr/lib/glib-2.0/include\
-       -I`ocamlc -where`\
+
+SXSIINCLUDES = \
        -IXMLTree \
        -IXMLTree/libcds/includes \
        -IXMLTree/TextCollection 
 
-CXXFLAGS = -O3 -Wall $(INCLUDEDIRS) -fPIC
+CXXINCLUDES= $(CAMLINCLUDES) $(LIBXMLINCLUDES) $(SXSIINCLUDES)
+
+CXXFLAGS = -O3 -Wall $(INCLUDEDIRS) -std=c++0x -static
+CCFLAGS = -O3 -Wall  -static
+
 ifeq ($(VERBOSE),true)
 HIDE=
 else
@@ -39,44 +51,73 @@ endif
 
 ifeq ($(DEBUG), true)
 CXX = g++ -DDEBUG
-OCAMLOPT = ocamlopt -g -cc "$(CXX)" 
+CC = gcc -DDEBUG
+DEBUG_FLAGS = -g
 SYNT_DEBUG = -ppopt -DDEBUG
 else
 CXX = g++
-OCAMLOPT = ocamlopt -cc "$(CXX)" -noassert -inline 100
+CC = gcc -DDEBUG
 endif
 
 ifeq ($(PROFILE), true)
-SYNT_PROF = $(SYNT_DEBUG) -ppopt -DPROFILE
+PROFILE_FLAGS = -p -S
+SYNT_PROF = -ppopt -DPROFILE
 endif
+SYNT_FLAGS = $(SYNT_DEBUG) $(SYNT_PROF)
+OPT_FLAGS = $(DEBUG_FLAGS) $(PROFILE_FLAGS) -nodynlink -fno-PIC -unsafe
+
+OCAMLOPT = ocamlopt -cc "$(CXX)" $(OPT_FLAGS) -ccopt -O3 -ccopt -std=c++0x -noassert -inline $(INLINE)
+
 
 OCAMLFIND = ocamlfind
 OCAMLMKLIB = ocamlmklib
 OCAMLDEP = ocamldep
 #Ugly but seems difficult with a makefile
 
-LINK=$(OCAMLOPT) -linkpkg `ocamlc -version | grep -q "3.11.0" && echo dynlink.cmxa` camlp4lib.cmxa
-SYNTAX= -syntax camlp4o $(PPINCLUDES) -ppopt pa_macro.cmo $(SYNT_PROF
+LINK=$(OCAMLOPT) -linkpkg `ocamlc -version | grep -q "3.1[12].[012]" && echo dynlink.cmxa` camlp4lib.cmxa
+SYNTAX= -syntax camlp4o $(PPINCLUDES) -ppopt -printer -ppopt auto -ppopt pa_macro.cmo $(SYNT_FLAGS
 
 
 
 LIBS=-lxml2 -lxml++-2.6 -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lsigc-2.0 
 
 all: main
-
+#-ccopt -gp -p
 main: libcamlshredder.a  $(MLOBJS)
        @echo [LINK] $@
        $(HIDE) $(OCAMLFIND) $(LINK) -o main -package "$(OCAMLPACKAGES)" $(SYNTAX) -cclib \
        "$(LIBS) ./libcamlshredder.a"  $(MLOBJS)
 
+sxsi_test: libcamlshredder.a uid.cmx custom.cmx hcons.cmx ptset.cmx finiteCofinite.cmx tag.cmx tagSet.cmx options.cmx tree.cmx
+       @echo [LINK] $@ 
+       $(HIDE) $(OCAMLFIND) $(LINK) -o sxsi_test -package "$(OCAMLPACKAGES)" $(SYNTAX) -cclib \
+       "$(LIBS) ./libcamlshredder.a"  uid.cmx custom.cmx hcons.cmx ptset.cmx finiteCofinite.cmx tag.cmx tagSet.cmx options.cmx tree.cmx sxsi_test.ml
+
+unit_test: libcamlshredder.a  $(BASEOBJS) unit_test.cmx
+       @echo [LINK] $@ 
+       $(HIDE) $(OCAMLFIND) $(LINK) -o unit_test -package "$(OCAMLPACKAGES)" $(SYNTAX) -cclib \
+       "$(LIBS) ./libcamlshredder.a"  $(BASEOBJS) unit_test.cmx
+
 .SUFFIXES: .ml .mli .cmx .cmi .cpp
 .PHONY:compute_depend version
+
+.c.o:
+       @echo [CC] $@
+       $(HIDE) $(CC) -c $(CCFLAGS) $<
+
 .cpp.o:
        @echo [CPP] $@
        $(HIDE) $(CXX) $(CXXINCLUDES) -c $(CXXFLAGS)  $<
+
 .ml.cmx:
        @echo [OCAMLOPT] $@
        $(HIDE) $(OCAMLFIND) $(OCAMLOPT) -package "$(OCAMLPACKAGES)"  $(SYNTAX) -c $<
+
+# ata.cmx: ata.ml
+#      @echo [OCAMLOPTPROF] $@
+#      $(HIDE) $(OCAMLFIND) $(OCAMLOPT) -S -ccopt -gp -p -package "$(OCAMLPACKAGES)"  $(SYNTAX) -c $<
+
+
 .mli.cmi:
        @echo [OCAMLOPT] $@
        $(HIDE) $(OCAMLFIND) $(OCAMLOPT) -package "$(OCAMLPACKAGES)"  $(SYNTAX) -c $<
@@ -85,26 +126,41 @@ libcamlshredder.a: $(CXXOBJECTS) XMLTree/XMLTree.a
        @echo [LIB] $@
        $(HIDE) mkdir -p .libs/
        $(HIDE) cd .libs/ && ar x ../XMLTree/XMLTree.a
-       $(HIDE) $(OCAMLMKLIB) -o camlshredder -custom $(CXXOBJECTS) ./.libs/*.o $(LIBS)
+       $(HIDE) $(OCAMLMKLIB) -o camlshredder -custom $(CXXOBJECTS) .libs/*.o $(LIBS)
        $(HIDE) rm -rf .libs
 
 clean:
        @echo [CLEAN]
-       $(HIDE) rm -f *~ *.cm* *.[oa] *.so main .libs
+       $(HIDE) rm -f *~ *.cm* *.[oa] *.so main *.s sxsi_test
+       $(HIDE) rm -rf .libs
 
 
-testSuccint: $(CXXOBJECTS) XMLTree/XMLTree.a
+timeXMLTree: $(CXXOBJECTS) XMLTree/XMLTree.a  timeXMLTree.cpp myTimeXMLTree.cpp
+       mkdir -p .libs/
+       cd .libs/ && ar x ../XMLTree/XMLTree.a
+       $(CXX) -o timeXMLTree $(CXXFLAGS) $(CXXINCLUDES) XMLDocShredder.o \
+       SXSIStorageInterface.o StorageInterface.o ./.libs/*.o \
+       $(LIBS) timeXMLTree.cpp
+       $(CXX) -o myTimeXMLTree $(CXXFLAGS) $(CXXINCLUDES) XMLDocShredder.o \
+       SXSIStorageInterface.o StorageInterface.o ./.libs/*.o \
+       $(LIBS) myTimeXMLTree.cpp
+#      $(CXX) -o testXMLTree $(CXXFLAGS) $(CXXINCLUDES) XMLDocShredder.o \
+#      SXSIStorageInterface.o StorageInterface.o ./.libs/*.o \
+#      $(LIBS) testXMLTree.cpp
+       rm -rf .libs
+
+timeSXSI: $(CXXOBJECTS) XMLTree/XMLTree.a  timeSXSI.cpp
        mkdir -p .libs/
        cd .libs/ && ar x ../XMLTree/XMLTree.a
-       $(CXX) -o testSuccint $(CXXFLAGS) $(CXXINCLUDES) XMLDocShredder.o \
-SXSIStorageInterface.o StorageInterface.o ./.libs/*.o \
-$(LIBS) testSuccint.cpp
+       $(CXX) -o timeSXSI $(CXXFLAGS) $(SXSIINCLUDES) -I/usr/include/libxml2 -lxml2 ./.libs/*.o timeSXSI.cpp
+#      $(CXX) -o testXMLTree $(CXXFLAGS) $(CXXINCLUDES) XMLDocShredder.o \
+#      SXSIStorageInterface.o StorageInterface.o ./.libs/*.o \
+#      $(LIBS) testXMLTree.cpp
        rm -rf .libs
 
-SXSIStorageInterface.o: SXSIStorageInterface.h SXSIStorageInterface.cpp StorageInterface.h
-StorageInterface.o: StorageInterface.h
-XMLDocShredder.o: XMLDocShredder.h XMLDocShredder.cpp SXSIStorageInterface.h StorageInterface.h
-OCamlDriver.o: XMLDocShredder.h StorageInterface.h
+XMLDocShredder.o: XMLDocShredder.h XMLDocShredder.cpp 
+OCamlDriver.o: XMLDocShredder.h
+results.o: results.h
 
 compute_depend:
        @echo [DEP]