+# Benchmarks.
+
+ifneq ($(TIME),no)
+
+benchmarks: pa_bitstring.cmo bitstring.cma bitstring_persistent.cma
+ @for f in $(BENCHMARKS); do \
+ $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(PP) \
+ -package unix -linkpkg -I . bitstring.cmxa $$f.ml -o $$f.opt; \
+ if [ $$? -ne 0 ]; then exit 1; fi; \
+ $(TIME) -f "$$f: %e seconds" $$f.opt; \
+ if [ $$? -ne 0 ]; then exit 1; fi; \
+ done
+ifneq ($(GPROF),no)
+ @for f in $(BENCHMARKS); do \
+ $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(PP) -p \
+ -package unix -linkpkg -I . bitstring.cmxa $$f.ml -o $$f.opt.p; \
+ if [ $$? -ne 0 ]; then exit 1; fi; \
+ rm -f gmon.out; \
+ $$f.opt.p; \
+ if [ $$? -ne 0 ]; then exit 1; fi; \
+ gprof $$f.opt.p > $$f.profile; \
+ if [ $$? -ne 0 ]; then exit 1; fi; \
+ echo "Wrote profile of $$f"; \
+ echo " to $$f.profile"; \
+ rm -f gmon.out; \
+ done
+endif
+
+endif
+
+# Clean.
+
+clean:
+ rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.cmp *.a *.o *.so
+ rm -f tests/*~ tests/*.cmi tests/*.cmo tests/*.cmx tests/*.opt
+ rm -f tests/*.o
+ rm -f examples/*~ examples/*.cmi examples/*.cmo examples/*.cmx
+ rm -f examples/*.o $(EXAMPLES)
+ rm -f benchmarks/*~ benchmarks/*.cmi benchmarks/*.cmo
+ rm -f benchmarks/*.cmx benchmarks/*.o
+ rm -f benchmarks/*.opt benchmarks/*.opt.p benchmarks/*.profile
+ rm -f create_test_pattern bitstring-objinfo
+ @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+
+distclean: clean
+ rm -rf autom4te.cache
+ rm -f config.log config.status
+ rm -f config.h Makefile META bitstring_config.ml
+ rm -f bitstring-objinfo
+ @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+
+# Documentation.
+
+ifneq ($(OCAMLDOC),)
+doc:
+ rm -rf html
+ mkdir html
+ $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html -I +camlp4 \
+ bitstring.mli bitstring_persistent.mli bitmatch.ml
+endif
+
+# Install.
+
+install:
+ ocamlfind install bitstring META *.mli *.cmx *.cma *.cmxa *.a *.so \
+ bitstring.cmi \
+ bitstring_persistent.cmi \
+ pa_bitstring.cmo
+ @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+
+uninstall:
+ ocamlfind remove bitstring
+
+# Standard rules.
+