1 # Bitmatch syntax extension.
2 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 PACKAGE = @PACKAGE_NAME@
21 VERSION = @PACKAGE_VERSION@
23 OCAMLFIND = @OCAMLFIND@
24 OCAMLMKLIB = @OCAMLMKLIB@
33 OCAMLDOCFLAGS = -html -sort
35 EXAMPLES = $(patsubst %.ml,%,$(wildcard examples/*.ml))
37 TESTS = $(patsubst %.ml,%,$(wildcard tests/*.ml))
39 all: bitmatch.cma bitmatch.cmxa pa_bitmatch.cmo
41 bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
42 $(OCAMLFIND) ocamlc -a -o $@ $^
44 bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
45 $(OCAMLFIND) ocamlopt -a -o $@ $^
47 pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma
48 $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
49 -pp camlp4of.opt -c $< -o $@
53 PP = -pp "camlp4o bitmatch.cma pa_bitmatch.cmo"
55 test: pa_bitmatch.cmo bitmatch.cma
56 @for f in $(TESTS); do \
58 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
59 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
60 if [ $$? -ne 0 ]; then exit 1; fi; \
63 if [ $$? -ne 0 ]; then exit 1; fi; \
66 examples: pa_bitmatch.cmo bitmatch.cma
67 @for f in $(EXAMPLES); do \
69 $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(PP) \
70 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
71 if [ $$? -ne 0 ]; then exit 1; fi; \
74 print-tests: pa_bitmatch.cmo
75 @for f in $(TESTS); do \
77 cmd="camlp4o bitmatch.cma pa_bitmatch.cmo -printer pr_o.cmo $$f.ml"; \
82 print-examples: pa_bitmatch.cmo
83 @for f in $(EXAMPLES); do \
84 echo Example: $$f.ml; \
85 camlp4o bitmatch.cma pa_bitmatch.cmo -printer pr_o.cmo $$f.ml; \
86 if [ $$? -ne 0 ]; then exit 1; fi; \
92 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
93 rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
94 rm -f examples/*~ examples/*.cmi examples/*.cmo $(EXAMPLES)
98 rm -f config.log config.status
99 rm -f config.h Makefile META bitmatch_config.ml
107 $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html bitmatch.mli bitmatch.ml
113 ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
120 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
122 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
124 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
128 .depend: bitmatch.ml bitmatch.mli
130 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
132 ifeq ($(wildcard .depend),.depend)
139 $(MAKE) check-manifest
140 rm -rf $(PACKAGE)-$(VERSION)
141 mkdir $(PACKAGE)-$(VERSION)
142 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
143 $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
144 $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
145 svn log -v > $(PACKAGE)-$(VERSION)/CHANGES
146 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
147 rm -rf $(PACKAGE)-$(VERSION)
148 ls -l $(PACKAGE)-$(VERSION).tar.gz
151 svn -R list | grep -v '/$$' | sort > .check-manifest
152 sort MANIFEST > .orig-manifest; \
153 diff -u .orig-manifest .check-manifest; rv=$$?; \
154 rm -f .orig-manifest .check-manifest; \
157 .PHONY: depend dist check-manifest dpkg doc \
158 print-examples print-tests examples test
160 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll