Implement the nativeendian version of some functions.
[ocaml-bitstring.git] / Makefile.in
1 # Bitmatch syntax extension.
2 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
3 #
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.
8 #
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.
13 #
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
17 #
18 # $Id: Makefile.in,v 1.5 2008-05-07 14:41:03 rjones Exp $
19
20 PACKAGE         = @PACKAGE_NAME@
21 VERSION         = @PACKAGE_VERSION@
22
23 OCAMLFIND       = @OCAMLFIND@
24 OCAMLMKLIB      = @OCAMLMKLIB@
25 OCAMLDOC        = @OCAMLDOC@
26 INSTALL         = @INSTALL@
27
28 OCAMLCFLAGS     = -g
29 OCAMLCPACKAGES  =
30 OCAMLOPTFLAGS   =
31 OCAMLOPTPACKAGES =
32
33 OCAMLDOCFLAGS   = -html -sort
34
35 EXAMPLES        = $(wildcard examples/*.ml)
36
37 TESTS           = $(patsubst %.ml,%,$(wildcard tests/*.ml))
38
39 all:    bitmatch.cma bitmatch.cmxa pa_bitmatch.cmo
40
41 bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
42         $(OCAMLFIND) ocamlc -a -o $@ $^
43
44 bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
45         $(OCAMLFIND) ocamlopt -a -o $@ $^
46
47 pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma
48         $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
49           -pp camlp4of.opt -c $< -o $@
50
51 # Tests and examples.
52
53 PP      = -pp "camlp4o bitmatch.cma pa_bitmatch.cmo"
54
55 test: pa_bitmatch.cmo bitmatch.cma
56         @for f in $(TESTS); do \
57           echo Test: $$f; \
58           $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
59             -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
60           if [ $$? -ne 0 ]; then exit 1; fi; \
61           $$f; \
62           if [ $$? -ne 0 ]; then exit 1; fi; \
63         done
64
65 print-tests: pa_bitmatch.cmo
66         @for f in $(TESTS); do \
67           echo Test: $$f.ml; \
68           cmd="camlp4o bitmatch.cma pa_bitmatch.cmo -printer pr_o.cmo $$f.ml"; \
69           echo $$cmd; \
70           $$cmd; \
71         done
72
73 print-examples: pa_bitmatch.cmo
74         @for f in $(EXAMPLES); do \
75           echo Example: $$f; \
76           camlp4o bitmatch.cma pa_bitmatch.cmo -printer pr_o.cmo $$f; \
77           if [ $$? -ne 0 ]; then exit 1; fi; \
78         done
79
80 # Clean.
81
82 clean:
83         rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o
84         rm -f tests/*~ tests/*.cmi tests/*.cmo $(TESTS)
85         rm -f examples/*~
86
87 # Documentation.
88
89 ifneq ($(OCAMLDOC),)
90 doc:
91         rm -rf html
92         mkdir html
93         $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html bitmatch.mli bitmatch.ml
94 endif
95
96 # Install.
97
98 install:
99         ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
100                 bitmatch.cmi \
101                 pa_bitmatch.cmo
102
103 # Standard rules.
104
105 .mli.cmi:
106         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
107 .ml.cmo:
108         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
109 .ml.cmx:
110         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
111
112 depend: .depend
113
114 .depend: bitmatch.ml bitmatch.mli
115         rm -f .depend
116         $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
117
118 ifeq ($(wildcard .depend),.depend)
119 include .depend
120 endif
121
122 # Distribution.
123
124 dist:
125         $(MAKE) check-manifest
126         rm -rf $(PACKAGE)-$(VERSION)
127         mkdir $(PACKAGE)-$(VERSION)
128         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
129         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
130         $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
131         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
132         rm -rf $(PACKAGE)-$(VERSION)
133         ls -l $(PACKAGE)-$(VERSION).tar.gz
134
135 check-manifest:
136         svn -R list | grep -v '/$$' | sort > .check-manifest
137         sort MANIFEST > .orig-manifest; \
138         diff -u .orig-manifest .check-manifest; rv=$$?; \
139         rm -f .orig-manifest .check-manifest; \
140         exit $$rv
141
142 .PHONY: depend dist check-manifest dpkg doc print-examples print-tests test
143
144 .SUFFIXES:      .cmo .cmi .cmx .ml .mli .mll