Bitmatch syntax extension, working on bits and bitstrings.
[ocaml-bitstring.git] / Makefile
1 # $Id: Makefile,v 1.1 2008-03-31 22:52:17 rjones Exp $
2
3 OCAMLFIND = ocamlfind
4 OCAMLMKLIB = ocamlmklib
5
6
7 OCAMLCFLAGS = -g
8 OCAMLCPACKAGES =
9 OCAMLOPTFLAGS =
10 OCAMLOPTPACKAGES =
11
12 EXAMPLES := $(wildcard examples/*.ml)
13
14 TESTS   := $(patsubst %.ml,%,$(wildcard tests/*.ml))
15
16 all:    pa_bitmatch.cmo bitmatch.cma bitmatch.cmxa
17
18 pa_bitmatch.cmo: pa_bitmatch.ml
19         ocamlfind ocamlc -I +camlp4 camlp4lib.cma -pp camlp4of.opt -c $< -o $@
20
21 bitmatch.cma: bitmatch.cmo
22         $(OCAMLFIND) ocamlc -a -o $@ $^
23
24 bitmatch.cmxa: bitmatch.cmx
25         $(OCAMLFIND) ocamlopt -a -o $@ $^
26
27 test:
28         @for f in $(TESTS); do \
29           echo Test: $$f; \
30           $(OCAMLFIND) ocamlc -pp "camlp4o pa_bitmatch.cmo" \
31             -I . bitmatch.cma $$f.ml -o $$f; \
32           $$f; \
33         done
34
35 print-tests: pa_bitmatch.cmo
36         @for f in $(TESTS); do \
37           echo Test: $$f.ml; \
38           camlp4o pa_bitmatch.cmo -printer pr_o.cmo $$f.ml; \
39         done
40
41 print-examples: pa_bitmatch.cmo
42         @for f in $(EXAMPLES); do \
43           echo Example: $$f; \
44           camlp4o pa_bitmatch.cmo -printer pr_o.cmo $$f; \
45         done
46
47 .mli.cmi:
48         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
49 .ml.cmo:
50         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
51 .ml.cmx:
52         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
53
54 depend: .depend
55
56 .depend: bitmatch.ml bitmatch.mli
57         rm -f .depend
58         $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
59
60 ifeq ($(wildcard .depend),.depend)
61 include .depend
62 endif
63
64 .PHONY: depend dist check-manifest dpkg doc print-examples print-tests test
65
66 .SUFFIXES:      .cmo .cmi .cmx .ml .mli .mll