Release coccinelle-0.2.0
[bpt/coccinelle.git] / tools / Makefile
1 # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
2 # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
3 # This file is part of Coccinelle.
4 #
5 # Coccinelle is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, according to version 2 of the License.
8 #
9 # Coccinelle is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # The authors reserve the right to distribute this or future versions of
18 # Coccinelle under other licenses.
19
20
21 -include ../Makefile.config
22
23 PROGS=spp gitgrep split_patch extract_c_and_res #generate_dependencies
24
25 all: $(SUBDIRS) $(PROGS)
26
27 # for recursive make
28 all.opt: $(PROGS)
29
30 gitgrep: gitgrep.ml
31 ocamlopt -o gitgrep str.cmxa gitgrep.ml
32
33 gitsort: gitsort.ml
34 ocamlopt -o gitsort str.cmxa gitsort.ml
35
36 isoprof: process_isoprofile.ml
37 ocamlc -g -o isoprof str.cma process_isoprofile.ml
38
39 alloc_free: alloc_free.ml
40 ocamlopt -o alloc_free str.cmxa alloc_free.ml
41
42 # more flexible version of alloc_free
43 bridge: bridge.ml
44 ocamlopt -o bridge str.cmxa bridge.ml
45
46 install_bridge: bridge
47 cp -f bridge /usr/local/bin
48
49 .PHONY: $(SUBDIRS)
50
51
52 SYSLIBS = str.cma unix.cma bigarray.cma
53
54 INCLUDE=-I ../commons -I ../extra -I ../parsing_c
55 LIBS=../commons/commons.cma ../globals/globals.cma \
56 ../parsing_c/parsing_c.cma ../extra/extra.cma
57
58 OCAMLC=ocamlc$(OPTBIN) -g -dtypes $(INCLUDE)
59 OCAMLOPT=ocamlopt$(OPTBIN) $(INCLUDE) $(OPTFLAGS)
60 #OCAMLLEX=ocamllex$(OPTBIN) -ml
61 OCAMLLEX=ocamllex$(OPTBIN)
62 OCAMLYACC=ocamlyacc -v
63 OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDE)
64 OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDE)
65
66 spp: spp.ml
67 $(OCAMLC) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+
68 # ocamlc -I ../commons/ -o spp str.cma unix.cma bigarray.cma ../commons/common.cmo spp.ml
69
70 split_patch: split_patch.cmo
71 $(OCAMLC) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+
72
73 extract_c_and_res: extract_c_and_res.cmo
74 $(OCAMLC) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+
75
76 generate_dependencies: generate_dependencies.cmo
77 $(OCAMLC) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+
78
79 .SUFFIXES: .ml .mli .cmo .cmi .cmx
80
81 .ml.cmo:
82 $(OCAMLC) -c $<
83 .mli.cmi:
84 $(OCAMLC) -c $<
85 .ml.cmx:
86 $(OCAMLOPT) -c $<
87
88 clean:
89 rm -f $(PROGS)
90 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
91
92 beforedepend::
93
94 depend:: beforedepend
95 ocamldep $(INCLUDE) *.mli *.ml > .depend
96
97 distclean::
98 rm -f .depend
99
100 -include .depend