Commit | Line | Data |
---|---|---|
c491d8ee C |
1 | # Copyright 2010, INRIA, University of Copenhagen |
2 | # Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix | |
3 | # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen | |
4 | # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix | |
5 | # This file is part of Coccinelle. | |
6 | # | |
7 | # Coccinelle is free software: you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation, according to version 2 of the License. | |
10 | # | |
11 | # Coccinelle is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>. | |
18 | # | |
19 | # The authors reserve the right to distribute this or future versions of | |
20 | # Coccinelle under other licenses. | |
21 | ||
22 | ||
951c7801 | 23 | |
34e49164 C |
24 | ############################################################################# |
25 | # Configuration section | |
26 | ############################################################################# | |
27 | ||
28 | -include Makefile.config | |
c3e37e97 | 29 | -include /etc/lsb-release |
34e49164 | 30 | |
b1b2de81 | 31 | VERSION=$(shell cat globals/config.ml.in |grep version |perl -p -e 's/.*"(.*)".*/$$1/;') |
951c7801 | 32 | CCVERSION=$(shell cat scripts/coccicheck/README |grep "Coccicheck version" |perl -p -e 's/.*version (.*)[ ]*/$$1/;') |
c3e37e97 C |
33 | PKGVERSION=$(shell dpkg-parsechangelog -ldebian/changelog.$(DISTRIB_CODENAME) 2> /dev/null \ |
34 | | sed -n 's/^Version: \(.*\)/\1/p' ) | |
34e49164 C |
35 | |
36 | ############################################################################## | |
37 | # Variables | |
38 | ############################################################################## | |
39 | TARGET=spatch | |
c3e37e97 | 40 | PRJNAME=coccinelle |
34e49164 C |
41 | |
42 | SRC=flag_cocci.ml cocci.ml testing.ml test.ml main.ml | |
43 | ||
34e49164 | 44 | ifeq ($(FEATURE_PYTHON),1) |
90aeb998 | 45 | PYCMA=pycaml.cma |
b1b2de81 | 46 | # the following is essential for Coccinelle to compile under gentoo (weird) |
90aeb998 | 47 | #OPTLIBFLAGS=-cclib dllpycaml_stubs.so |
34e49164 C |
48 | else |
49 | PYCMA= | |
90aeb998 | 50 | endif |
34e49164 | 51 | OPTLIBFLAGS= |
90aeb998 C |
52 | |
53 | ifeq ("$(SEXPDIR)","ocamlsexp") | |
54 | SEXPLIB=sexplib.cmo | |
55 | OPTSEXPLIB=sexplib.cmx | |
56 | else | |
57 | SEXPLIB=sexplib.cma | |
58 | OPTSEXPLIB=sexplib.cmxa | |
34e49164 C |
59 | endif |
60 | ||
88e71198 C |
61 | ifeq ("$(DYNLINK)","no") |
62 | DYNLINK= | |
63 | else | |
64 | DYNLINK=dynlink.cma | |
65 | endif | |
66 | ||
b1b2de81 | 67 | SEXPSYSCMA=bigarray.cma nums.cma |
34e49164 | 68 | |
88e71198 | 69 | SYSLIBS=str.cma unix.cma $(SEXPSYSCMA) $(PYCMA) $(DYNLINK) # threads.cma |
b1b2de81 | 70 | LIBS=commons/commons.cma \ |
90aeb998 | 71 | commons/commons_sexp.cma \ |
b1b2de81 | 72 | globals/globals.cma \ |
34e49164 C |
73 | ctl/ctl.cma \ |
74 | parsing_cocci/cocci_parser.cma parsing_c/parsing_c.cma \ | |
951c7801 | 75 | engine/cocciengine.cma popl09/popl.cma \ |
174d1640 | 76 | extra/extra.cma python/coccipython.cma ocaml/cocciocaml.cma |
90aeb998 C |
77 | |
78 | # Should we use the local version of pycaml | |
79 | ifeq ("$(PYCAMLDIR)","pycaml") | |
80 | LOCALPYCAML=pycaml | |
81 | else | |
82 | LOCALPYCAML= | |
83 | endif | |
84 | ||
85 | # Should we use the local version of menhirLib | |
174d1640 C |
86 | ifeq ("$(MENHIRDIR)","menhirlib") |
87 | LOCALMENHIR=menhirlib | |
90aeb998 C |
88 | else |
89 | LOCALMENHIR= | |
90 | endif | |
91 | ||
92 | # Should we use the local version of ocamlsexp | |
93 | ifeq ("$(SEXPDIR)","ocamlsexp") | |
94 | LOCALSEXP=ocamlsexp | |
95 | else | |
96 | LOCALSEXP= | |
97 | endif | |
34e49164 | 98 | |
174d1640 | 99 | # used for depend: and a little for rec & rec.opt |
90aeb998 C |
100 | MAKESUBDIRS=$(LOCALPYCAML) $(LOCALSEXP) commons \ |
101 | globals $(LOCALMENHIR) ctl parsing_cocci parsing_c \ | |
174d1640 C |
102 | engine popl09 extra python ocaml |
103 | ||
104 | # used for clean: | |
105 | # It is like MAKESUBDIRS but also | |
106 | # force cleaning of local library copies | |
107 | CLEANSUBDIRS=pycaml ocamlsexp commons \ | |
108 | globals menhirlib ctl parsing_cocci parsing_c \ | |
109 | engine popl09 extra python ocaml | |
90aeb998 C |
110 | |
111 | INCLUDEDIRSDEP=commons commons/ocamlextra $(LOCALSEXP) \ | |
112 | globals $(LOCALMENHIR) $(LOCALPYCAML) ctl \ | |
174d1640 | 113 | parsing_cocci parsing_c engine popl09 extra python ocaml |
34e49164 | 114 | |
90aeb998 C |
115 | INCLUDEDIRS=$(INCLUDEDIRSDEP) $(SEXPDIR) $(MENHIRDIR) $(PYCAMLDIR) |
116 | ||
34e49164 C |
117 | ############################################################################## |
118 | # Generic variables | |
119 | ############################################################################## | |
120 | ||
121 | INCLUDES=$(INCLUDEDIRS:%=-I %) | |
122 | ||
123 | OBJS= $(SRC:.ml=.cmo) | |
124 | OPTOBJS= $(SRC:.ml=.cmx) | |
125 | ||
126 | EXEC=$(TARGET) | |
127 | ||
128 | ############################################################################## | |
129 | # Generic ocaml variables | |
130 | ############################################################################## | |
131 | ||
ae4735db | 132 | OCAMLCFLAGS= |
34e49164 C |
133 | |
134 | # for profiling add -p -inline 0 | |
135 | # but 'make forprofiling' below does that for you. | |
136 | # This flag is also used in subdirectories so don't change its name here. | |
708f4980 | 137 | # To enable backtrace support for native code, you need to put -g in OPTFLAGS |
c491d8ee C |
138 | # to also link with -g. |
139 | OPTFLAGS= -g | |
34e49164 | 140 | |
34e49164 | 141 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) |
faf9a90c | 142 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) |
34e49164 C |
143 | OCAMLLEX=ocamllex #-ml # -ml for debugging lexer, but slightly slower |
144 | OCAMLYACC=ocamlyacc -v | |
90aeb998 | 145 | OCAMLDEP=ocamldep $(INCLUDEDIRSDEP:%=-I %) |
34e49164 C |
146 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) |
147 | ||
148 | # can also be set via 'make static' | |
149 | STATIC= #-ccopt -static | |
150 | ||
151 | # can also be unset via 'make purebytecode' | |
152 | BYTECODE_STATIC=-custom | |
153 | ||
154 | ############################################################################## | |
155 | # Top rules | |
156 | ############################################################################## | |
b1b2de81 C |
157 | .PHONY:: all all.opt byte opt top clean distclean configure |
158 | .PHONY:: $(MAKESUBDIRS) $(MAKESUBDIRS:%=%.opt) subdirs subdirs.opt | |
159 | ||
708f4980 | 160 | all: Makefile.config byte preinstall |
b1b2de81 C |
161 | |
162 | opt: all.opt | |
708f4980 | 163 | all.opt: opt-compil preinstall |
faf9a90c | 164 | |
708f4980 | 165 | world: preinstall |
b1b2de81 | 166 | $(MAKE) byte |
708f4980 | 167 | $(MAKE) opt-compil |
b1b2de81 C |
168 | |
169 | byte: .depend | |
faf9a90c C |
170 | $(MAKE) subdirs |
171 | $(MAKE) $(EXEC) | |
172 | ||
b1b2de81 | 173 | opt-compil: .depend |
faf9a90c C |
174 | $(MAKE) subdirs.opt |
175 | $(MAKE) $(EXEC).opt | |
176 | ||
485bce71 | 177 | top: $(EXEC).top |
34e49164 | 178 | |
0708f913 | 179 | subdirs: |
b1b2de81 | 180 | +for D in $(MAKESUBDIRS); do $(MAKE) $$D || exit 1 ; done |
90aeb998 | 181 | $(MAKE) -C commons sexp OCAMLCFLAGS="$(OCAMLCFLAGS)" |
0708f913 C |
182 | |
183 | subdirs.opt: | |
b1b2de81 | 184 | +for D in $(MAKESUBDIRS); do $(MAKE) $$D.opt || exit 1 ; done |
aba5c457 | 185 | $(MAKE) -C commons sexp.opt OPTFLAGS="$(OPTFLAGS)" |
faf9a90c C |
186 | |
187 | $(MAKESUBDIRS): | |
188 | $(MAKE) -C $@ OCAMLCFLAGS="$(OCAMLCFLAGS)" all | |
189 | ||
190 | $(MAKESUBDIRS:%=%.opt): | |
aba5c457 | 191 | $(MAKE) -C $(@:%.opt=%) OPTFLAGS="$(OPTFLAGS)" all.opt |
faf9a90c | 192 | |
b1b2de81 | 193 | #dependencies: |
0708f913 C |
194 | # commons: |
195 | # globals: | |
196 | # menhirlib: | |
197 | # parsing_cocci: commons globals menhirlib | |
198 | # parsing_c:parsing_cocci | |
199 | # ctl:globals commons | |
200 | # engine: parsing_cocci parsing_c ctl | |
951c7801 | 201 | # popl09:engine |
0708f913 C |
202 | # extra: parsing_cocci parsing_c ctl |
203 | # pycaml: | |
204 | # python:pycaml parsing_cocci parsing_c | |
faf9a90c | 205 | |
34e49164 | 206 | clean:: |
174d1640 | 207 | set -e; for i in $(CLEANSUBDIRS); do $(MAKE) -C $$i $@; done |
c3e37e97 | 208 | $(MAKE) -C demos/spp $@ |
34e49164 | 209 | |
0708f913 C |
210 | $(LIBS): $(MAKESUBDIRS) |
211 | $(LIBS:.cma=.cmxa): $(MAKESUBDIRS:%=%.opt) | |
faf9a90c C |
212 | |
213 | $(OBJS):$(LIBS) | |
214 | $(OPTOBJS):$(LIBS:.cma=.cmxa) | |
215 | ||
34e49164 | 216 | $(EXEC): $(LIBS) $(OBJS) |
90aeb998 | 217 | $(OCAMLC) $(BYTECODE_STATIC) -o $@ $(SYSLIBS) $(SEXPLIB) $^ |
34e49164 | 218 | |
faf9a90c | 219 | $(EXEC).opt: $(LIBS:.cma=.cmxa) $(OPTOBJS) |
90aeb998 | 220 | $(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $(OPTSEXPLIB) $(OPTLIBFLAGS) $^ |
34e49164 | 221 | |
faf9a90c | 222 | $(EXEC).top: $(LIBS) $(OBJS) |
90aeb998 | 223 | $(OCAMLMKTOP) -custom -o $@ $(SYSLIBS) $(SEXPLIB) $^ |
34e49164 C |
224 | |
225 | clean:: | |
226 | rm -f $(TARGET) $(TARGET).opt $(TARGET).top | |
34e49164 | 227 | |
b1b2de81 C |
228 | .PHONY:: tools configure |
229 | ||
230 | configure: | |
231 | ./configure | |
34e49164 | 232 | |
7f004419 | 233 | Makefile.config: |
708f4980 C |
234 | @echo "Makefile.config is missing. Have you run ./configure?" |
235 | @exit 1 | |
236 | ||
c491d8ee | 237 | tools: $(LIBS) |
34e49164 | 238 | $(MAKE) -C tools |
b1b2de81 | 239 | |
c491d8ee C |
240 | distclean:: |
241 | if [ -d tools ] ; then $(MAKE) -C tools distclean ; fi | |
34e49164 | 242 | |
34e49164 C |
243 | static: |
244 | rm -f spatch.opt spatch | |
245 | $(MAKE) STATIC="-ccopt -static" spatch.opt | |
246 | cp spatch.opt spatch | |
247 | ||
248 | purebytecode: | |
249 | rm -f spatch.opt spatch | |
250 | $(MAKE) BYTECODE_STATIC="" spatch | |
fc1ad971 | 251 | perl -p -i -e 's/^#!.*/#!\/usr\/bin\/ocamlrun/' spatch |
34e49164 C |
252 | |
253 | ||
b1b2de81 C |
254 | ############################################################################## |
255 | # Build documentation | |
256 | ############################################################################## | |
257 | .PHONY:: docs | |
258 | ||
259 | docs: | |
260 | make -C docs | |
261 | ||
262 | clean:: | |
263 | make -C docs clean | |
264 | ||
265 | distclean:: | |
266 | make -C docs distclean | |
267 | ||
268 | ############################################################################## | |
269 | # Pre-Install (customization of spatch frontend script) | |
270 | ############################################################################## | |
b1b2de81 | 271 | |
90aeb998 C |
272 | preinstall: docs/spatch.1 scripts/spatch scripts/spatch.opt scripts/spatch.byte |
273 | ||
274 | docs/spatch.1: Makefile.config | |
275 | $(MAKE) -C docs spatch.1 | |
b1b2de81 C |
276 | |
277 | # user will use spatch to run spatch.opt (native) | |
5636bb2c | 278 | scripts/spatch: Makefile.config |
b1b2de81 C |
279 | cp scripts/spatch.sh scripts/spatch.tmp2 |
280 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.tmp2 > scripts/spatch.tmp | |
281 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.tmp > scripts/spatch | |
282 | rm -f scripts/spatch.tmp2 scripts/spatch.tmp | |
283 | ||
284 | # user will use spatch to run spatch (bytecode) | |
5636bb2c | 285 | scripts/spatch.byte: Makefile.config |
708f4980 C |
286 | cp scripts/spatch.sh scripts/spatch.byte.tmp3 |
287 | sed "s|\.opt||" scripts/spatch.byte.tmp3 > scripts/spatch.byte.tmp2 | |
288 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.byte.tmp2 \ | |
289 | > scripts/spatch.byte.tmp | |
290 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.byte.tmp \ | |
291 | > scripts/spatch.byte | |
292 | rm -f scripts/spatch.byte.tmp3 \ | |
293 | scripts/spatch.byte.tmp2 \ | |
294 | scripts/spatch.byte.tmp | |
b1b2de81 C |
295 | |
296 | # user will use spatch.opt to run spatch.opt (native) | |
5636bb2c | 297 | scripts/spatch.opt: Makefile.config |
b1b2de81 | 298 | cp scripts/spatch.sh scripts/spatch.opt.tmp2 |
708f4980 C |
299 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.opt.tmp2 \ |
300 | > scripts/spatch.opt.tmp | |
301 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.opt.tmp \ | |
302 | > scripts/spatch.opt | |
b1b2de81 C |
303 | rm -f scripts/spatch.opt.tmp scripts/spatch.opt.tmp2 |
304 | ||
305 | clean:: | |
306 | rm -f scripts/spatch scripts/spatch.byte scripts/spatch.opt | |
307 | ||
34e49164 C |
308 | ############################################################################## |
309 | # Install | |
310 | ############################################################################## | |
311 | ||
312 | # don't remove DESTDIR, it can be set by package build system like ebuild | |
8ba84ae2 | 313 | # for staged installation. |
0708f913 | 314 | install-common: |
34e49164 C |
315 | mkdir -p $(DESTDIR)$(BINDIR) |
316 | mkdir -p $(DESTDIR)$(LIBDIR) | |
174d1640 | 317 | mkdir -p $(DESTDIR)$(SHAREDIR)/ocaml |
413ffc02 | 318 | mkdir -p $(DESTDIR)$(SHAREDIR)/commons |
ca417fcf | 319 | mkdir -p $(DESTDIR)$(SHAREDIR)/globals |
413ffc02 | 320 | mkdir -p $(DESTDIR)$(SHAREDIR)/parsing_c |
faf9a90c | 321 | mkdir -p $(DESTDIR)$(MANDIR)/man1 |
8ba84ae2 C |
322 | $(INSTALL_DATA) standard.h $(DESTDIR)$(SHAREDIR) |
323 | $(INSTALL_DATA) standard.iso $(DESTDIR)$(SHAREDIR) | |
174d1640 | 324 | $(INSTALL_DATA) ocaml/coccilib.cmi $(DESTDIR)$(SHAREDIR)/ocaml/ |
413ffc02 C |
325 | $(INSTALL_DATA) parsing_c/*.cmi $(DESTDIR)$(SHAREDIR)/parsing_c/ |
326 | $(INSTALL_DATA) commons/*.cmi $(DESTDIR)$(SHAREDIR)/commons/ | |
ca417fcf | 327 | $(INSTALL_DATA) globals/iteration.cmi $(DESTDIR)$(SHAREDIR)/globals/ |
8ba84ae2 C |
328 | $(INSTALL_DATA) docs/spatch.1 $(DESTDIR)$(MANDIR)/man1/ |
329 | @if [ $(FEATURE_PYTHON) -eq 1 ]; then $(MAKE) install-python; fi | |
174d1640 C |
330 | |
331 | install-bash: | |
332 | mkdir -p $(DESTDIR)$(BASH_COMPLETION_DIR) | |
333 | $(INSTALL_DATA) scripts/spatch.bash_completion \ | |
334 | $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch | |
0708f913 | 335 | |
c491d8ee C |
336 | install-tools: |
337 | mkdir -p $(DESTDIR)$(BINDIR) | |
338 | $(INSTALL_PROGRAM) tools/splitpatch \ | |
339 | $(DESTDIR)$(BINDIR)/splitpatch | |
340 | $(INSTALL_PROGRAM) tools/cocci-send-email.perl \ | |
341 | $(DESTDIR)$(BINDIR)/cocci-send-email.perl | |
342 | ||
8ba84ae2 C |
343 | install-python: |
344 | mkdir -p $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
345 | $(INSTALL_DATA) python/coccilib/*.py \ | |
346 | $(DESTDIR)$(SHAREDIR)/python/coccilib | |
347 | $(INSTALL_DATA) python/coccilib/coccigui/*.py \ | |
348 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
b1b2de81 C |
349 | $(INSTALL_DATA) python/coccilib/coccigui/pygui.glade \ |
350 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
351 | $(INSTALL_DATA) python/coccilib/coccigui/pygui.gladep \ | |
352 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
90aeb998 C |
353 | if [ -f pycaml/dllpycaml_stubs.so ]; then \ |
354 | $(INSTALL_LIB) pycaml/dllpycaml_stubs.so $(DESTDIR)$(LIBDIR) ; fi | |
8ba84ae2 | 355 | |
951c7801 | 356 | install: install-common |
b1b2de81 C |
357 | @if test -x spatch -a ! -x spatch.opt ; then \ |
358 | $(MAKE) install-byte;fi | |
359 | @if test ! -x spatch -a -x spatch.opt ; then \ | |
360 | $(MAKE) install-def; $(MAKE) install-opt;fi | |
361 | @if test -x spatch -a -x spatch.opt ; then \ | |
362 | $(MAKE) install-byte; $(MAKE) install-opt;fi | |
363 | @if test ! -x spatch -a ! -x spatch.opt ; then \ | |
364 | echo "\n\n\t==> Run 'make', 'make opt', or both first. <==\n\n";fi | |
708f4980 C |
365 | @echo "" |
366 | @echo "\tYou can also install spatch by copying the program spatch" | |
367 | @echo "\t(available in this directory) anywhere you want and" | |
368 | @echo "\tgive it the right options to find its configuration files." | |
369 | @echo "" | |
b1b2de81 | 370 | |
0708f913 | 371 | # user will use spatch to run spatch.opt (native) |
708f4980 | 372 | install-def: |
8ba84ae2 | 373 | $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 374 | $(INSTALL_PROGRAM) scripts/spatch $(DESTDIR)$(BINDIR)/spatch |
0708f913 C |
375 | |
376 | # user will use spatch to run spatch (bytecode) | |
708f4980 | 377 | install-byte: |
8ba84ae2 | 378 | $(INSTALL_PROGRAM) spatch $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 379 | $(INSTALL_PROGRAM) scripts/spatch.byte $(DESTDIR)$(BINDIR)/spatch |
0708f913 C |
380 | |
381 | # user will use spatch.opt to run spatch.opt (native) | |
708f4980 | 382 | install-opt: |
8ba84ae2 | 383 | $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 384 | $(INSTALL_PROGRAM) scripts/spatch.opt $(DESTDIR)$(BINDIR)/spatch.opt |
34e49164 C |
385 | |
386 | uninstall: | |
387 | rm -f $(DESTDIR)$(BINDIR)/spatch | |
8ba84ae2 | 388 | rm -f $(DESTDIR)$(BINDIR)/spatch.opt |
34e49164 | 389 | rm -f $(DESTDIR)$(LIBDIR)/dllpycaml_stubs.so |
90aeb998 C |
390 | rm -f $(DESTDIR)$(SHAREDIR)/spatch |
391 | rm -f $(DESTDIR)$(SHAREDIR)/spatch.opt | |
34e49164 C |
392 | rm -f $(DESTDIR)$(SHAREDIR)/standard.h |
393 | rm -f $(DESTDIR)$(SHAREDIR)/standard.iso | |
174d1640 | 394 | rm -f $(DESTDIR)$(SHAREDIR)/ocaml/coccilib.cmi |
413ffc02 | 395 | rm -f $(DESTDIR)$(SHAREDIR)/parsing_c/*.cmi |
ca417fcf C |
396 | rm -f $(DESTDIR)$(SHAREDIR)/commons/*.cmi |
397 | rm -f $(DESTDIR)$(SHAREDIR)/globals/*.cmi | |
90aeb998 C |
398 | rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui/* |
399 | rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/*.py | |
400 | rmdir --ignore-fail-on-non-empty -p \ | |
401 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
ca417fcf C |
402 | rmdir $(DESTDIR)$(SHAREDIR)/globals |
403 | rmdir $(DESTDIR)$(SHAREDIR)/commons | |
404 | rmdir $(DESTDIR)$(SHAREDIR)/parsing_c | |
405 | rmdir $(DESTDIR)$(SHAREDIR)/ocaml | |
406 | rmdir $(DESTDIR)$(SHAREDIR) | |
faf9a90c | 407 | rm -f $(DESTDIR)$(MANDIR)/man1/spatch.1 |
34e49164 | 408 | |
aba5c457 C |
409 | uninstall-bash: |
410 | rm -f $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch | |
411 | rmdir --ignore-fail-on-non-empty -p \ | |
412 | $(DESTDIR)$(BASH_COMPLETION_DIR) | |
413 | ||
c491d8ee C |
414 | uninstall-tools: |
415 | rm -f $(DESTDIR)$(BINDIR)/splitpatch | |
416 | rm -f $(DESTDIR)$(BINDIR)/cocci-send-email.perl | |
417 | ||
34e49164 | 418 | version: |
951c7801 | 419 | @echo "spatch $(VERSION)" |
c3e37e97 | 420 | @echo "spatch $(PKGVERSION) ($(DISTRIB_ID))" |
951c7801 | 421 | @echo "coccicheck $(CCVERSION)" |
34e49164 C |
422 | |
423 | ||
424 | ############################################################################## | |
5636bb2c | 425 | # Deb package (for Ubuntu) and release rules |
34e49164 C |
426 | ############################################################################## |
427 | ||
5636bb2c | 428 | include Makefile.release |
c3e37e97 | 429 | |
34e49164 C |
430 | ############################################################################## |
431 | # Developer rules | |
432 | ############################################################################## | |
433 | ||
7f004419 C |
434 | -include Makefile.dev |
435 | ||
34e49164 C |
436 | test: $(TARGET) |
437 | ./$(TARGET) -testall | |
438 | ||
439 | testparsing: | |
440 | ./$(TARGET) -D standard.h -parse_c -dir tests/ | |
441 | ||
442 | ||
443 | ||
faf9a90c C |
444 | # -inline 0 to see all the functions in the profile. |
445 | # Can also use the profile framework in commons/ and run your program | |
34e49164 C |
446 | # with -profile. |
447 | forprofiling: | |
448 | $(MAKE) OPTFLAGS="-p -inline 0 " opt | |
449 | ||
450 | clean:: | |
faf9a90c | 451 | rm -f gmon.out |
34e49164 C |
452 | |
453 | tags: | |
454 | otags -no-mli-tags -r . | |
455 | ||
456 | dependencygraph: | |
951c7801 | 457 | find -name "*.ml" |grep -v "scripts" | xargs ocamldep -I commons -I globals -I ctl -I parsing_cocci -I parsing_c -I engine -I popl09 -I extra > /tmp/dependfull.depend |
485bce71 | 458 | ocamldot -lr /tmp/dependfull.depend > /tmp/dependfull.dot |
34e49164 | 459 | dot -Tps /tmp/dependfull.dot > /tmp/dependfull.ps |
485bce71 | 460 | ps2pdf /tmp/dependfull.ps /tmp/dependfull.pdf |
34e49164 C |
461 | |
462 | ############################################################################## | |
463 | # Misc rules | |
464 | ############################################################################## | |
465 | ||
faf9a90c | 466 | # each member of the project can have its own test.ml. this file is |
34e49164 | 467 | # not under CVS. |
faf9a90c | 468 | test.ml: |
34e49164 C |
469 | echo "let foo_ctl () = failwith \"there is no foo_ctl formula\"" \ |
470 | > test.ml | |
471 | ||
472 | beforedepend:: test.ml | |
473 | ||
474 | ||
475 | #INC=$(dir $(shell which ocaml)) | |
476 | #INCX=$(INC:/=) | |
477 | #INCY=$(dir $(INCX)) | |
478 | #INCZ=$(INCY:/=)/lib/ocaml | |
479 | # | |
480 | #prim.o: prim.c | |
481 | # gcc -c -o prim.o -I $(INCZ) prim.c | |
482 | ||
483 | ||
484 | ############################################################################## | |
485 | # Generic ocaml rules | |
486 | ############################################################################## | |
487 | ||
488 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
489 | ||
490 | .ml.cmo: | |
491 | $(OCAMLC) -c $< | |
492 | .mli.cmi: | |
493 | $(OCAMLC) -c $< | |
494 | .ml.cmx: | |
495 | $(OCAMLOPT) -c $< | |
496 | ||
faf9a90c | 497 | .ml.mldepend: |
34e49164 C |
498 | $(OCAMLC) -i $< |
499 | ||
500 | clean:: | |
501 | rm -f *.cm[iox] *.o *.annot | |
34e49164 C |
502 | rm -f *~ .*~ *.exe #*# |
503 | ||
b1b2de81 C |
504 | distclean:: clean |
505 | set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done | |
506 | rm -f .depend | |
507 | rm -f Makefile.config | |
b1b2de81 C |
508 | rm -f globals/config.ml |
509 | rm -f TAGS | |
510 | rm -f tests/SCORE_actual.sexp | |
511 | rm -f tests/SCORE_best_of_both.sexp | |
512 | find -name ".#*1.*" | xargs rm -f | |
513 | ||
34e49164 C |
514 | beforedepend:: |
515 | ||
516 | depend:: beforedepend | |
517 | $(OCAMLDEP) *.mli *.ml > .depend | |
b1b2de81 C |
518 | set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done |
519 | ||
520 | .depend:: | |
521 | @if [ ! -f .depend ] ; then $(MAKE) depend ; fi | |
34e49164 C |
522 | |
523 | -include .depend |