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_persistent.cma \
45 bitmatch.cmxa bitmatch_persistent.cmxa \
47 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
49 bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
50 $(OCAMLFIND) ocamlc -a -o $@ $^
52 bitmatch_persistent.cma: bitmatch_persistent.cmo
53 $(OCAMLFIND) ocamlc -a -o $@ $^
55 bitmatch_persistent.cmo: bitmatch_persistent.ml
56 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
57 -I +camlp4 -pp camlp4of -c $<
59 bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
60 $(OCAMLFIND) ocamlopt -a -o $@ $^
62 bitmatch_persistent.cmxa: bitmatch_persistent.cmx
63 $(OCAMLFIND) ocamlopt -a -o $@ $^
65 bitmatch_persistent.cmx: bitmatch_persistent.ml
66 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) \
67 -I +camlp4 -pp camlp4of -c $<
69 bitmatch_persistent.cmi: bitmatch_persistent.mli
70 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
71 -I +camlp4 -pp camlp4of -c $<
73 pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma bitmatch_persistent.cma
74 $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
75 -pp camlp4of -c $< -o $@
79 PP = -pp "camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
81 test: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma
82 @for f in $(TESTS); do \
84 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
85 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
86 if [ $$? -ne 0 ]; then exit 1; fi; \
89 if [ $$? -ne 0 ]; then exit 1; fi; \
91 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
93 examples: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma
94 @for f in $(EXAMPLES); do \
96 $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(PP) \
97 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
98 if [ $$? -ne 0 ]; then exit 1; fi; \
100 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
102 print-tests: pa_bitmatch.cmo bitmatch_persistent.cma
103 @for f in $(TESTS); do \
105 cmd="camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
106 -printer pr_o.cmo $$f.ml"; \
111 print-examples: pa_bitmatch.cmo
112 @for f in $(EXAMPLES); do \
113 echo Example: $$f.ml; \
114 camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
115 -printer pr_o.cmo $$f.ml; \
116 if [ $$? -ne 0 ]; then exit 1; fi; \
122 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
123 rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
124 rm -f examples/*~ examples/*.cmi examples/*.cmo $(EXAMPLES)
125 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
128 rm -rf autom4te.cache
129 rm -f config.log config.status
130 rm -f config.h Makefile META bitmatch_config.ml
131 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
139 $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html bitmatch.mli bitmatch.ml \
140 bitmatch_persistent.mli bitmatch_persistent.ml
146 ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
148 bitmatch_persistent.cmi \
150 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
155 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
157 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
159 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
162 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
164 .depend: bitmatch.ml bitmatch.mli bitmatch_persistent.ml bitmatch_persistent.mli
166 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) bitmatch.ml bitmatch.mli >> $@
167 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) -pp camlp4of \
168 bitmatch_persistent.ml bitmatch_persistent.mli >> $@
170 ifeq ($(wildcard .depend),.depend)
177 $(MAKE) check-manifest
178 rm -rf $(PACKAGE)-$(VERSION)
179 mkdir $(PACKAGE)-$(VERSION)
180 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
181 $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
182 $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
183 svn log -v > $(PACKAGE)-$(VERSION)/CHANGES
184 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
185 rm -rf $(PACKAGE)-$(VERSION)
186 ls -l $(PACKAGE)-$(VERSION).tar.gz
189 svn -R list | grep -v '/$$' | sort > .check-manifest
190 sort MANIFEST > .orig-manifest; \
191 diff -u .orig-manifest .check-manifest; rv=$$?; \
192 rm -f .orig-manifest .check-manifest; \
195 .PHONY: depend dist check-manifest dpkg doc \
196 print-examples print-tests examples test
198 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll