0441accf17f56e3636c8714df2280b8d69389c53
[libguestfs.git] / inspector / Makefile.am
1 # libguestfs virt-inspector
2 # Copyright (C) 2009-2010 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 include $(top_srcdir)/subdir-rules.mk
19
20 EXAMPLE_XML = \
21         example-debian.xml \
22         example-fedora.xml \
23         example-ubuntu.xml \
24         example-windows.xml
25
26 EXTRA_DIST = \
27         run-inspector-locally \
28         virt-inspector.pod
29
30 docdir = @docdir@
31 dist_doc_DATA = \
32         virt-inspector.rng \
33         $(EXAMPLE_XML)
34
35 if HAVE_LIBXML2
36
37 bin_PROGRAMS = virt-inspector
38
39 SHARED_SOURCE_FILES = \
40         ../fish/inspect.c \
41         ../fish/keys.c \
42         ../fish/options.h \
43         ../fish/options.c \
44         ../fish/virt.c
45
46 virt_inspector_SOURCES = \
47         $(SHARED_SOURCE_FILES) \
48         virt-inspector.c
49
50 virt_inspector_CFLAGS = \
51         -I$(top_srcdir)/src -I$(top_builddir)/src \
52         -I$(top_srcdir)/fish \
53         -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
54         -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
55         $(LIBXML2_CFLAGS) \
56         $(WARN_CFLAGS) $(WERROR_CFLAGS)
57
58 virt_inspector_LDADD = \
59         $(top_builddir)/src/libguestfs.la \
60         $(LIBXML2_LIBS) \
61         ../gnulib/lib/libgnu.la
62
63 # Manual pages and HTML files for the website.
64 man_MANS = virt-inspector.1
65
66 noinst_DATA = \
67         $(top_builddir)/html/virt-inspector.1.html
68
69 virt-inspector.1: virt-inspector.pod
70         $(POD2MAN) \
71           --section 1 \
72           -c "Virtualization Support" \
73           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
74           $< > $@-t && mv $@-t $@
75
76 $(top_builddir)/html/virt-inspector.1.html: virt-inspector
77         mkdir -p $(top_builddir)/html
78         cd $(top_builddir) && pod2html \
79           --css 'pod.css' \
80           --title 'virt-inspector, display OS version, kernel, drivers, mount points, applications, etc. in a virtual machine' \
81           --htmldir html \
82           --outfile html/virt-inspector.1.html \
83           inspector/$<
84
85 if HAVE_XMLLINT
86
87 TESTS = $(EXAMPLE_XML)
88 TESTS_ENVIRONMENT = $(XMLLINT) --noout --relaxng virt-inspector.rng
89
90 endif
91
92 endif
93
94 # These rules require virt-inspector so there is no good time that we
95 # can run them.  Instead you can run them by hand.
96
97 example-debian.xml:
98         ./run-inspector-locally ../images/debian.img > $@
99 example-fedora.xml:
100         ./run-inspector-locally ../images/fedora.img > $@
101 example-ubuntu.xml:
102         ./run-inspector-locally ../images/ubuntu.img > $@
103 example-windows.xml:
104         ./run-inspector-locally ../images/windows.img | fgrep -v '<uuid>' > $@
105
106 # Build a partly-static library (for the binary distribution).
107
108 virt-inspector.static$(EXEEXT): $(virt_inspector_OBJECTS) $(virt_inspector_DEPENDENCIES)
109         $(top_srcdir)/relink-static.sh \
110         $(virt_inspector_LINK) $(virt_inspector_OBJECTS) -static $(virt_inspector_LDADD) $(virt_inspector_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -lpcre -lhivex -lmagic -lz -lm