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 \
48 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
50 bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
51 $(OCAMLFIND) ocamlc -a -o $@ $^
53 bitmatch_persistent.cma: bitmatch_persistent.cmo
54 $(OCAMLFIND) ocamlc -a -o $@ $^
56 bitmatch_persistent.cmo: bitmatch_persistent.ml
57 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
58 -I +camlp4 -pp camlp4of -c $<
60 bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
61 $(OCAMLFIND) ocamlopt -a -o $@ $^
63 bitmatch_persistent.cmxa: bitmatch_persistent.cmx
64 $(OCAMLFIND) ocamlopt -a -o $@ $^
66 bitmatch_persistent.cmx: bitmatch_persistent.ml
67 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) \
68 -I +camlp4 -pp camlp4of -c $<
70 bitmatch_persistent.cmi: bitmatch_persistent.mli
71 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
72 -I +camlp4 -pp camlp4of -c $<
74 pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma bitmatch_persistent.cma
75 $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
76 -pp camlp4of -c $< -o $@
78 bitmatch-objinfo: bitmatch_objinfo.cmo bitmatch.cma bitmatch_persistent.cma
79 $(OCAMLFIND) ocamlc -I +camlp4 unix.cma camlp4lib.cma \
80 bitmatch.cma bitmatch_persistent.cma \
85 PP = -pp "camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
87 test: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma tests/test.bmpp
88 @for f in $(TESTS); do \
90 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
91 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
92 if [ $$? -ne 0 ]; then exit 1; fi; \
95 if [ $$? -ne 0 ]; then exit 1; fi; \
97 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
99 tests/test.bmpp: create_test_pattern
103 create_test_pattern: create_test_pattern.cmo
104 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
105 unix.cma -I +camlp4 camlp4lib.cma \
106 -I . bitmatch.cma bitmatch_persistent.cma $< -o $@
108 create_test_pattern.cmo: create_test_pattern.ml
109 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
110 unix.cma -I +camlp4 \
113 examples: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma
114 @for f in $(EXAMPLES); do \
116 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
117 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
118 if [ $$? -ne 0 ]; then exit 1; fi; \
120 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
122 print-tests: pa_bitmatch.cmo bitmatch_persistent.cma
123 @for f in $(TESTS); do \
125 cmd="camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
126 -printer pr_o.cmo $$f.ml"; \
131 print-examples: pa_bitmatch.cmo
132 @for f in $(EXAMPLES); do \
133 echo Example: $$f.ml; \
134 camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
135 -printer pr_o.cmo $$f.ml; \
136 if [ $$? -ne 0 ]; then exit 1; fi; \
142 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
143 rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
144 rm -f examples/*~ examples/*.cmi examples/*.cmo $(EXAMPLES)
145 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
148 rm -rf autom4te.cache
149 rm -f config.log config.status
150 rm -f config.h Makefile META bitmatch_config.ml
151 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
159 $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html -I +camlp4 \
160 bitmatch.mli bitmatch_persistent.mli
166 ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
168 bitmatch_persistent.cmi \
170 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
175 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
177 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
179 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
182 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
184 .depend: bitmatch.ml bitmatch.mli \
185 bitmatch_persistent.ml bitmatch_persistent.mli \
186 bitmatch_objinfo.ml \
187 create_test_pattern.ml
189 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) \
190 bitmatch.ml bitmatch.mli \
191 bitmatch_objinfo.ml >> $@
192 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) -pp camlp4of \
193 bitmatch_persistent.ml bitmatch_persistent.mli \
194 create_test_pattern.ml >> $@
196 ifeq ($(wildcard .depend),.depend)
203 $(MAKE) check-manifest
204 rm -rf $(PACKAGE)-$(VERSION)
205 mkdir $(PACKAGE)-$(VERSION)
206 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
207 $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
208 $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
209 svn log -v > $(PACKAGE)-$(VERSION)/CHANGES
210 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
211 rm -rf $(PACKAGE)-$(VERSION)
212 ls -l $(PACKAGE)-$(VERSION).tar.gz
215 svn -R list | grep -v '/$$' | sort > .check-manifest
216 sort MANIFEST > .orig-manifest; \
217 diff -u .orig-manifest .check-manifest; rv=$$?; \
218 rm -f .orig-manifest .check-manifest; \
221 .PHONY: depend dist check-manifest dpkg doc \
222 print-examples print-tests examples test
224 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll