1 # Bitstring 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: bitstring.cma bitstring_persistent.cma \
50 bitstring.cmxa bitstring_persistent.cmxa \
53 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
55 bitstring.cma: bitstring_types.cmo bitstring_config.cmo bitstring.cmo \
57 $(OCAMLFIND) ocamlc -a -o $@ $^
59 bitstring_persistent.cma: bitstring_persistent.cmo
60 $(OCAMLFIND) ocamlc -a -o $@ $^
62 bitstring_persistent.cmo: bitstring_persistent.ml
63 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
64 -I +camlp4 -pp camlp4of -c $<
66 bitstring.cmxa: bitstring_types.cmx bitstring_config.cmx bitstring.cmx \
68 $(OCAMLFIND) ocamlopt -a -o $@ $^
70 bitstring_persistent.cmxa: bitstring_persistent.cmx
71 $(OCAMLFIND) ocamlopt -a -o $@ $^
73 bitstring_persistent.cmx: bitstring_persistent.ml
74 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) \
75 -I +camlp4 -pp camlp4of -c $<
77 bitstring_persistent.cmi: bitstring_persistent.mli
78 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
79 -I +camlp4 -pp camlp4of -c $<
81 pa_bitstring.cmo: pa_bitstring.ml bitstring.cma bitstring_persistent.cma
82 $(OCAMLFIND) ocamlc bitstring.cma -I +camlp4 camlp4lib.cma \
83 -pp camlp4of -c $< -o $@
85 bitstring-objinfo: bitstring_objinfo.cmo bitstring.cma bitstring_persistent.cma
86 $(OCAMLFIND) ocamlc -I +camlp4 unix.cma camlp4lib.cma \
87 bitstring.cma bitstring_persistent.cma \
92 PP = -pp "camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
94 test: pa_bitstring.cmo bitstring.cma bitstring_persistent.cma tests/test.bmpp
95 @for f in $(TESTS); do \
97 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
98 -package unix -linkpkg -I . bitstring.cma $$f.ml -o $$f; \
99 if [ $$? -ne 0 ]; then exit 1; fi; \
102 if [ $$? -ne 0 ]; then exit 1; fi; \
104 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
106 tests/test.bmpp: create_test_pattern
110 create_test_pattern: create_test_pattern.cmo
111 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
112 unix.cma -I +camlp4 camlp4lib.cma \
113 -I . bitstring.cma bitstring_persistent.cma $< -o $@
115 create_test_pattern.cmo: create_test_pattern.ml
116 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
117 unix.cma -I +camlp4 \
120 examples: pa_bitstring.cmo bitstring.cma bitstring_persistent.cma
121 @for f in $(EXAMPLES); do \
123 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
124 -package unix -linkpkg -I . bitstring.cma $$f.ml -o $$f; \
125 if [ $$? -ne 0 ]; then exit 1; fi; \
127 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
129 print-tests: pa_bitstring.cmo bitstring_persistent.cma
130 @for f in $(TESTS); do \
132 cmd="camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo \
133 -printer pr_o.cmo $$f.ml"; \
138 print-examples: pa_bitstring.cmo
139 @for f in $(EXAMPLES); do \
140 echo Example: $$f.ml; \
141 camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo \
142 -printer pr_o.cmo $$f.ml; \
143 if [ $$? -ne 0 ]; then exit 1; fi; \
149 rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
150 rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
151 rm -f examples/*~ examples/*.cmi examples/*.cmo $(EXAMPLES)
152 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
155 rm -rf autom4te.cache
156 rm -f config.log config.status
157 rm -f config.h Makefile META bitstring_config.ml
158 rm -f bitstring-objinfo
159 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
167 $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html -I +camlp4 \
168 bitstring.mli bitstring_persistent.mli bitmatch.ml
174 ocamlfind install bitstring META *.mli *.cmx *.cma *.cmxa *.a \
176 bitstring_persistent.cmi \
178 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
183 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
185 $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
187 $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
190 @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
192 .depend: bitstring.ml bitstring.mli \
193 bitstring_persistent.ml bitstring_persistent.mli \
194 bitstring_objinfo.ml \
195 create_test_pattern.ml
197 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) \
198 bitstring.ml bitstring.mli \
199 bitstring_objinfo.ml >> $@
200 $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) -pp camlp4of \
201 bitstring_persistent.ml bitstring_persistent.mli \
202 create_test_pattern.ml >> $@
204 ifeq ($(wildcard .depend),.depend)
211 $(MAKE) check-manifest
212 rm -rf $(PACKAGE)-$(VERSION)
213 mkdir $(PACKAGE)-$(VERSION)
214 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
215 $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
216 $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
217 svn log -v > $(PACKAGE)-$(VERSION)/CHANGES
218 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
219 rm -rf $(PACKAGE)-$(VERSION)
220 ls -l $(PACKAGE)-$(VERSION).tar.gz
223 svn -R list | grep -v '/$$' | sort > .check-manifest
224 sort MANIFEST > .orig-manifest; \
225 diff -u .orig-manifest .check-manifest; rv=$$?; \
226 rm -f .orig-manifest .check-manifest; \
229 .PHONY: depend dist check-manifest dpkg doc \
230 print-examples print-tests examples test
232 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll