Version 0.6.
[ocaml-augeas.git] / Makefile.in
1 # Augeas OCaml bindings.
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.2 2008/05/06 10:48:20 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 CC              = @CC@
29 CFLAGS          = @CFLAGS@ @AUGEAS_CFLAGS@ @LIBXML2_CFLAGS@ \
30                   -DCAML_NAME_SPACE \
31                   -fPIC -I$(shell ocamlc -where) -Wall -Werror
32 LDFLAGS         = @LDFLAGS@
33 LIBS            = @AUGEAS_LIBS@ @LIBXML2_LIBS@ @LIBS@
34
35 OCAMLCFLAGS     = -g
36 OCAMLCPACKAGES  =
37 OCAMLOPTFLAGS   =
38 OCAMLOPTPACKAGES =
39
40 OCAMLDOCFLAGS   = -html -sort
41
42 export LIBRARY_PATH = .
43
44 all:    mlaugeas.cma mlaugeas.cmxa test_augeas
45
46 mlaugeas.cma: augeas-c.o augeas.cmo
47         ocamlmklib $(LDFLAGS) $(LIBS) -o mlaugeas $^
48
49 mlaugeas.cmxa: augeas-c.o augeas.cmx
50         ocamlmklib $(LDFLAGS) $(LIBS) -o mlaugeas $^
51
52 # Test program.
53
54 test_augeas: test_augeas.cmo test_root mlaugeas.cma
55         $(OCAMLFIND) ocamlc -o $@ mlaugeas.cma $<
56
57 test_root:
58         rm -rf $@
59         mkdir $@
60         mkdir $@/etc
61         cp /etc/hosts $@/etc/
62
63 check:
64         LD_LIBRARY_PATH=. ./test_augeas
65
66 # Clean.
67
68 clean:
69         rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o *.so *.opt
70         rm -f test_augeas
71         rm -rf test_root
72
73 # Documentation.
74
75 ifneq ($(OCAMLDOC),)
76 doc:
77         rm -rf html
78         mkdir html
79         $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html augeas.mli augeas.ml
80 endif
81
82 # Install.
83
84 install:
85         ocamlfind install augeas \
86           META *.mli *.cmx *.cma *.cmxa *.a augeas.cmi *.so
87
88 # Standard rules.
89
90 .mli.cmi:
91         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
92 .ml.cmo:
93         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
94 .ml.cmx:
95         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
96
97 depend: .depend
98
99 .depend: augeas.mli augeas.ml
100         rm -f .depend
101         $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
102
103 ifeq ($(wildcard .depend),.depend)
104 include .depend
105 endif
106
107 # Distribution.
108
109 dist:
110         $(MAKE) check-manifest
111         rm -rf $(PACKAGE)-$(VERSION)
112         mkdir $(PACKAGE)-$(VERSION)
113         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
114         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
115         $(INSTALL) -m 0644 aclocal.m4 $(PACKAGE)-$(VERSION)/
116         $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
117         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
118         rm -rf $(PACKAGE)-$(VERSION)
119         ls -l $(PACKAGE)-$(VERSION).tar.gz
120
121 check-manifest:
122         git ls-files | sort > .check-manifest; \
123         sort MANIFEST > .orig-manifest; \
124         diff -u .orig-manifest .check-manifest; rv=$$?; \
125         rm -f .orig-manifest .check-manifest; \
126         exit $$rv
127
128 .PHONY: depend dist check-manifest dpkg doc
129
130 .SUFFIXES:      .cmo .cmi .cmx .ml .mli .mll