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