Release coccinelle-0.2.3rc4
[bpt/coccinelle.git] / commons / Makefile
index c36c18f..4169157 100644 (file)
 ##############################################################################
 # Variables
 ##############################################################################
+
+# The main library
+-include ../Makefile.config
+
 TARGET=commons
 
 # note: if you add a file (a .mli or .ml), dont forget to redo a 'make depend'
-MYSRC=common.ml common_extra.ml \
-      interfaces.ml objet.ml \
-      ocollection.ml \
-      seti.ml \
-      oset.ml oassoc.ml osequence.ml ograph.ml \
-      oseti.ml oseth.ml osetb.ml osetpt.ml \
-      oassocb.ml oassoch.ml oassoc_buffer.ml oassocid.ml \
-      oarray.ml \
-      ograph2way.ml ograph_extended.ml \
-      ofullcommon.ml \
-      glimpse.ml
+MYSRC= common.ml common_extra.ml                \
+       interfaces.ml objet.ml                   \
+       ocollection.ml                           \
+       seti.ml                                  \
+       oset.ml oassoc.ml osequence.ml ograph.ml \
+       ocollection/oseti.ml                     \
+       ocollection/oseth.ml                     \
+       ocollection/osetb.ml                     \
+       ocollection/osetpt.ml                    \
+       ocollection/oassocb.ml                   \
+       ocollection/oassoch.ml                   \
+       ocollection/oassoc_buffer.ml             \
+       ocollection/oassoc_cache.ml              \
+       ocollection/oassocid.ml                  \
+       oarray.ml                                \
+       ocollection/ograph2way.ml                \
+       ograph_simple.ml ograph_extended.ml      \
+       ofullcommon.ml                           \
+       glimpse.ml parser_combinators.ml
 
 # src from other authors, got from the web or caml hump
-SRC=ocamlextra/dumper.ml 
-SRC+=ocamlextra/ANSITerminal.ml 
+SRC=ocamlextra/dumper.ml
+SRC+=ocamlextra/ANSITerminal.ml
 SRC+=ocamlextra/setb.ml ocamlextra/mapb.ml # defunctorized version of standard set/map
 SRC+=ocamlextra/setPt.ml
 SRC+=$(MYSRC)
 SRC+=ocamlextra/enum.ml ocamlextra/dynArray.ml
-SRC+=ocamlextra/parser_combinators.ml
-SRC+=ocamlextra/suffix_tree.ml ocamlextra/suffix_tree_ext.ml 
+SRC+=ocamlextra/suffix_tree.ml ocamlextra/suffix_tree_ext.ml
 
-SYSLIBS=str.cma unix.cma   
+SYSLIBS=str.cma bigarray.cma unix.cma
 
-INCLUDEDIRS=ocamlextra
-SUBDIR=ocamlextra
+INCLUDEDIRS=ocamlextra ocollection
+SUBDIRS=ocamlextra ocollection
 
 #-----------------------------------------------------------------------------
 # Other common (thin wrapper) libraries
 #-----------------------------------------------------------------------------
 
+#format: XXXSRC, XXXINCLUDE, XXXSYSLIBS
+
 #gdbm
-MYGDBMSRC=oassocdbm.ml
+MYGDBMSRC=ocollection/oassocdbm.ml
 GDBMSYSLIBS=dbm.cma
 
-#berkeley db
+#berkeley db (ocamlbdb)
+MYBDBSRC=ocollection/oassocbdb.ml ocollection/oassocbdb_string.ml
 BDBINCLUDES=-I ../ocamlbdb
-MYBDBSRC=oassocbdb.ml
 BDBSYSLIBS=bdb.cma
 
 
-#ocamlgtk
-GUIINCLUDES=-I +lablgtk2 -I +lablgtksourceview -I ../ocamlgtk/src
+#lablgtk (ocamlgtk)
 MYGUISRC=gui.ml
+GUIINCLUDES=-I +lablgtk2 -I +lablgtksourceview -I ../ocamlgtk/src
 GUISYSLIBS=lablgtk.cma lablgtksourceview.cma
 
-#pycaml
-PYINCLUDES=-I ../ocamlpython -I ../../ocamlpython
+#pycaml (ocamlpython)
 MYPYSRC=python.ml
+PYINCLUDES=-I ../ocamlpython -I ../../ocamlpython
 PYSYSLIBS=python.cma
 
 #ocamlmpi
