Commit | Line | Data |
---|---|---|
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 |
25 | ifneq ($(MAKECMDGOALS),distclean) |
26 | include ../Makefile.config | |
27 | endif | |
0708f913 | 28 | |
755320b0 C |
29 | OCAMLCFLAGS ?= -g |
30 | OPTFLAGS ?= -g | |
d6ce1786 | 31 | |
abad11c5 C |
32 | SYSLIBS = str.cma unix.cma bigarray.cma |
33 | ||
34 | INCLUDE=-I ../commons -I ../extra -I ../parsing_c | |
35 | LIBS=../commons/commons.cma ../globals/globals.cma \ | |
36 | ../parsing_c/parsing_c.cma ../extra/extra.cma | |
37 | ||
38 | OCAMLC_CMD=$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDE) | |
39 | OCAMLOPT_CMD=$(OCAMLOPT) $(OPTFLAGS) $(INCLUDE) | |
40 | OCAMLDEP_CMD=$(OCAMLDEP) $(INCLUDE) | |
41 | OCAMLMKTOP_CMD=$(OCAMLMKTOP) -g -custom $(INCLUDE) | |
42 | OCAMLYACC_CMD=$(OCAMLYACC) -v | |
43 | ||
34e49164 | 44 | |
abad11c5 C |
45 | PROGS=spp gitgrep splitpatch extract_c_and_res \ |
46 | gitsort alloc_free bridge \ | |
47 | process_isoprofile | |
48 | #generate_dependencies | |
49 | ||
50 | ifneq ($(FEATURE_OCAMLBUILD),yes) | |
51 | all: $(PROGS) | |
34e49164 | 52 | |
d6ce1786 C |
53 | all.opt: |
54 | @$(MAKE) $(PROGS) BUILD_OPT=yes | |
34e49164 C |
55 | |
56 | gitgrep: gitgrep.ml | |
feec80c3 | 57 | $(OCAMLOPT) -o gitgrep str.cmxa gitgrep.ml |
34e49164 C |
58 | |
59 | gitsort: gitsort.ml | |
feec80c3 | 60 | $(OCAMLOPT) -o gitsort str.cmxa gitsort.ml |
34e49164 | 61 | |
abad11c5 C |
62 | process_isoprofile: process_isoprofile.ml |
63 | $(OCAMLC) -g -o process_isoprofile str.cma process_isoprofile.ml | |
34e49164 C |
64 | |
65 | alloc_free: alloc_free.ml | |
feec80c3 | 66 | $(OCAMLOPT) -o alloc_free str.cmxa alloc_free.ml |
34e49164 C |
67 | |
68 | # more flexible version of alloc_free | |
69 | bridge: bridge.ml | |
feec80c3 | 70 | $(OCAMLOPT) -o bridge str.cmxa dumper.mli dumper.ml bridge.ml |
34e49164 C |
71 | |
72 | install_bridge: bridge | |
73 | cp -f bridge /usr/local/bin | |
74 | ||
978fd7e5 | 75 | spp: spp.ml |
feec80c3 | 76 | $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+ |
978fd7e5 | 77 | |
c491d8ee | 78 | splitpatch: splitpatch.cmo |
feec80c3 | 79 | $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $+ |
34e49164 C |
80 | |
81 | extract_c_and_res: extract_c_and_res.cmo | |
feec80c3 | 82 | $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+ |
34e49164 | 83 | |
34e49164 | 84 | generate_dependencies: generate_dependencies.cmo |
feec80c3 | 85 | $(OCAMLC_CMD) -o $@ $(SYSLIBS) $(INCLUDE) $(LIBS) $+ |
abad11c5 C |
86 | else |
87 | .PHONY: $(PROGS) $(PROGS:%.opt) isoprof | |
88 | ||
89 | all: $(PROGS) | |
90 | all.opt: $(PROGS:%=%.opt) | |
91 | ||
92 | $(PROGS): | |
93 | cd .. && $(OCAMLBUILD) tools/$@.byte | |
94 | cp ../_build/tools/$@.byte $@ | |
95 | ||
96 | $(PROGS:%=%.opt): | |
97 | cd .. && $(OCAMLBUILD) tools/$(@:%.opt=%).native | |
98 | cp ../_build/tools/$(@:%.opt=%).native $(@:%.opt=%) | |
99 | ||
100 | clean:: | |
101 | cd .. && $(OCAMLBUILD) -clean | |
102 | rm -f $(PROGS) | |
103 | endif | |
104 | ||
105 | isoprof: process_isoprofile | |
106 | cp process_isoprofile isoprof | |
107 | ||
34e49164 | 108 | |
34e49164 C |
109 | .SUFFIXES: .ml .mli .cmo .cmi .cmx |
110 | ||
111 | .ml.cmo: | |
feec80c3 | 112 | $(OCAMLC_CMD) -c $< |
34e49164 | 113 | .mli.cmi: |
feec80c3 | 114 | $(OCAMLC_CMD) -c $< |
34e49164 | 115 | .ml.cmx: |
feec80c3 | 116 | $(OCAMLOPT_CMD) -c $< |
34e49164 | 117 | |
abad11c5 C |
118 | clean:: |
119 | rm -f $(PROGS) isoprof | |
34e49164 | 120 | rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot |
feec80c3 | 121 | rm -f .depend |
34e49164 | 122 | |
feec80c3 | 123 | distclean: clean |
34e49164 | 124 | |
feec80c3 C |
125 | .PHONEY: depend |
126 | .depend depend: beforedepend | |
127 | ocamldep $(INCLUDE) *.mli *.ml > .depend | |
b1b2de81 | 128 | |
feec80c3 C |
129 | ifneq ($(MAKECMDGOALS),clean) |
130 | ifneq ($(MAKECMDGOALS),distclean) | |
34e49164 | 131 | -include .depend |
feec80c3 C |
132 | endif |
133 | endif | |
d6ce1786 C |
134 | |
135 | include ../Makefile.common |