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