Fix check-manifest and add a MANIFEST file
[virt-mem.git] / Makefile.in
1 # virt-mem
2 # @configure_input@
3 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18
19 PACKAGE         = @PACKAGE_NAME@
20 VERSION         = @PACKAGE_VERSION@
21
22 INSTALL         = @INSTALL@
23
24 SYNTAX          = -pp "camlp4o -I`ocamlc -where`/bitmatch bitmatch.cma pa_bitmatch.cmo"
25
26 #OCAMLCPACKAGES = -package unix,bigarray,extlib,bitmatch
27 OCAMLCPACKAGES  = -package unix,bigarray,extlib -I +bitmatch
28
29 ifneq ($(pkg_gettext),no)
30 OCAMLCPACKAGES  += -package gettext-stub
31 endif
32
33 OCAMLCFLAGS     = @OCAMLCFLAGS@ $(SYNTAX)
34 OCAMLCLIBS      = -linkpkg bitmatch.cma
35
36 OCAMLOPTFLAGS   = @OCAMLOPTFLAGS@ $(SYNTAX)
37 OCAMLOPTPACKAGES = $(OCAMLCPACKAGES)
38 OCAMLOPTLIBS    = -linkpkg bitmatch.cmxa
39
40 OCAMLDOCFLAGS   = -html -stars -sort $(OCAMLCPACKAGES) $(SYNTAX)
41
42 TARGETS         = virt-mem virt-mem.opt
43
44 OBJS            = virt_mem_gettext.cmo \
45                   virt_mem_utils.cmo \
46                   virt_mem_mmap.cmo \
47                   virt_mem.cmo
48 XOBJS           = virt_mem_gettext.cmx \
49                   virt_mem_utils.cmx \
50                   virt_mem_mmap.cmx \
51                   virt_mem.cmx
52
53 all:    $(TARGETS)
54
55 virt-mem: $(OBJS)
56         ocamlfind ocamlc \
57           $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(OCAMLCLIBS) $^ -o $@
58
59 virt-mem.opt: $(XOBJS)
60         ocamlfind ocamlopt \
61           $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) $(OCAMLOPTLIBS) $^ -o $@
62
63 # Common rules for building OCaml objects.
64
65 .mli.cmi:
66         ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
67 .ml.cmo:
68         ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $<
69 .ml.cmx:
70         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $<
71
72 clean:
73         rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a \
74             *.so *.opt *~ *.dll *.exe *.annot core
75
76 # Distribution.
77
78 dist:
79         $(MAKE) check-manifest
80         rm -rf $(PACKAGE)-$(VERSION)
81         mkdir $(PACKAGE)-$(VERSION)
82         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
83         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
84         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
85         rm -rf $(PACKAGE)-$(VERSION)
86         ls -l $(PACKAGE)-$(VERSION).tar.gz
87
88 check-manifest:
89         hg manifest | sort > .check-manifest; \
90         sort MANIFEST > .orig-manifest; \
91         diff -u .orig-manifest .check-manifest; rv=$$?; \
92         rm -f .orig-manifest .check-manifest; \
93         exit $$rv
94
95 # Developer documentation (in html/ subdirectory).
96
97 doc:
98         rm -rf html
99         mkdir html
100         -ocamlfind ocamldoc $(OCAMLDOCFLAGS) -d html *.{ml,mli}
101
102 # Dependencies.
103
104 depend: .depend
105
106 .depend: $(wildcard *.mli) $(wildcard *.ml)
107         rm -f .depend
108         ocamldep $(SYNTAX) $^ > $@
109
110 ifeq ($(wildcard .depend),.depend)
111 include .depend
112 endif
113
114 .PHONY: all opt depend install clean distclean configure dist check-manifest \
115         release release_stage_2 release_stage_3 force
116
117 .SUFFIXES:      .cmo .cmi .cmx .ml .mli