-MPIINCLUDES=-I ../ocamlmpi -I ../../ocamlmpi -I +ocamlmpi 
-MYMPISRC=distribution.ml
-MPISYSLIBS=mpi.cma
-
-#ocamlmpi
-MPIINCLUDES=-I ../ocamlmpi -I ../../ocamlmpi -I +ocamlmpi 
 MYMPISRC=distribution.ml
+MPIINCLUDES=-I ../ocamlmpi -I ../../ocamlmpi -I +ocamlmpi
 MPISYSLIBS=mpi.cma
 
+#pcre
+#REGEXPINCLUDES=-I +pcre
+MYREGEXPSRC=regexp.ml
+REGEXPINCLUDES=-I ../ocamlpcre/lib  -I ../../ocamlpcre/lib
+
+#sexplib
+MYSEXPSRC=sexp_common.ml
+ifeq ("$(SEXPDIR)","ocamlsexp")
+SEXPDIRUSED=../$(SEXPDIR)
+else
+SEXPDIRUSED=$(SEXPDIR)
+endif # Use local ocamlsexp
+SEXPINCLUDES=-I $(SEXPDIRUSED)        \
+       -I ../ocamltarzan/lib-sexp    \
+       -I ../../ocamltarzan/lib-sexp
+
+#binprot
+MYBINSRC=bin_common.ml
+BININCLUDES=-I ../ocamltarzan/lib-binprot -I ../../ocamltarzan/lib-binprot
 
 #-----------------------------------------------------------------------------
 # Other stuff
 #-----------------------------------------------------------------------------
 
 #backtrace
-BACKTRACEINCLUDES=-I $(shell ocamlc -where)
 MYBACKTRACESRC=backtrace.ml
+BACKTRACEINCLUDES=-I $(shell ocamlc -where)
+
 
 ##############################################################################
 # Generic variables
@@ -86,14 +114,14 @@ INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA)
 
 # This flag can also be used in subdirectories so don't change its name here.
 # For profiling use:  -p -inline 0
-OPTFLAGS= 
+OPTFLAGS=
 #-thread
 
-# The OPTBIN variable is here to allow to use ocamlc.opt instead of 
+# The OPTBIN variable is here to allow to use ocamlc.opt instead of
 # ocaml, when it is available, which speeds up compilation. So
-# if you want the fast version of the ocaml chain tools, set this var 
+# if you want the fast version of the ocaml chain tools, set this var
 # or setenv it to ".opt" in your startup script.
-OPTBIN= #.opt
+OPTBIN ?= #.opt
 
 OCAMLCFLAGS ?= -g -dtypes
 
@@ -107,7 +135,7 @@ OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
 
 # if need C code
 OCAMLMKLIB=ocamlmklib
-CC=gcc 
+CC=gcc
 
 ##############################################################################
 # Top rules
@@ -140,8 +168,9 @@ clean::
 # Other commons libs target
 ##############################################################################
 
-all_libs: gdbm bdb gui mpi backtrace
+all_libs: gdbm bdb gui mpi regexp backtrace
 
+#-----------------------------------------------------------------------------
 gdbm: commons_gdbm.cma
 gdbm.opt: commons_gdbm.cmxa
 
@@ -152,9 +181,10 @@ commons_gdbm.cmxa: $(MYGDBMSRC:.ml=.cmx)
        $(OCAMLOPT) -a -o $@ $^
 
 
-bdb: 
+#-----------------------------------------------------------------------------
+bdb:
        $(MAKE) INCLUDESEXTRA="$(BDBINCLUDES)" commons_bdb.cma
-bdb.opt: 
+bdb.opt:
        $(MAKE) INCLUDESEXTRA="$(BDBINCLUDES)" commons_bdb.cmxa
 
 commons_bdb.cma: $(MYBDBSRC:.ml=.cmo)
@@ -165,6 +195,7 @@ commons_bdb.cmxa: $(MYBDBSRC:.ml=.cmx)
 
 
 
+#-----------------------------------------------------------------------------
 gui:
        $(MAKE) INCLUDESEXTRA="$(GUIINCLUDES)" commons_gui.cma
 gui.opt:
@@ -178,9 +209,10 @@ commons_gui.cmxa: $(MYGUISRC:.ml=.cmx)
 
 
 
-mpi: 
+#-----------------------------------------------------------------------------
+mpi:
        $(MAKE) INCLUDESEXTRA="$(MPIINCLUDES)" commons_mpi.cma
-mpi.opt: 
+mpi.opt:
        $(MAKE) INCLUDESEXTRA="$(MPIINCLUDES)" commons_mpi.cmxa
 
 commons_mpi.cma: $(MYMPISRC:.ml=.cmo)
