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@
29 pkg_extlib = @pkg_extlib@
36 OCAMLDOCFLAGS = -html -sort
40 ifneq ($(pkg_extlib),no)
45 EXAMPLES = $(patsubst %.ml,%,$(wildcard examples/*.ml))
47 TESTS = $(patsubst %.ml,%,$(wildcard tests/*.ml))
49 all: bitmatch.cma bitmatch_persistent.cma \
50 bitmatch.cmxa bitmatch_persistent.cmxa \
53 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
55 bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
56 $(OCAMLFIND) ocamlc -a -o $@ $^
58 bitmatch_persistent.cma: bitmatch_persistent.cmo
59 $(OCAMLFIND) ocamlc -a -o $@ $^
61 bitmatch_persistent.cmo: bitmatch_persistent.ml
62 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
63 -I +camlp4 -pp camlp4of -c $<
65 bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
66 $(OCAMLFIND) ocamlopt -a -o $@ $^
68 bitmatch_persistent.cmxa: bitmatch_persistent.cmx
69 $(OCAMLFIND) ocamlopt -a -o $@ $^
71 bitmatch_persistent.cmx: bitmatch_persistent.ml
72 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) \
73 -I +camlp4 -pp camlp4of -c $<
75 bitmatch_persistent.cmi: bitmatch_persistent.mli
76 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
77 -I +camlp4 -pp camlp4of -c $<
79 pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma bitmatch_persistent.cma
80 $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
81 -pp camlp4of -c $< -o $@
83 bitmatch-objinfo: bitmatch_objinfo.cmo bitmatch.cma bitmatch_persistent.cma
84 $(OCAMLFIND) ocamlc -I +camlp4 unix.cma camlp4lib.cma \
85 bitmatch.cma bitmatch_persistent.cma \
90 PP = -pp "camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
92 test: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma tests/test.bmpp
93 @for f in $(TESTS); do \
95 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
96 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
97 if [ $$? -ne 0 ]; then exit 1; fi; \
100 if [ $$? -ne 0 ]; then exit 1; fi; \
102 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
104 tests/test.bmpp: create_test_pattern
108 create_test_pattern: create_test_pattern.cmo
109 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
110 unix.cma -I +camlp4 camlp4lib.cma \
111 -I . bitmatch.cma bitmatch_persistent.cma $< -o $@
113 create_test_pattern.cmo: create_test_pattern.ml
114 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
115 unix.cma -I +camlp4 \
118 examples: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma
119 @for f in $(EXAMPLES); do \
121 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
122 -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
123 if [ $$? -ne 0 ]; then exit 1; fi; \
125 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
127 print-tests: pa_bitmatch.cmo bitmatch_persistent.cma
128 @for f in $(TESTS); do \
130 cmd="camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
131 -printer pr_o.cmo $$f.ml"; \
136 print-examples: pa_bitmatch.cmo
137 @for f in $(EXAMPLES); do \
138 echo Example: $$f.ml; \
139 camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
140 -printer pr_o.cmo $$f.ml; \
141 if [ $$? -ne 0 ]; then exit 1; fi; \
147 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
148 rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
149 rm -f examples/*~ examples/*.cmi examples/*.cmo $(EXAMPLES)
150 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
153 rm -rf autom4te.cache
154 rm -f config.log config.status
155 rm -f config.h Makefile META bitmatch_config.ml
156 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
164 $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html -I +camlp4 \
165 bitmatch.mli bitmatch_persistent.mli
171 ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
173 bitmatch_persistent.cmi \
175 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
180 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
182 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
184 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
187 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
189 .depend: bitmatch.ml bitmatch.mli \
190 bitmatch_persistent.ml bitmatch_persistent.mli \
191 bitmatch_objinfo.ml \
192 create_test_pattern.ml
194 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) \
195 bitmatch.ml bitmatch.mli \
196 bitmatch_objinfo.ml >> $@
197 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) -pp camlp4of \
198 bitmatch_persistent.ml bitmatch_persistent.mli \
199 create_test_pattern.ml >> $@
201 ifeq ($(wildcard .depend),.depend)
208 $(MAKE) check-manifest
209 rm -rf $(PACKAGE)-$(VERSION)
210 mkdir $(PACKAGE)-$(VERSION)
211 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
212 $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
213 $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
214 svn log -v > $(PACKAGE)-$(VERSION)/CHANGES
215 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
216 rm -rf $(PACKAGE)-$(VERSION)
217 ls -l $(PACKAGE)-$(VERSION).tar.gz
220 svn -R list | grep -v '/$$' | sort > .check-manifest
221 sort MANIFEST > .orig-manifest; \
222 diff -u .orig-manifest .check-manifest; rv=$$?; \
223 rm -f .orig-manifest .check-manifest; \
226 .PHONY: depend dist check-manifest dpkg doc \
227 print-examples print-tests examples test
229 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll