New tool: virt-filesystems
[libguestfs.git] / cat / Makefile.am
1 # libguestfs virt-cat, virt-filesystems and virt-ls.
2 # Copyright (C) 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 EXTRA_DIST = \
21         run-cat-locally \
22         test-virt-cat.sh \
23         virt-cat.pod \
24         run-filesystems-locally \
25         test-virt-filesystems.sh \
26         virt-filesystems.pod \
27         run-ls-locally \
28         test-virt-ls.sh \
29         virt-ls.pod
30
31 bin_PROGRAMS = virt-cat virt-filesystems virt-ls
32
33 SHARED_SOURCE_FILES = \
34         ../fish/inspect.c \
35         ../fish/keys.c \
36         ../fish/options.h \
37         ../fish/options.c \
38         ../fish/virt.c
39
40 virt_cat_SOURCES = \
41         $(SHARED_SOURCE_FILES) \
42         virt-cat.c
43
44 virt_cat_CFLAGS = \
45         -I$(top_srcdir)/src -I$(top_builddir)/src \
46         -I$(top_srcdir)/fish \
47         -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
48         -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
49         $(WARN_CFLAGS) $(WERROR_CFLAGS)
50
51 virt_cat_LDADD = \
52         $(top_builddir)/src/libguestfs.la \
53         ../gnulib/lib/libgnu.la
54
55 virt_filesystems_SOURCES = \
56         $(SHARED_SOURCE_FILES) \
57         virt-filesystems.c
58
59 virt_filesystems_CFLAGS = \
60         -I$(top_srcdir)/src -I$(top_builddir)/src \
61         -I$(top_srcdir)/fish \
62         -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
63         -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
64         $(WARN_CFLAGS) $(WERROR_CFLAGS)
65
66 virt_filesystems_LDADD = \
67         $(top_builddir)/src/libguestfs.la \
68         ../gnulib/lib/libgnu.la
69
70 virt_ls_SOURCES = \
71         $(SHARED_SOURCE_FILES) \
72         virt-ls.c
73
74 virt_ls_CFLAGS = \
75         -I$(top_srcdir)/src -I$(top_builddir)/src \
76         -I$(top_srcdir)/fish \
77         -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
78         -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
79         $(WARN_CFLAGS) $(WERROR_CFLAGS)
80
81 virt_ls_LDADD = \
82         $(top_builddir)/src/libguestfs.la \
83         ../gnulib/lib/libgnu.la
84
85 # Manual pages and HTML files for the website.
86 man_MANS = virt-cat.1 virt-filesystems.1 virt-ls.1
87
88 noinst_DATA = \
89         $(top_builddir)/html/virt-cat.1.html \
90         $(top_builddir)/html/virt-filesystems.1.html \
91         $(top_builddir)/html/virt-ls.1.html
92
93 virt-cat.1: virt-cat.pod
94         $(POD2MAN) \
95           --section 1 \
96           -c "Virtualization Support" \
97           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
98           $< > $@-t && mv $@-t $@
99
100 $(top_builddir)/html/virt-cat.1.html: virt-cat.pod
101         mkdir -p $(top_builddir)/html
102         cd $(top_builddir) && pod2html \
103           --css 'pod.css' \
104           --htmldir html \
105           --outfile html/$@ \
106           $(abs_srcdir)/$<
107
108 virt-filesystems.1: virt-filesystems.pod
109         $(POD2MAN) \
110           --section 1 \
111           -c "Virtualization Support" \
112           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
113           $< > $@-t && mv $@-t $@
114
115 $(top_builddir)/html/virt-filesystems.1.html: virt-filesystems.pod
116         mkdir -p $(top_builddir)/html
117         cd $(top_builddir) && pod2html \
118           --css 'pod.css' \
119           --htmldir html \
120           --outfile html/$@ \
121           $(abs_srcdir)/$<
122
123 virt-ls.1: virt-ls.pod
124         $(POD2MAN) \
125           --section 1 \
126           -c "Virtualization Support" \
127           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
128           $< > $@-t && mv $@-t $@
129
130 $(top_builddir)/html/virt-ls.1.html: virt-ls.pod
131         mkdir -p $(top_builddir)/html
132         cd $(top_builddir) && pod2html \
133           --css 'pod.css' \
134           --htmldir html \
135           --outfile html/$@ \
136           $(abs_srcdir)/$<
137
138 # Tests.
139
140 random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
141
142 TESTS_ENVIRONMENT = \
143         MALLOC_PERTURB_=$(random_val) \
144         LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
145         LIBGUESTFS_PATH=$(top_builddir)/appliance
146
147 TESTS = test-virt-cat.sh test-virt-filesystems.sh test-virt-ls.sh
148
149 # Build a partly-static binary (for the binary distribution).
150
151 virt-cat.static$(EXEEXT): $(virt_cat_OBJECTS) $(virt_cat_DEPENDENCIES)
152         $(top_srcdir)/relink-static.sh \
153         $(virt_cat_LINK) $(virt_cat_OBJECTS) -static $(virt_cat_LDADD) $(virt_cat_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -lpcre -lhivex -lmagic -lz -lm
154
155 virt-filesystems.static$(EXEEXT): $(virt_filesystems_OBJECTS) $(virt_filesystems_DEPENDENCIES)
156         $(top_srcdir)/relink-static.sh \
157         $(virt_filesystems_LINK) $(virt_filesystems_OBJECTS) -static $(virt_filesystems_LDADD) $(virt_filesystems_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -lpcre -lhivex -lmagic -lz -lm
158
159 virt-ls.static$(EXEEXT): $(virt_ls_OBJECTS) $(virt_ls_DEPENDENCIES)
160         $(top_srcdir)/relink-static.sh \
161         $(virt_ls_LINK) $(virt_ls_OBJECTS) -static $(virt_ls_LDADD) $(virt_ls_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -lpcre -lhivex -lmagic -lz -lm