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