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