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