Commit | Line | Data |
---|---|---|
708f4980 C |
1 | Coccinelle |
2 | ||
3 | ||
34e49164 C |
4 | Coccinelle allows programmers to easily write some complex |
5 | style-preserving source-to-source transformations on C source code, | |
6 | like for instance to perform some refactorings. | |
7 | ||
8 | To install Coccinelle from its source, see the instructions in install.txt. | |
d6ce1786 C |
9 | Once you have installed coccinelle, there is a script 'spatch' in /usr/bin |
10 | or /usr/local/bin that invokes the Coccinelle program. | |
11 | ||
12 | If you want to run Coccinelle without installing it, you can run the | |
13 | Coccinelle program directly from the download/build directory. You may then | |
14 | have to setup a few environment variables so that the Coccinelle program | |
708f4980 | 15 | knows where to find its configuration files. |
34e49164 C |
16 | For bash do: |
17 | ||
708f4980 | 18 | $ source env.sh |
34e49164 C |
19 | |
20 | For tcsh do: | |
21 | ||
708f4980 | 22 | $ source env.csh |
34e49164 | 23 | |
d6ce1786 C |
24 | |
25 | You can test coccinelle with: | |
978fd7e5 C |
26 | |
27 | $ spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c | |
34e49164 | 28 | |
d6ce1786 | 29 | If you haven't installed coccinelle, run then ./spatch or ./spatch.opt |
34e49164 | 30 | |
34e49164 | 31 | |
34e49164 C |
32 | |
33 | If you downloaded the bytecode version of spatch you may first | |
34 | have to install OCaml (which contains the 'ocamlrun' bytecode interpreter, | |
35 | the equivalent of 'java', the Java virtual machine, but for OCaml) and then do: | |
36 | ||
978fd7e5 | 37 | $ ocamlrun spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c |
708f4980 C |
38 | |
39 | ||
708f4980 C |
40 | For more information on Coccinelle, type 'make docs' and have a look at the |
41 | files in the docs/ directory. You may need to install the texlive-fonts-extra | |
42 | packages from your distribution to compile some of the LaTeX documentation | |
43 | files. | |
44 | ||
174d1640 C |
45 | ** Runtime dependencies under Debian/Ubuntu** |
46 | ||
47 | - For the OCaml scripting feature in SmPL | |
48 | ocaml-native-compilers | |
49 | or ocaml-nox |