@@ -195,9 +227,10 @@ distribution.opt: mpi.opt
 
 
 
-python: 
+#-----------------------------------------------------------------------------
+python:
        $(MAKE) INCLUDESEXTRA="$(PYINCLUDES)" commons_python.cma
-python.opt: 
+python.opt:
        $(MAKE) INCLUDESEXTRA="$(PYINCLUDES)" commons_python.cmxa
 
 
@@ -208,6 +241,20 @@ commons_python.cmxa: $(MYPYSRC:.ml=.cmx)
        $(OCAMLOPT) -a -o $@ $^
 
 
+#-----------------------------------------------------------------------------
+regexp:
+       $(MAKE) INCLUDESEXTRA="$(REGEXPINCLUDES)" commons_regexp.cma
+regexp.opt:
+       $(MAKE) INCLUDESEXTRA="$(REGEXPINCLUDES)" commons_regexp.cmxa
+
+commons_regexp.cma: $(MYREGEXPSRC:.ml=.cmo)
+       $(OCAMLC) -a -o $@ $^
+
+commons_regexp.cmxa: $(MYREGEXPSRC:.ml=.cmx)
+       $(OCAMLOPT) -a -o $@ $^
+
+
+#-----------------------------------------------------------------------------
 backtrace: commons_backtrace.cma
 backtrace.opt: commons_backtrace.cmxa
 
@@ -224,6 +271,44 @@ clean::
        rm -f dllcommons_backtrace.so
 
 
+
+#-----------------------------------------------------------------------------
+sexp:
+       $(MAKE) INCLUDESEXTRA="$(SEXPINCLUDES)" commons_sexp.cma
+sexp.opt:
+       $(MAKE) INCLUDESEXTRA="$(SEXPINCLUDES)" commons_sexp.cmxa
+
+commons_sexp.cma: $(MYSEXPSRC:.ml=.cmo)
+       $(OCAMLC) -a -o $@ $^
+
+commons_sexp.cmxa: $(MYSEXPSRC:.ml=.cmx)
+       $(OCAMLOPT) -a -o $@ $^
+
+binprot:
+       $(MAKE) INCLUDESEXTRA="$(BININCLUDES)" commons_bin.cma
+binprot.opt:
+       $(MAKE) INCLUDESEXTRA="$(BININCLUDES)" commons_bin.cmxa
+
+commons_bin.cma: $(MYBINSRC:.ml=.cmo)
+       $(OCAMLC) -a -o $@ $^
+
+commons_bin.cmxa: $(MYBINSRC:.ml=.cmx)
+       $(OCAMLOPT) -a -o $@ $^
+
+##############################################################################
+# The global "features" lib wrapper
+##############################################################################
+
+features: commons_features.cma
+features.opt: commons_features.cmxa
+
+commons_features.cma: features.cmo
+       $(OCAMLC) -a -o $@ $^
+
+commons_features.cmxa: features.cmx
+       $(OCAMLOPT) -a -o $@ $^
+
+
 ##############################################################################
 # Developer rules
 ##############################################################################
@@ -232,7 +317,7 @@ tags:
        otags -no-mli-tags -r  .
 
 clean::
-       rm -f gmon.out 
+       rm -f gmon.out
 
 forprofiling:
        $(MAKE) OPTFLAGS="-p -inline 0 " opt
@@ -263,15 +348,17 @@ dependencygraph2:
 
 clean::
        rm -f *.cm[iox] *.o *.a *.cma *.cmxa *.annot
-       rm -f *~ .*~ #*# 
+       rm -f *~ .*~ #*#
 
 clean::
-       rm -f $(SUBDIR)/*.cm[iox] $(SUBDIR)/*.o $(SUBDIR)/*.a 
-       rm -f $(SUBDIR)/*.cma $(SUBDIR)/*.cmxa $(SUBDIR)/*.annot
-       rm -f $(SUBDIR)/*~ $(SUBDIR)/.*~ #*# 
-
-depend: 
-       $(OCAMLDEP) *.mli *.ml $(SUBDIR)/*.ml $(SUBDIR)/*.mli  > .depend
+       for i in $(SUBDIRS); do (cd $$i; \
+        rm -f *.cm[iox] *.o *.a *.cma *.cmxa *.annot *~ .*~ ; \
+        cd ..; ) \
+       done
+
+depend:
+       $(OCAMLDEP) *.mli *.ml  > .depend
+       for i in $(SUBDIRS); do $(OCAMLDEP) $$i/*.ml $$i/*.mli >> .depend; done
 
 distclean::
        rm -f .depend