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
40 EXAMPLES = $(patsubst %.ml,%,$(wildcard examples/*.ml))
42 TESTS = $(patsubst %.ml,%,$(wildcard tests/*.ml))
44 all: bitmatch.cma bitmatch.cmxa pa_bitmatch.cmo
45 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
47 bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
48 $(OCAMLFIND) ocamlc -a -o $@ $^
50 bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
51 $(OCAMLFIND) ocamlopt -a -o $@ $^
53 pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma
54 $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
55 -pp camlp4of.opt -c $< -o $@
59 PP = -pp "camlp4o bitmatch.cma pa_bitmatch.cmo"
61 test: pa_bitmatch.cmo bitmatch.cma
62 @for f in $(TESTS); do \
64 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
65 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
66 if [ $$? -ne 0 ]; then exit 1; fi; \
69 if [ $$? -ne 0 ]; then exit 1; fi; \
71 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
73 examples: pa_bitmatch.cmo bitmatch.cma
74 @for f in $(EXAMPLES); do \
76 $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(PP) \
77 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
78 if [ $$? -ne 0 ]; then exit 1; fi; \
80 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
82 print-tests: pa_bitmatch.cmo
83 @for f in $(TESTS); do \
85 cmd="camlp4o bitmatch.cma pa_bitmatch.cmo -printer pr_o.cmo $$f.ml"; \
90 print-examples: pa_bitmatch.cmo
91 @for f in $(EXAMPLES); do \
92 echo Example: $$f.ml; \
93 camlp4o bitmatch.cma pa_bitmatch.cmo -printer pr_o.cmo $$f.ml; \
94 if [ $$? -ne 0 ]; then exit 1; fi; \
100 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
101 rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
102 rm -f examples/*~ examples/*.cmi examples/*.cmo $(EXAMPLES)
103 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
106 rm -rf autom4te.cache
107 rm -f config.log config.status
108 rm -f config.h Makefile META bitmatch_config.ml
109 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
117 $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html bitmatch.mli bitmatch.ml
123 ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
126 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
131 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
133 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
135 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
138 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
140 .depend: bitmatch.ml bitmatch.mli
142 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
144 ifeq ($(wildcard .depend),.depend)
151 $(MAKE) check-manifest
152 rm -rf $(PACKAGE)-$(VERSION)
153 mkdir $(PACKAGE)-$(VERSION)
154 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
155 $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
156 $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
157 svn log -v > $(PACKAGE)-$(VERSION)/CHANGES
158 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
159 rm -rf $(PACKAGE)-$(VERSION)
160 ls -l $(PACKAGE)-$(VERSION).tar.gz
163 svn -R list | grep -v '/$$' | sort > .check-manifest
164 sort MANIFEST > .orig-manifest; \
165 diff -u .orig-manifest .check-manifest; rv=$$?; \
166 rm -f .orig-manifest .check-manifest; \
169 .PHONY: depend dist check-manifest dpkg doc \
170 print-examples print-tests examples test
172 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll