Coccinelle release 1.0.0-rc15
[bpt/coccinelle.git] / tools / Makefile
CommitLineData
17ba0788
C
1# Copyright 2012, INRIA
2# Julia Lawall, Gilles Muller
3# Copyright 2010-2011, INRIA, University of Copenhagen
f537ebc4
C
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
feec80c3
C
25ifneq ($(MAKECMDGOALS),distclean)
26include ../Makefile.config
27endif
0708f913 28
755320b0
C
29OCAMLCFLAGS ?= -g
30OPTFLAGS ?= -g
d6ce1786 31
c491d8ee 32PROGS=spp gitgrep splitpatch extract_c_and_res #generate_dependencies
34e49164 33
faf9a90c 34all: $(SUBDIRS) $(PROGS)
34e49164 35
d6ce1786
C
36all.opt:
37 @$(MAKE) $(PROGS) BUILD_OPT=yes
34e49164
C
38
39gitgrep: gitgrep.ml
feec80c3 40 $(OCAMLOPT) -o gitgrep str.cmxa gitgrep.ml
34e49164
C
41
42gitsort: gitsort.ml
feec80c3 43 $(OCAMLOPT) -o gitsort str.cmxa gitsort.ml
34e49164
C
44
45isoprof: process_isoprofile.ml
feec80c3 46 $(OCAMLC) -g -o isoprof str.cma process_isoprofile.ml
34e49164
C
47
48alloc_free: alloc_free.ml
feec80c3 49 $(OCAMLOPT) -o alloc_free str.cmxa alloc_free.ml
34e49164
C
50
51# more flexible version of alloc_free
52bridge: bridge.ml
feec80c3 53 $(OCAMLOPT) -o bridge str.cmxa dumper.mli dumper.ml bridge.ml
34e49164
C
54
55install_bridge: bridge
56 cp -f bridge /usr/local/bin
57
faf9a90c
C
58.PHONY: $(SUBDIRS)
59
34e49164 60
978fd7e5 61SYSLIBS = str.cma unix.cma bigarray.cma
34e49164
C
62
63INCLUDE=-I ../commons -I ../extra -I ../parsing_c
64LIBS=../commons/commons.cma ../globals/globals.cma \
b1b2de81 65 ../parsing_c/parsing_c.cma ../extra/extra.cma
34e49164 66
755320b0
C
67OCAMLC_CMD=$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDE)
68OCAMLOPT_CMD=$(OCAMLOPT) $(OPTFLAGS) $(INCLUDE)
feec80c3
C
69OCAMLDEP_CMD=$(OCAMLDEP) $(INCLUDE)
70OCAMLMKTOP_CMD=$(OCAMLMKTOP) -g -custom $(INCLUDE)
71OCAMLYACC_CMD=$(OCAMLYACC) -v
34e49164 72
978fd7e5 73spp: spp.ml
feec80c3 74 $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+
978fd7e5 75
c491d8ee 76splitpatch: splitpatch.cmo
feec80c3 77 $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $+
34e49164
C
78
79extract_c_and_res: extract_c_and_res.cmo
feec80c3 80 $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+
34e49164 81
34e49164 82generate_dependencies: generate_dependencies.cmo
feec80c3 83 $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+
34e49164 84
34e49164
C
85.SUFFIXES: .ml .mli .cmo .cmi .cmx
86
87.ml.cmo:
feec80c3 88 $(OCAMLC_CMD) -c $<
34e49164 89.mli.cmi:
feec80c3 90 $(OCAMLC_CMD) -c $<
34e49164 91.ml.cmx:
feec80c3 92 $(OCAMLOPT_CMD) -c $<
34e49164 93
faf9a90c
C
94clean:
95 rm -f $(PROGS)
34e49164 96 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
feec80c3 97 rm -f .depend
34e49164 98
feec80c3 99distclean: clean
34e49164 100
feec80c3
C
101.PHONEY: depend
102.depend depend: beforedepend
103 ocamldep $(INCLUDE) *.mli *.ml > .depend
b1b2de81 104
feec80c3
C
105ifneq ($(MAKECMDGOALS),clean)
106ifneq ($(MAKECMDGOALS),distclean)
34e49164 107-include .depend
feec80c3
C
108endif
109endif
d6ce1786
C
110
111include ../Makefile.common