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
37 ifneq ($(pkg_extlib),no)
42 EXAMPLES = $(patsubst %.ml,%,$(wildcard examples/*.ml))
44 TESTS = $(patsubst %.ml,%,$(wildcard tests/*.ml))
46 all: bitmatch.cma bitmatch_persistent.cma \
47 bitmatch.cmxa bitmatch_persistent.cmxa \
50 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
52 bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
53 $(OCAMLFIND) ocamlc -a -o $@ $^
55 bitmatch_persistent.cma: bitmatch_persistent.cmo
56 $(OCAMLFIND) ocamlc -a -o $@ $^
58 bitmatch_persistent.cmo: bitmatch_persistent.ml
59 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
60 -I +camlp4 -pp camlp4of -c $<
62 bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
63 $(OCAMLFIND) ocamlopt -a -o $@ $^
65 bitmatch_persistent.cmxa: bitmatch_persistent.cmx
66 $(OCAMLFIND) ocamlopt -a -o $@ $^
68 bitmatch_persistent.cmx: bitmatch_persistent.ml
69 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) \
70 -I +camlp4 -pp camlp4of -c $<
72 bitmatch_persistent.cmi: bitmatch_persistent.mli
73 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
74 -I +camlp4 -pp camlp4of -c $<
76 pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma bitmatch_persistent.cma
77 $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
78 -pp camlp4of -c $< -o $@
80 bitmatch-objinfo: bitmatch_objinfo.cmo bitmatch.cma bitmatch_persistent.cma
81 $(OCAMLFIND) ocamlc -I +camlp4 unix.cma camlp4lib.cma \
82 bitmatch.cma bitmatch_persistent.cma \
87 PP = -pp "camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
89 test: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma tests/test.bmpp
90 @for f in $(TESTS); do \
92 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
93 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
94 if [ $$? -ne 0 ]; then exit 1; fi; \
97 if [ $$? -ne 0 ]; then exit 1; fi; \
99 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
101 tests/test.bmpp: create_test_pattern
105 create_test_pattern: create_test_pattern.cmo
106 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
107 unix.cma -I +camlp4 camlp4lib.cma \
108 -I . bitmatch.cma bitmatch_persistent.cma $< -o $@
110 create_test_pattern.cmo: create_test_pattern.ml
111 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
112 unix.cma -I +camlp4 \
115 examples: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma
116 @for f in $(EXAMPLES); do \
118 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
119 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
120 if [ $$? -ne 0 ]; then exit 1; fi; \
122 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
124 print-tests: pa_bitmatch.cmo bitmatch_persistent.cma
125 @for f in $(TESTS); do \
127 cmd="camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
128 -printer pr_o.cmo $$f.ml"; \
133 print-examples: pa_bitmatch.cmo
134 @for f in $(EXAMPLES); do \
135 echo Example: $$f.ml; \
136 camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
137 -printer pr_o.cmo $$f.ml; \
138 if [ $$? -ne 0 ]; then exit 1; fi; \
144 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
145 rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
146 rm -f examples/*~ examples/*.cmi examples/*.cmo $(EXAMPLES)
147 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
150 rm -rf autom4te.cache
151 rm -f config.log config.status
152 rm -f config.h Makefile META bitmatch_config.ml
153 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
161 $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html -I +camlp4 \
162 bitmatch.mli bitmatch_persistent.mli
168 ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
170 bitmatch_persistent.cmi \
172 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
177 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
179 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
181 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
184 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
186 .depend: bitmatch.ml bitmatch.mli \
187 bitmatch_persistent.ml bitmatch_persistent.mli \
188 bitmatch_objinfo.ml \
189 create_test_pattern.ml
191 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) \
192 bitmatch.ml bitmatch.mli \
193 bitmatch_objinfo.ml >> $@
194 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) -pp camlp4of \
195 bitmatch_persistent.ml bitmatch_persistent.mli \
196 create_test_pattern.ml >> $@
198 ifeq ($(wildcard .depend),.depend)
205 $(MAKE) check-manifest
206 rm -rf $(PACKAGE)-$(VERSION)
207 mkdir $(PACKAGE)-$(VERSION)
208 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
209 $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
210 $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
211 svn log -v > $(PACKAGE)-$(VERSION)/CHANGES
212 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
213 rm -rf $(PACKAGE)-$(VERSION)
214 ls -l $(PACKAGE)-$(VERSION).tar.gz
217 svn -R list | grep -v '/$$' | sort > .check-manifest
218 sort MANIFEST > .orig-manifest; \
219 diff -u .orig-manifest .check-manifest; rv=$$?; \
220 rm -f .orig-manifest .check-manifest; \
223 .PHONY: depend dist check-manifest dpkg doc \
224 print-examples print-tests examples test
226 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll