1 # $Id: Makefile,v 1.2 2008-04-01 08:56:43 rjones Exp $
4 OCAMLMKLIB = ocamlmklib
12 EXAMPLES := $(wildcard examples/*.ml)
14 TESTS := $(patsubst %.ml,%,$(wildcard tests/*.ml))
16 all: pa_bitmatch.cmo bitmatch.cma bitmatch.cmxa
18 pa_bitmatch.cmo: pa_bitmatch.ml
19 ocamlfind ocamlc -I +camlp4 camlp4lib.cma -pp camlp4of.opt -c $< -o $@
21 bitmatch.cma: bitmatch.cmo
22 $(OCAMLFIND) ocamlc -a -o $@ $^
24 bitmatch.cmxa: bitmatch.cmx
25 $(OCAMLFIND) ocamlopt -a -o $@ $^
27 test: pa_bitmatch.cmo bitmatch.cma
28 @for f in $(TESTS); do \
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; \
34 if [ $$? -ne 0 ]; then exit 1; fi; \
37 print-tests: pa_bitmatch.cmo
38 @for f in $(TESTS); do \
40 camlp4o pa_bitmatch.cmo -printer pr_o.cmo $$f.ml; \
43 print-examples: pa_bitmatch.cmo
44 @for f in $(EXAMPLES); do \
46 camlp4o pa_bitmatch.cmo -printer pr_o.cmo $$f; \
50 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
52 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
54 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
58 .depend: bitmatch.ml bitmatch.mli
60 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
62 ifeq ($(wildcard .depend),.depend)
66 .PHONY: depend dist check-manifest dpkg doc print-examples print-tests test
68 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll