Added constructors.
[ocaml-bitstring.git] / Makefile
1 # $Id: Makefile,v 1.3 2008-04-01 17:05:37 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: pa_bitmatch.cmo bitmatch.cma
28         @for f in $(TESTS); do \
29           echo Test: $$f; \
30           $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp "camlp4o pa_bitmatch.cmo" \
31             -I . bitmatch.cma $$f.ml -o $$f; \
32           if [ $$? -ne 0 ]; then exit 1; fi; \
33           $$f; \
34           if [ $$? -ne 0 ]; then exit 1; fi; \
35         done
36
37 print-tests: pa_bitmatch.cmo
38         @for f in $(TESTS); do \
39           echo Test: $$f.ml; \
40           cmd="camlp4o pa_bitmatch.cmo -printer pr_o.cmo $$f.ml"; \
41           echo $$cmd; \
42           $$cmd; \
43         done
44
45 print-examples: pa_bitmatch.cmo
46         @for f in $(EXAMPLES); do \
47           echo Example: $$f; \
48           camlp4o pa_bitmatch.cmo -printer pr_o.cmo $$f; \
49         done
50
51 .mli.cmi:
52         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
53 .ml.cmo:
54         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
55 .ml.cmx:
56         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
57
58 depend: .depend
59
60 .depend: bitmatch.ml bitmatch.mli
61         rm -f .depend
62         $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
63
64 ifeq ($(wildcard .depend),.depend)
65 include .depend
66 endif
67
68 .PHONY: depend dist check-manifest dpkg doc print-examples print-tests test
69
70 .SUFFIXES:      .cmo .cmi .cmx .ml .mli .mll