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