Commit | Line | Data |
---|---|---|
faf9a90c | 1 | # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen |
34e49164 C |
2 | # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller |
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 | ############################################################################# | |
22 | # Configuration section | |
23 | ############################################################################# | |
24 | ||
25 | -include Makefile.config | |
26 | ||
b1b2de81 | 27 | VERSION=$(shell cat globals/config.ml.in |grep version |perl -p -e 's/.*"(.*)".*/$$1/;') |
34e49164 C |
28 | |
29 | ############################################################################## | |
30 | # Variables | |
31 | ############################################################################## | |
32 | TARGET=spatch | |
33 | ||
34 | SRC=flag_cocci.ml cocci.ml testing.ml test.ml main.ml | |
35 | ||
34e49164 C |
36 | ifeq ($(FEATURE_PYTHON),1) |
37 | PYCMA=pycaml/pycaml.cma | |
38 | PYDIR=pycaml | |
39 | PYLIB=dllpycaml_stubs.so | |
b1b2de81 | 40 | # the following is essential for Coccinelle to compile under gentoo (weird) |
34e49164 C |
41 | OPTLIBFLAGS=-cclib dllpycaml_stubs.so |
42 | else | |
43 | PYCMA= | |
44 | PYDIR= | |
45 | PYLIB= | |
46 | OPTLIBFLAGS= | |
47 | endif | |
48 | ||
b1b2de81 | 49 | SEXPSYSCMA=bigarray.cma nums.cma |
34e49164 | 50 | |
b1b2de81 C |
51 | SYSLIBS=str.cma unix.cma $(SEXPSYSCMA) |
52 | LIBS=commons/commons.cma \ | |
53 | ocamlsexp/sexplib1.cma commons/commons_sexp.cma \ | |
54 | globals/globals.cma \ | |
34e49164 C |
55 | ctl/ctl.cma \ |
56 | parsing_cocci/cocci_parser.cma parsing_c/parsing_c.cma \ | |
b1b2de81 | 57 | engine/cocciengine.cma \ |
34e49164 C |
58 | extra/extra.cma $(PYCMA) python/coccipython.cma |
59 | ||
b1b2de81 C |
60 | #used for clean: and depend: and a little for rec & rec.opt |
61 | MAKESUBDIRS=commons ocamlsexp \ | |
62 | globals menhirlib $(PYDIR) ctl parsing_cocci parsing_c \ | |
63 | engine extra python | |
64 | INCLUDEDIRS=commons commons/ocamlextra ocamlsexp \ | |
65 | globals menhirlib $(PYDIR) ctl \ | |
66 | parsing_cocci parsing_c engine extra python | |
34e49164 C |
67 | |
68 | ############################################################################## | |
69 | # Generic variables | |
70 | ############################################################################## | |
71 | ||
72 | INCLUDES=$(INCLUDEDIRS:%=-I %) | |
73 | ||
74 | OBJS= $(SRC:.ml=.cmo) | |
75 | OPTOBJS= $(SRC:.ml=.cmx) | |
76 | ||
77 | EXEC=$(TARGET) | |
78 | ||
79 | ############################################################################## | |
80 | # Generic ocaml variables | |
81 | ############################################################################## | |
82 | ||
83 | OCAMLCFLAGS= #-g -dtypes # -w A | |
84 | ||
85 | # for profiling add -p -inline 0 | |
86 | # but 'make forprofiling' below does that for you. | |
87 | # This flag is also used in subdirectories so don't change its name here. | |
708f4980 C |
88 | # To enable backtrace support for native code, you need to put -g in OPTFLAGS |
89 | # to also link with -g, but even in 3.11 the backtrace support seems buggy so | |
90 | # not worth it. | |
34e49164 C |
91 | OPTFLAGS= |
92 | # the following is essential for Coccinelle to compile under gentoo | |
93 | # but is now defined above in this file | |
94 | #OPTLIBFLAGS=-cclib dllpycaml_stubs.so | |
95 | ||
34e49164 | 96 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) |
faf9a90c | 97 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) |
34e49164 C |
98 | OCAMLLEX=ocamllex #-ml # -ml for debugging lexer, but slightly slower |
99 | OCAMLYACC=ocamlyacc -v | |
0708f913 | 100 | OCAMLDEP=ocamldep $(INCLUDES) |
34e49164 C |
101 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) |
102 | ||
103 | # can also be set via 'make static' | |
104 | STATIC= #-ccopt -static | |
105 | ||
106 | # can also be unset via 'make purebytecode' | |
107 | BYTECODE_STATIC=-custom | |
108 | ||
109 | ############################################################################## | |
110 | # Top rules | |
111 | ############################################################################## | |
b1b2de81 C |
112 | .PHONY:: all all.opt byte opt top clean distclean configure |
113 | .PHONY:: $(MAKESUBDIRS) $(MAKESUBDIRS:%=%.opt) subdirs subdirs.opt | |
114 | ||
708f4980 | 115 | all: Makefile.config byte preinstall |
b1b2de81 C |
116 | |
117 | opt: all.opt | |
708f4980 | 118 | all.opt: opt-compil preinstall |
faf9a90c | 119 | |
708f4980 | 120 | world: preinstall |
b1b2de81 | 121 | $(MAKE) byte |
708f4980 | 122 | $(MAKE) opt-compil |
b1b2de81 C |
123 | |
124 | byte: .depend | |
faf9a90c C |
125 | $(MAKE) subdirs |
126 | $(MAKE) $(EXEC) | |
127 | ||
b1b2de81 | 128 | opt-compil: .depend |
faf9a90c C |
129 | $(MAKE) subdirs.opt |
130 | $(MAKE) $(EXEC).opt | |
131 | ||
485bce71 | 132 | top: $(EXEC).top |
34e49164 | 133 | |
0708f913 | 134 | subdirs: |
b1b2de81 C |
135 | $(MAKE) -C commons OCAMLCFLAGS="$(OCAMLCFLAGS)" |
136 | $(MAKE) -C ocamlsexp OCAMLCFLAGS="$(OCAMLCFLAGS)" | |
137 | $(MAKE) -C commons sexp OCAMLCFLAGS="$(OCAMLCFLAGS)" | |
138 | +for D in $(MAKESUBDIRS); do $(MAKE) $$D || exit 1 ; done | |
0708f913 C |
139 | |
140 | subdirs.opt: | |
b1b2de81 C |
141 | $(MAKE) -C commons all.opt OCAMLCFLAGS="$(OCAMLCFLAGS)" |
142 | $(MAKE) -C ocamlsexp all.opt OCAMLCFLAGS="$(OCAMLCFLAGS)" | |
143 | $(MAKE) -C commons sexp.opt OCAMLCFLAGS="$(OCAMLCFLAGS)" | |
144 | +for D in $(MAKESUBDIRS); do $(MAKE) $$D.opt || exit 1 ; done | |
faf9a90c C |
145 | |
146 | $(MAKESUBDIRS): | |
147 | $(MAKE) -C $@ OCAMLCFLAGS="$(OCAMLCFLAGS)" all | |
148 | ||
149 | $(MAKESUBDIRS:%=%.opt): | |
150 | $(MAKE) -C $(@:%.opt=%) OCAMLCFLAGS="$(OCAMLCFLAGS)" all.opt | |
151 | ||
b1b2de81 | 152 | #dependencies: |
0708f913 C |
153 | # commons: |
154 | # globals: | |
155 | # menhirlib: | |
156 | # parsing_cocci: commons globals menhirlib | |
157 | # parsing_c:parsing_cocci | |
158 | # ctl:globals commons | |
159 | # engine: parsing_cocci parsing_c ctl | |
0708f913 C |
160 | # extra: parsing_cocci parsing_c ctl |
161 | # pycaml: | |
162 | # python:pycaml parsing_cocci parsing_c | |
faf9a90c | 163 | |
34e49164 | 164 | clean:: |
b1b2de81 | 165 | set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done |
34e49164 | 166 | |
0708f913 C |
167 | $(LIBS): $(MAKESUBDIRS) |
168 | $(LIBS:.cma=.cmxa): $(MAKESUBDIRS:%=%.opt) | |
faf9a90c C |
169 | |
170 | $(OBJS):$(LIBS) | |
171 | $(OPTOBJS):$(LIBS:.cma=.cmxa) | |
172 | ||
34e49164 C |
173 | $(EXEC): $(LIBS) $(OBJS) |
174 | $(OCAMLC) $(BYTECODE_STATIC) -o $@ $(SYSLIBS) $^ | |
175 | ||
faf9a90c | 176 | $(EXEC).opt: $(LIBS:.cma=.cmxa) $(OPTOBJS) |
34e49164 C |
177 | $(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $(OPTLIBFLAGS) $^ |
178 | ||
faf9a90c | 179 | $(EXEC).top: $(LIBS) $(OBJS) |
34e49164 C |
180 | $(OCAMLMKTOP) -custom -o $@ $(SYSLIBS) $^ |
181 | ||
182 | clean:: | |
183 | rm -f $(TARGET) $(TARGET).opt $(TARGET).top | |
184 | ||
34e49164 C |
185 | clean:: |
186 | rm -f dllpycaml_stubs.so | |
187 | ||
188 | ||
b1b2de81 C |
189 | .PHONY:: tools configure |
190 | ||
191 | configure: | |
192 | ./configure | |
34e49164 | 193 | |
708f4980 C |
194 | Makefile.config: |
195 | @echo "Makefile.config is missing. Have you run ./configure?" | |
196 | @exit 1 | |
197 | ||
34e49164 C |
198 | tools: |
199 | $(MAKE) -C tools | |
b1b2de81 | 200 | |
34e49164 C |
201 | clean:: |
202 | $(MAKE) -C tools clean | |
203 | ||
34e49164 C |
204 | static: |
205 | rm -f spatch.opt spatch | |
206 | $(MAKE) STATIC="-ccopt -static" spatch.opt | |
207 | cp spatch.opt spatch | |
208 | ||
209 | purebytecode: | |
210 | rm -f spatch.opt spatch | |
211 | $(MAKE) BYTECODE_STATIC="" spatch | |
212 | ||
213 | ||
b1b2de81 C |
214 | ############################################################################## |
215 | # Build documentation | |
216 | ############################################################################## | |
217 | .PHONY:: docs | |
218 | ||
219 | docs: | |
220 | make -C docs | |
221 | ||
222 | clean:: | |
223 | make -C docs clean | |
224 | ||
225 | distclean:: | |
226 | make -C docs distclean | |
227 | ||
228 | ############################################################################## | |
229 | # Pre-Install (customization of spatch frontend script) | |
230 | ############################################################################## | |
b1b2de81 | 231 | |
708f4980 | 232 | preinstall: scripts/spatch scripts/spatch.opt scripts/spatch.byte |
b1b2de81 C |
233 | |
234 | # user will use spatch to run spatch.opt (native) | |
708f4980 | 235 | scripts/spatch: |
b1b2de81 C |
236 | cp scripts/spatch.sh scripts/spatch.tmp2 |
237 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.tmp2 > scripts/spatch.tmp | |
238 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.tmp > scripts/spatch | |
239 | rm -f scripts/spatch.tmp2 scripts/spatch.tmp | |
240 | ||
241 | # user will use spatch to run spatch (bytecode) | |
708f4980 C |
242 | scripts/spatch.byte: |
243 | cp scripts/spatch.sh scripts/spatch.byte.tmp3 | |
244 | sed "s|\.opt||" scripts/spatch.byte.tmp3 > scripts/spatch.byte.tmp2 | |
245 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.byte.tmp2 \ | |
246 | > scripts/spatch.byte.tmp | |
247 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.byte.tmp \ | |
248 | > scripts/spatch.byte | |
249 | rm -f scripts/spatch.byte.tmp3 \ | |
250 | scripts/spatch.byte.tmp2 \ | |
251 | scripts/spatch.byte.tmp | |
b1b2de81 C |
252 | |
253 | # user will use spatch.opt to run spatch.opt (native) | |
708f4980 | 254 | scripts/spatch.opt: |
b1b2de81 | 255 | cp scripts/spatch.sh scripts/spatch.opt.tmp2 |
708f4980 C |
256 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.opt.tmp2 \ |
257 | > scripts/spatch.opt.tmp | |
258 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.opt.tmp \ | |
259 | > scripts/spatch.opt | |
b1b2de81 C |
260 | rm -f scripts/spatch.opt.tmp scripts/spatch.opt.tmp2 |
261 | ||
262 | clean:: | |
263 | rm -f scripts/spatch scripts/spatch.byte scripts/spatch.opt | |
264 | ||
34e49164 C |
265 | ############################################################################## |
266 | # Install | |
267 | ############################################################################## | |
268 | ||
269 | # don't remove DESTDIR, it can be set by package build system like ebuild | |
8ba84ae2 | 270 | # for staged installation. |
0708f913 | 271 | install-common: |
34e49164 C |
272 | mkdir -p $(DESTDIR)$(BINDIR) |
273 | mkdir -p $(DESTDIR)$(LIBDIR) | |
274 | mkdir -p $(DESTDIR)$(SHAREDIR) | |
faf9a90c | 275 | mkdir -p $(DESTDIR)$(MANDIR)/man1 |
8ba84ae2 C |
276 | $(INSTALL_DATA) standard.h $(DESTDIR)$(SHAREDIR) |
277 | $(INSTALL_DATA) standard.iso $(DESTDIR)$(SHAREDIR) | |
278 | $(INSTALL_DATA) docs/spatch.1 $(DESTDIR)$(MANDIR)/man1/ | |
279 | @if [ $(FEATURE_PYTHON) -eq 1 ]; then $(MAKE) install-python; fi | |
0708f913 | 280 | |
8ba84ae2 C |
281 | install-python: |
282 | mkdir -p $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
283 | $(INSTALL_DATA) python/coccilib/*.py \ | |
284 | $(DESTDIR)$(SHAREDIR)/python/coccilib | |
285 | $(INSTALL_DATA) python/coccilib/coccigui/*.py \ | |
286 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
b1b2de81 C |
287 | $(INSTALL_DATA) python/coccilib/coccigui/pygui.glade \ |
288 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
289 | $(INSTALL_DATA) python/coccilib/coccigui/pygui.gladep \ | |
290 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
8ba84ae2 C |
291 | $(INSTALL_LIB) dllpycaml_stubs.so $(DESTDIR)$(LIBDIR) |
292 | ||
708f4980 | 293 | install: install-common |
b1b2de81 C |
294 | @if test -x spatch -a ! -x spatch.opt ; then \ |
295 | $(MAKE) install-byte;fi | |
296 | @if test ! -x spatch -a -x spatch.opt ; then \ | |
297 | $(MAKE) install-def; $(MAKE) install-opt;fi | |
298 | @if test -x spatch -a -x spatch.opt ; then \ | |
299 | $(MAKE) install-byte; $(MAKE) install-opt;fi | |
300 | @if test ! -x spatch -a ! -x spatch.opt ; then \ | |
301 | echo "\n\n\t==> Run 'make', 'make opt', or both first. <==\n\n";fi | |
708f4980 C |
302 | @echo "" |
303 | @echo "\tYou can also install spatch by copying the program spatch" | |
304 | @echo "\t(available in this directory) anywhere you want and" | |
305 | @echo "\tgive it the right options to find its configuration files." | |
306 | @echo "" | |
b1b2de81 | 307 | |
0708f913 | 308 | # user will use spatch to run spatch.opt (native) |
708f4980 | 309 | install-def: |
8ba84ae2 | 310 | $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 311 | $(INSTALL_PROGRAM) scripts/spatch $(DESTDIR)$(BINDIR)/spatch |
0708f913 C |
312 | |
313 | # user will use spatch to run spatch (bytecode) | |
708f4980 | 314 | install-byte: |
8ba84ae2 | 315 | $(INSTALL_PROGRAM) spatch $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 316 | $(INSTALL_PROGRAM) scripts/spatch.byte $(DESTDIR)$(BINDIR)/spatch |
0708f913 C |
317 | |
318 | # user will use spatch.opt to run spatch.opt (native) | |
708f4980 | 319 | install-opt: |
8ba84ae2 | 320 | $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 321 | $(INSTALL_PROGRAM) scripts/spatch.opt $(DESTDIR)$(BINDIR)/spatch.opt |
34e49164 C |
322 | |
323 | uninstall: | |
324 | rm -f $(DESTDIR)$(BINDIR)/spatch | |
8ba84ae2 | 325 | rm -f $(DESTDIR)$(BINDIR)/spatch.opt |
34e49164 C |
326 | rm -f $(DESTDIR)$(LIBDIR)/dllpycaml_stubs.so |
327 | rm -f $(DESTDIR)$(SHAREDIR)/standard.h | |
328 | rm -f $(DESTDIR)$(SHAREDIR)/standard.iso | |
329 | rm -rf $(DESTDIR)$(SHAREDIR)/python/coccilib | |
faf9a90c | 330 | rm -f $(DESTDIR)$(MANDIR)/man1/spatch.1 |
34e49164 | 331 | |
34e49164 C |
332 | version: |
333 | @echo $(VERSION) | |
334 | ||
335 | ||
336 | ############################################################################## | |
337 | # Package rules | |
338 | ############################################################################## | |
339 | ||
340 | PACKAGE=coccinelle-$(VERSION) | |
341 | ||
342 | BINSRC=spatch env.sh env.csh standard.h standard.iso \ | |
b1b2de81 | 343 | *.txt \ |
708f4980 C |
344 | docs/manual/options.pdf docs/manual/cocci_syntax.pdf docs/spatch.1 \ |
345 | docs/manual/cocci-python.txt \ | |
faf9a90c | 346 | demos/foo.* demos/simple.* |
34e49164 C |
347 | # $(PYLIB) python/coccilib/ demos/printloc.* |
348 | BINSRC2=$(BINSRC:%=$(PACKAGE)/%) | |
349 | ||
350 | TMP=/tmp | |
351 | OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;') | |
352 | ||
353 | # Procedure to do first time: | |
354 | # cd ~/release | |
355 | # cvs checkout coccinelle | |
356 | # cd coccinelle | |
357 | # cvs update -d -P | |
358 | # touch **/* | |
359 | # make licensify | |
485bce71 | 360 | # remember to comment the -g -dtypes in this Makefile |
b1b2de81 C |
361 | # You can also remove a few things, for instance I removed in this |
362 | # Makefile things related to popl/ and popl09/ | |
34e49164 C |
363 | |
364 | # Procedure to do each time: | |
365 | # cvs update | |
113803cf | 366 | # make sure that ocaml is the distribution ocaml of /usr/bin, not ~pad/... |
708f4980 | 367 | # modify globals/config.ml.in |
faf9a90c | 368 | # cd globals/; cvs commit -m"new version" (do not commit from the root!) |
34e49164 C |
369 | # ./configure --without-python |
370 | # make package | |
371 | # make website | |
113803cf | 372 | # Check that run an ocaml in /usr/bin |
34e49164 | 373 | |
faf9a90c C |
374 | # To test you can try compile and run spatch from different instances |
375 | # like my ~/coccinelle, ~/release/coccinelle, and the /tmp/coccinelle-0.X | |
376 | # downloaded from the website. | |
34e49164 C |
377 | |
378 | # For 'make srctar' it must done from a clean | |
faf9a90c C |
379 | # repo such as ~/release/coccinelle. It must also be a repo where |
380 | # the scripts/licensify has been run at least once. | |
34e49164 C |
381 | # For the 'make bintar' I can do it from my original repo. |
382 | ||
383 | ||
faf9a90c C |
384 | package: |
385 | make srctar | |
b1b2de81 C |
386 | ./configure --without-python |
387 | make docs | |
faf9a90c C |
388 | make bintar |
389 | make staticbintar | |
34e49164 C |
390 | make bytecodetar |
391 | ||
faf9a90c | 392 | # I currently pre-generate the parser so the user does not have to |
b1b2de81 | 393 | # install menhir on his machine. We could also do a few cleanups. |
34e49164 | 394 | # You may have first to do a 'make licensify'. |
b1b2de81 C |
395 | # |
396 | # update: make docs generates pdf but also some ugly .log files, so | |
397 | # make clean is there to remove them while not removing the pdf | |
398 | # (only distclean remove the pdfs). | |
34e49164 | 399 | srctar: |
b1b2de81 C |
400 | make distclean |
401 | make docs | |
34e49164 C |
402 | make clean |
403 | cp -a . $(TMP)/$(PACKAGE) | |
404 | cd $(TMP)/$(PACKAGE); cd parsing_cocci/; make parser_cocci_menhir.ml | |
faf9a90c | 405 | cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(PACKAGE) |
34e49164 C |
406 | rm -rf $(TMP)/$(PACKAGE) |
407 | ||
408 | ||
409 | bintar: all | |
410 | rm -f $(TMP)/$(PACKAGE) | |
411 | ln -s `pwd` $(TMP)/$(PACKAGE) | |
faf9a90c | 412 | cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2) |
34e49164 C |
413 | rm -f $(TMP)/$(PACKAGE) |
414 | ||
415 | staticbintar: all.opt | |
416 | rm -f $(TMP)/$(PACKAGE) | |
417 | ln -s `pwd` $(TMP)/$(PACKAGE) | |
418 | make static | |
faf9a90c | 419 | cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2) |
34e49164 C |
420 | rm -f $(TMP)/$(PACKAGE) |
421 | ||
422 | # add ocaml version in name ? | |
423 | bytecodetar: all | |
424 | rm -f $(TMP)/$(PACKAGE) | |
425 | ln -s `pwd` $(TMP)/$(PACKAGE) | |
426 | make purebytecode | |
faf9a90c | 427 | cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2) |
34e49164 C |
428 | rm -f $(TMP)/$(PACKAGE) |
429 | ||
430 | clean:: | |
faf9a90c C |
431 | rm -f $(PACKAGE) |
432 | rm -f $(PACKAGE)-bin-x86.tgz | |
433 | rm -f $(PACKAGE)-bin-x86-static.tgz | |
34e49164 C |
434 | rm -f $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz |
435 | ||
436 | ||
437 | ||
b1b2de81 | 438 | TOLICENSIFY=ctl engine parsing_cocci python |
34e49164 | 439 | licensify: |
faf9a90c C |
440 | ocaml tools/licensify.ml |
441 | set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml ../tools/licensify.ml; cd ..; done | |
34e49164 C |
442 | |
443 | # When checking out the source from diku sometimes I have some "X in the future" | |
444 | # error messages. | |
445 | fixdates: | |
446 | echo do 'touch **/*.*' | |
447 | ||
448 | #fixCVS: | |
449 | # cvs update -d -P | |
450 | # echo do 'rm -rf **/CVS' | |
451 | ||
452 | ocamlversion: | |
453 | @echo $(OCAMLVERSION) | |
454 | ||
455 | ||
456 | ############################################################################## | |
457 | # Pad specific rules | |
458 | ############################################################################## | |
459 | ||
460 | #TOP=/home/pad/mobile/project-coccinelle | |
461 | WEBSITE=/home/pad/mobile/homepage/software/project-coccinelle | |
462 | ||
463 | website: | |
464 | cp $(TMP)/$(PACKAGE).tgz $(WEBSITE) | |
465 | cp $(TMP)/$(PACKAGE)-bin-x86.tgz $(WEBSITE) | |
466 | cp $(TMP)/$(PACKAGE)-bin-x86-static.tgz $(WEBSITE) | |
467 | cp $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz $(WEBSITE) | |
0708f913 | 468 | rm -f $(WEBSITE)/LATEST* $(WEBSITE)/coccinelle-latest.tgz |
b1b2de81 | 469 | cp changes.txt $(WEBSITE)/changes-$(VERSION).txt |
0708f913 | 470 | cd $(WEBSITE); touch LATEST_IS_$(VERSION); ln -s $(PACKAGE).tgz coccinelle-latest.tgz |
708f4980 | 471 | cp readme.txt $(WEBSITE) |
34e49164 C |
472 | |
473 | ||
474 | #TXT=$(wildcard *.txt) | |
475 | syncwiki: | |
476 | # unison ~/public_html/wiki/wiki-LFS/data/pages/ docs/wiki/ | |
faf9a90c | 477 | # set -e; for i in $(TXT); do unison $$i docs/wiki/$$i; done |
34e49164 C |
478 | |
479 | darcsweb: | |
480 | # @echo pull from ~/public_html/darcs/c-coccinelle and c-commons and lib-xxx | |
481 | ||
708f4980 | 482 | DARCSFORESTS=commons ocamlsexp \ |
485bce71 C |
483 | parsing_c parsing_cocci engine |
484 | ||
485 | update_darcs: | |
486 | darcs pull | |
faf9a90c | 487 | set -e; for i in $(DARCSFORESTS); do cd $$i; darcs pull; cd ..; done |
485bce71 C |
488 | |
489 | #darcs diff -u | |
490 | diff_darcs: | |
faf9a90c | 491 | set -e; for i in $(DARCSFORESTS); do cd $$i; darcs diff -u; cd ..; done |
485bce71 | 492 | |
b1b2de81 C |
493 | ############################################################################## |
494 | # Git Developer rules | |
495 | ############################################################################## | |
496 | gitupdate: | |
497 | git cvsimport -d :ext:topps:/var/cvs/cocci coccinelle | |
34e49164 C |
498 | |
499 | ############################################################################## | |
500 | # Developer rules | |
501 | ############################################################################## | |
502 | ||
503 | test: $(TARGET) | |
504 | ./$(TARGET) -testall | |
505 | ||
506 | testparsing: | |
507 | ./$(TARGET) -D standard.h -parse_c -dir tests/ | |
508 | ||
509 | ||
510 | ||
faf9a90c C |
511 | # -inline 0 to see all the functions in the profile. |
512 | # Can also use the profile framework in commons/ and run your program | |
34e49164 C |
513 | # with -profile. |
514 | forprofiling: | |
515 | $(MAKE) OPTFLAGS="-p -inline 0 " opt | |
516 | ||
517 | clean:: | |
faf9a90c | 518 | rm -f gmon.out |
34e49164 C |
519 | |
520 | tags: | |
521 | otags -no-mli-tags -r . | |
522 | ||
523 | dependencygraph: | |
b1b2de81 | 524 | find -name "*.ml" |grep -v "scripts" | xargs ocamldep -I commons -I globals -I ctl -I parsing_cocci -I parsing_c -I engine -I extra > /tmp/dependfull.depend |
485bce71 | 525 | ocamldot -lr /tmp/dependfull.depend > /tmp/dependfull.dot |
34e49164 | 526 | dot -Tps /tmp/dependfull.dot > /tmp/dependfull.ps |
485bce71 | 527 | ps2pdf /tmp/dependfull.ps /tmp/dependfull.pdf |
34e49164 C |
528 | |
529 | ############################################################################## | |
530 | # Misc rules | |
531 | ############################################################################## | |
532 | ||
faf9a90c | 533 | # each member of the project can have its own test.ml. this file is |
34e49164 | 534 | # not under CVS. |
faf9a90c | 535 | test.ml: |
34e49164 C |
536 | echo "let foo_ctl () = failwith \"there is no foo_ctl formula\"" \ |
537 | > test.ml | |
538 | ||
539 | beforedepend:: test.ml | |
540 | ||
541 | ||
542 | #INC=$(dir $(shell which ocaml)) | |
543 | #INCX=$(INC:/=) | |
544 | #INCY=$(dir $(INCX)) | |
545 | #INCZ=$(INCY:/=)/lib/ocaml | |
546 | # | |
547 | #prim.o: prim.c | |
548 | # gcc -c -o prim.o -I $(INCZ) prim.c | |
549 | ||
550 | ||
551 | ############################################################################## | |
552 | # Generic ocaml rules | |
553 | ############################################################################## | |
554 | ||
555 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
556 | ||
557 | .ml.cmo: | |
558 | $(OCAMLC) -c $< | |
559 | .mli.cmi: | |
560 | $(OCAMLC) -c $< | |
561 | .ml.cmx: | |
562 | $(OCAMLOPT) -c $< | |
563 | ||
faf9a90c | 564 | .ml.mldepend: |
34e49164 C |
565 | $(OCAMLC) -i $< |
566 | ||
567 | clean:: | |
568 | rm -f *.cm[iox] *.o *.annot | |
34e49164 C |
569 | rm -f *~ .*~ *.exe #*# |
570 | ||
b1b2de81 C |
571 | distclean:: clean |
572 | set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done | |
573 | rm -f .depend | |
574 | rm -f Makefile.config | |
575 | rm -f python/coccilib/output.py | |
576 | rm -f python/pycocci.ml | |
577 | rm -f python/pycocci_aux.ml | |
578 | rm -f globals/config.ml | |
579 | rm -f TAGS | |
580 | rm -f tests/SCORE_actual.sexp | |
581 | rm -f tests/SCORE_best_of_both.sexp | |
582 | find -name ".#*1.*" | xargs rm -f | |
583 | ||
34e49164 C |
584 | beforedepend:: |
585 | ||
586 | depend:: beforedepend | |
587 | $(OCAMLDEP) *.mli *.ml > .depend | |
b1b2de81 C |
588 | set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done |
589 | ||
590 | .depend:: | |
591 | @if [ ! -f .depend ] ; then $(MAKE) depend ; fi | |
34e49164 C |
592 | |
593 | -include .depend |