28e785813cf1659ef5dbba52b4f2e638a3b65f96
[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 MKDIR_P         = @MKDIR_P@
24 datarootdir     = @datarootdir@
25 mandir          = @mandir@
26
27 OCAMLDOCFLAGS   = -html -sort -package bitstring,extlib -I lib
28 OCAMLDOC        = @OCAMLDOC@
29 OCAMLDOCFILES   = lib/virt_mem_utils.ml lib/virt_mem_mmap.mli lib/virt_mem.mli
30
31 HAVE_PERLDOC    = @HAVE_PERLDOC@
32
33 TOOLS           = uname dmesg ps
34 export TOOLS
35
36 SUBDIRS_NOT_PO  = lib $(TOOLS) mem
37 SUBDIRS         = $(SUBDIRS_NOT_PO) po
38
39 ifeq ($(HAVE_PERLDOC),perldoc)
40 MANPAGES        = virt-mem.1 $(TOOLS:%=virt-%.1)
41 TEXTMANPAGES    = virt-mem.txt
42 endif
43
44 TARGETS         = $(MANPAGES) $(TEXTMANPAGES)
45
46 all: $(TARGETS)
47         for d in $(SUBDIRS); do \
48           $(MAKE) -C $$d $@; \
49           if [ $$? -ne 0 ]; then exit 1; fi; \
50         done
51
52 install: install-man
53         for d in $(SUBDIRS); do \
54           $(MAKE) -C $$d $@; \
55           if [ $$? -ne 0 ]; then exit 1; fi; \
56         done
57
58 depend:
59         for d in $(SUBDIRS_NOT_PO); do \
60           $(MAKE) -C $$d $@; \
61           if [ $$? -ne 0 ]; then exit 1; fi; \
62         done
63
64 clean:
65         for d in . $(SUBDIRS); do \
66           (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a \
67             *.so *.opt *~ *.dll *.exe *.annot core); \
68         done
69         rm -f uname/virt-uname
70         rm -f dmesg/virt-dmesg
71         rm -f ps/virt-ps
72         rm -f mem/virt-mem
73
74 distclean: clean
75         rm -f config.h config.log config.status configure
76         rm -rf autom4te.cache
77         rm -f Makefile
78         rm -f */Makefile
79
80 # Developer documentation (in html/ subdirectory).
81
82 ifneq ($(OCAMLDOC),)
83 ifneq ($(OCAMLDOCFILES),)
84 doc:
85         rm -rf html
86         mkdir html
87         -ocamlfind ocamldoc $(OCAMLDOCFLAGS) -d html $(OCAMLDOCFILES)
88 endif
89 endif
90
91 # Manual page.
92
93 ifeq ($(HAVE_PERLDOC),perldoc)
94 virt-mem.1: virt-mem.pod
95         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
96           $< > $@
97
98 virt-mem.txt: virt-mem.pod
99         pod2text $< > $@
100
101 virt-%.1:
102         echo '.so man1/virt-mem.1' > $@
103
104 install-man:
105         $(MKDIR_P) $(DESTDIR)$(mandir)/man1
106         $(INSTALL) -m 0644 $(MANPAGES) $(DESTDIR)$(mandir)/man1/
107
108 else
109
110 install-man:
111
112 endif
113
114 # Distribution.
115
116 dist:
117         $(MAKE) check-manifest
118         rm -rf $(PACKAGE)-$(VERSION)
119         mkdir $(PACKAGE)-$(VERSION)
120         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
121         hg log --style changelog > $(PACKAGE)-$(VERSION)/ChangeLog
122         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
123         $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
124         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
125         rm -rf $(PACKAGE)-$(VERSION)
126         ls -l $(PACKAGE)-$(VERSION).tar.gz
127
128 check-manifest:
129         hg manifest | sort > .check-manifest; \
130         sort MANIFEST > .orig-manifest; \
131         diff -u .orig-manifest .check-manifest; rv=$$?; \
132         rm -f .orig-manifest .check-manifest; \
133         exit $$rv
134
135 .PHONY: all opt depend install clean distclean configure dist check-manifest \
136         release release_stage_2 release_stage_3 force