Update HACKING description of tools/ subdirectory.
[libguestfs.git] / tools / Makefile.am
1 # libguestfs virt-* tools
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 tools = \
21         edit \
22         list-filesystems \
23         list-partitions \
24         make-fs \
25         rescue \
26         resize \
27         tar \
28         win-reg
29
30 EXTRA_DIST = \
31         run-locally \
32         $(tools:%=virt-%) \
33         test-virt-*.sh
34
35 CLEANFILES = test.img
36
37 if HAVE_TOOLS
38
39 bin_SCRIPTS = $(tools:%=virt-%)
40
41 # Manual pages and HTML files for the website.
42
43 # XXX Bug in automake?  If you list virt-edit.1 explicitly, then it
44 # builds and installs the man pages.  However if this is removed,
45 # then the man pages are neither built nor installed.
46 man_MANS = virt-edit.1 $(patsubst %,virt-%.1,$(filter-out edit,$(tools)))
47
48 noinst_DATA = $(tools:%=$(top_builddir)/html/virt-%.1.html)
49
50 virt-%.1: virt-%
51         $(top_srcdir)/podwrapper.sh \
52           --man $@ \
53           $<
54
55 $(top_builddir)/html/virt-%.1.html: virt-%
56         $(top_srcdir)/podwrapper.sh \
57           --html $@ \
58           $<
59
60 # Tests.
61
62 random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
63
64 TESTS_ENVIRONMENT = \
65         MALLOC_PERTURB_=$(random_val) \
66         LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
67         LIBGUESTFS_PATH=$(top_builddir)/appliance \
68         PERL5LIB=$(top_builddir)/perl/blib/lib:$(top_builddir)/perl/blib/arch
69
70 TESTS = test-virt-list-filesystems.sh \
71         test-virt-make-fs.sh \
72         test-virt-resize.sh \
73         test-virt-tar.sh
74
75 endif
76
77 # Make symlinks from virt-foo.pl to virt-foo.  This is just to keep
78 # xgettext happy since it uses the file extension to determine the
79 # implementation language of a file.
80
81 all-local: $(tools:%=virt-%.pl)
82
83 virt-%.pl: virt-%
84         ln -sf $< $@