Extracted kernel structures for device addressing in ifconfig.
[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 \
28                   -package bitstring.syntax,extlib,libvirt,gettext,xml-light \
29                   -I lib \
30                   -syntax bitstring.syntax
31 OCAMLDOC        = @OCAMLDOC@
32 OCAMLDOCFILES   = $(wildcard lib/*.ml) $(wildcard lib/*.mli)
33
34 HAVE_PERLDOC    = @HAVE_PERLDOC@
35
36 TOOLS           = uname dmesg ps ifconfig
37 export TOOLS
38
39 SUBDIRS_NOT_PO  = lib $(TOOLS) mem extract/fedora-koji extract/codegen
40 SUBDIRS         = $(SUBDIRS_NOT_PO) po
41
42 ifeq ($(HAVE_PERLDOC),perldoc)
43 MANPAGES        = virt-mem.1 $(TOOLS:%=virt-%.1)
44 TEXTMANPAGES    = virt-mem.txt
45 endif
46
47 TARGETS         = $(MANPAGES) $(TEXTMANPAGES)
48
49 all: $(TARGETS)
50         for d in $(SUBDIRS_NOT_PO); do \
51           $(MAKE) -C $$d $@; \
52           if [ $$? -ne 0 ]; then exit 1; fi; \
53         done
54
55 install: install-man
56         for d in $(SUBDIRS); do \
57           $(MAKE) -C $$d $@; \
58           if [ $$? -ne 0 ]; then exit 1; fi; \
59         done
60
61 depend:
62         for d in $(SUBDIRS_NOT_PO); do \
63           $(MAKE) -C $$d $@; \
64           if [ $$? -ne 0 ]; then exit 1; fi; \
65         done
66
67 clean:
68         for d in . $(SUBDIRS); do \
69           (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a \
70             *.so *.opt *~ *.dll *.exe *.annot core); \
71         done
72         rm -f uname/virt-uname
73         rm -f dmesg/virt-dmesg
74         rm -f ps/virt-ps
75         rm -f mem/virt-mem
76
77 distclean: clean
78         rm -f config.h config.log config.status configure
79         rm -rf autom4te.cache
80         rm -f Makefile
81         rm -f */Makefile
82
83 # Rebuild the PO files.
84
85 update-po:
86         $(MAKE) -C po all
87
88 # Download distribution kernels (warning: takes AGES).
89
90 update-kerneldb:
91         cd kernels && \
92           ../extract/fedora-koji/fedora-koji-download-kernels.opt
93
94 # Rebuild the generated kernel struct parsers from the kerneldb.
95
96 update-kernel-structs:
97         extract/codegen/kerneldb-to-parser.opt kernels lib
98
99 # Developer documentation (in html/ subdirectory).
100
101 ifneq ($(OCAMLDOC),)
102 ifneq ($(OCAMLDOCFILES),)
103 doc:
104         rm -rf html
105         mkdir html
106         -ocamlfind ocamldoc $(OCAMLDOCFLAGS) -d html $(OCAMLDOCFILES)
107 endif
108 endif
109
110 # Manual page.
111
112 ifeq ($(HAVE_PERLDOC),perldoc)
113 virt-mem.1: virt-mem.pod
114         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
115           $< > $@
116
117 virt-mem.txt: virt-mem.pod
118         pod2text $< > $@
119
120 virt-%.1:
121         echo '.so man1/virt-mem.1' > $@
122
123 install-man:
124         $(MKDIR_P) $(DESTDIR)$(mandir)/man1
125         $(INSTALL) -m 0644 $(MANPAGES) $(DESTDIR)$(mandir)/man1/
126
127 else
128
129 install-man:
130
131 endif
132
133 # Distribution.
134
135 dist:
136         $(MAKE) check-manifest
137         rm -rf $(PACKAGE)-$(VERSION)
138         mkdir $(PACKAGE)-$(VERSION)
139         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
140         hg log --style changelog > $(PACKAGE)-$(VERSION)/ChangeLog
141         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
142         $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
143         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
144         rm -rf $(PACKAGE)-$(VERSION)
145         mkdir $(PACKAGE)-$(VERSION)
146         mkdir $(PACKAGE)-$(VERSION)/kernels
147         $(INSTALL) -m 0644 kernels/*.data* kernels/*.info \
148           $(PACKAGE)-$(VERSION)/kernels/
149         tar zcf $(PACKAGE)-kerneldb-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
150         rm -rf $(PACKAGE)-$(VERSION)
151         ls -l $(PACKAGE)-$(VERSION).tar.gz
152         ls -l $(PACKAGE)-kerneldb-$(VERSION).tar.gz
153
154 check-manifest:
155         hg manifest | \
156           grep -Ev 'kernels/.*\.(data|info).*' | \
157           sort > .check-manifest; \
158         sort MANIFEST > .orig-manifest; \
159         diff -u .orig-manifest .check-manifest; rv=$$?; \
160         rm -f .orig-manifest .check-manifest; \
161         exit $$rv
162
163 .PHONY: all opt depend install clean distclean configure dist check-manifest \
164         release release_stage_2 release_stage_3 force