Rename interpretor to interpreter.
[Faustine.git] / interpreter / lib / src / libsndfile-ocaml / Makefile
1 LIBSNDFILEDIR = $(realpath ../../libsndfile/lib)
2
3 CC = gcc
4 CFLAGS = -g -W -Wall -Werror -Wno-missing-field-initializers
5
6 OCAMLC = ocamlc
7 OCAMLOPT = ocamlopt
8 OCAMLDEP = ocamldep
9 OCAMLDOC = ocamldoc
10
11 SNDFILE_CFLAGS = $(shell pkg-config --cflags sndfile)
12 SNDFILE_LIBS = $(shell pkg-config --libs sndfile)
13
14 OCAML_BINDIR = $(shell which ocaml)
15 OCAML_LIBDIR = $(subst bin,lib,$(OCAML_BINDIR))
16 OCAML_CFLAGS = -I $(OCAML_LIBDIR)
17
18 LIBSNDFILE = -ccopt -L$(LIBSNDFILEDIR) -cclib -lsndfile -cclib -lm
19
20 all: sndfile.cma sndfile.cmxa
21
22 sndfile.cma: sndfile.ml sndfile.cmi sndfile_stub.o
23 $(OCAMLC) -c sndfile.ml
24 $(OCAMLC) -a -o $@ -custom sndfile_stub.o sndfile.cmo $(LIBSNDFILE)
25
26
27 sndfile.cmxa: sndfile.ml sndfile.cmi sndfile_stub.o
28 $(OCAMLOPT) -c sndfile.ml
29 $(OCAMLOPT) -a -o $@ sndfile.cmx sndfile_stub.o $(LIBSNDFILE)
30
31 Sndfile.html: sndfile.mli sndfile.cmi
32 $(OCAMLDOC) -stars -html -colorize-code $<
33
34
35 sndfile_stub.o: sndfile_stub.c
36 $(CC) $(CFLAGS) $(SNDFILE_CFLAGS) $(OCAML_CFLAGS) -c $<
37
38 sndfile_stub.e: sndfile_stub.c
39 $(CC) $(CFLAGS) -E $(SNDFILE_CFLAGS) $(OCAML_CFLAGS) -c $< > $@
40
41 %.cmi: %.mli
42 $(OCAMLC) -c $<
43
44
45 depend: sndfile.ml sndfile.mli
46 $(OCAMLDEP) *.mli *.ml > .depend
47
48 .depend: sndfile.ml sndfile.mli
49 $(OCAMLDEP) *.mli *.ml > .depend
50
51 include .depend
52
53 ########################################################################
54
55 test_sndfile: sndfile.cma test_sndfile.ml
56 $(OCAMLC) -o $@ sndfile.cma test_sndfile.ml
57
58 test_sndfile.opt: sndfile.cmxa test_sndfile.ml
59 $(OCAMLOPT) -o $@ sndfile.cmxa test_sndfile.ml
60
61 check : test_sndfile test_sndfile.opt
62 ./test_sndfile
63 ./test_sndfile.opt
64
65 ########################################################################
66
67 clean:
68 rm -f *~ .*~ *.o *.cm[aiox] *.cmxa *.a *.so test_sndfile test_sndfile.opt
69 @ find . -type f -perm +u=x -exec rm -f {} \;
70 @ rm -f *.html *.css