 ** News **

- Coccinelle no longer needs ocaml-sexplib, nor ocaml-extlib, nor
  libpycaml-ocaml-dev, nor ocaml-camlp4-devel.
- Parallel building is possible when you do not build the bytecode
  and native version of spatch simultaneously.


 ** Compilation **

You must first install a recent version of OCaml (at least 3.12.1).
See http://caml.inria.fr/download.en.html

On Debian/Ubuntu, install the following packages
 - pkg-config (optional, but strongly recommended)
 - ocaml-native-compilers (or alternatively ocaml)
 - ocaml-findlib
 - menhir and libmenhir-ocaml-dev (optional, bundled)
 - libpcre-ocaml-dev (optional, bundled)
 - libparmap-ocaml-dev (optional, bundled)
 - texlive-fonts-extra (for the documentation)

On Fedora, install the following packages
 - pkgconfig (optional, but strongly recommended)
 - chrpath
 - ocaml
 - ocaml-findlib
 - ocaml-findlib-devel
 - ocaml-ocamldoc
 - ocaml-menhir (optional, bundled)
 - ocaml-pcre-devel (optional, bundled)

It may be necessary to install libpython2.7-dev

You can try to use the package manager of your distribution to install
the build dependencies. This is not guaranteed to work, as the
dependencies may change, but chances are it will help you. Some
examples:

$ apt-get build-dep coccinelle
$ dnf builddep coccinelle
$ yum builddep coccinelle

Then simply type
 ./autogen
 ./configure
 make
 sudo make install


Other configuration flags of interest:
--prefix                default: /usr/local
--disable-opt           build the bytecode version
--with-python=PATH      choose a specific python executable
--without-python        no python scripting
--disable-ocaml         no ocaml scripting
--disable-pcre-syntax   no pcre regexp syntax
                        version of spatch
See ./configure --help for more options




By default, 'make' will
build in release configuration (no debugging symbols, etc.). It
defaults to the optimized version, unless --disable-opt is given
to configure. You could use 'make opt-only' to compile the
optimized version only. Similarly, you can use 'make byte-only' for
the unoptimized version. 'make install' installs whichever version
was compiled.
You can also use 'make world' to compile the bytecode
and the optimized code version.

Make targets of interest:
opt-only, opt           compiles just the optimized version
byt-only, byte          compiles just the bytecode version
world                   compiles both + frontends + docs
all-release             compiles the optimized version + frontends + docs
all-dev                 compiles the bytecode version + frontends
all                     default target: alias for either byte or opt
all.opt                 compiles the optimized version + frontends
check                   run tests (note: not all tests are expected to succeed)

Note: The test target is intended for developers. In particular, you
      should not expect that every test will pass.

In order to use the OCaml scripting feature in SmPL, an extra file,
coccilib.cmi, is produced and installed in /usr/share/cocci/ocaml, which is
needed for the compilation of ocaml scripts.

By default, Coccinelle Makefile is silent and does not print fully the
commands that are executed. Compilation can be turned verbose with

    make VERBOSE=yes

 ** Bash integration **

 To have completion under Bash, you can execute the following command:

    make install-bash

 It will install the shell script 'scripts/spatch.bash_completion'
 by default in the directory pointed by
   pkg-config --variable=completionsdir bash-completion
 if available, or $datarootdir/bash-completion/completions otherwise.
 The directory can be overridden by passing --with-bash-completion=$DIR
 to ./configure.
 The option --without-bash-completion disables the script installation.

 You can manually copy that file elsewhere if you have a different
 bash_completion directory.



 ** Runtime dependencies **

 - Basic shell commands:
   - ls, cat, cp, mv, rm, grep, mkdir, find
 - Developer tool: diff


 ** Optional runtime dependencies **

 - To quickly apply the semantic patches
   - glimpse indexer

 - To use OCaml scripting feature in SmPL
   - ocaml-native-compilers or ocaml-nox
   - ocaml-findlib

 - To generate a PDF of the control flow graph with '--graphical-trace'
   - pdftk and graphviz (with PDF support)

If runtime tools are not in $PATH, paths to some
of them can be specified with 'configure' or via
commandline parameters to spatch.



 ** Dependencies for additional tools **

    git, pushd, popd, sed, diffstat, cpp

 ** Uninstall **

    To uninstall Coccinelle, you should use the following command

    make uninstall


    To also remove the bash completion script, run

    make uninstall-bash

 ** Enable ocaml debugging **

    echo "EXTRA_OCAML_FLAGS+=-g" >>Makefile.local
