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