Generate actions section in guestfs.3 man page.
[libguestfs.git] / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009 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 ACLOCAL_AMFLAGS = -I m4
19
20 SUBDIRS = src daemon fish examples
21
22 EXTRA_DIST = \
23         make-initramfs.sh update-initramfs.sh \
24         guestfs.pod guestfs-actions.pod
25
26 # Build the root filesystem.
27 # Currently this is arch-dependent, so it seems like putting it in
28 # $(libdir) is best.  When we build cross-architecture filesystems we
29 # should probably move them to $(datadir).
30
31 fsdir = $(libdir)/guestfs
32
33 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
34 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
35
36 fs_DATA =  $(INITRAMFSIMG) $(VMLINUZ)
37
38 $(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
39
40 initramfs/fakeroot.log: make-initramfs.sh.in
41         -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
42         -mv $(VMLINUZ) $(VMLINUZ).bak
43         if ! bash $(builddir)/make-initramfs.sh; then rm -f $@; exit 1; fi
44
45 $(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
46         rm -f $@
47         bash $(builddir)/update-initramfs.sh
48         touch $@
49
50 # Make clean.
51
52 CLEANFILES = $(fs_DATA) emptydisk
53
54 clean-local:
55         rm -rf initramfs
56
57 # Manual page.
58 # guestfs-actions.pod is autogenerated.  There is no include mechanism
59 # for POD, so we have to do it by hand.
60
61 man_MANS = guestfs.3
62
63 guestfs.3: guestfs.pod guestfs-actions.pod
64         sed -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' < $< | \
65         $(POD2MAN) \
66           --section 3 \
67           -c "Virtualization Support" \
68           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
69           > $@
70
71 # Test-boot the image.
72
73 test-boot: emptydisk
74         qemu-system-$(host_cpu) \
75           -m 384 \
76           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
77           -hda emptydisk
78
79 emptydisk:
80         rm -f emptydisk
81         dd if=/dev/zero of=emptydisk bs=1024 count=1440
82         echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
83
84 # This is a more realistic test boot command line which better
85 # reflects what the library does.
86
87 test-boot-realistic: emptydisk
88         qemu-system-$(host_cpu) \
89           -m 384 \
90           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
91           -hda emptydisk \
92           -append "console=ttyS0 guestfs=10.0.2.4:6666" \
93           -nographic \
94           -serial stdio \
95           -net channel,6666:unix:/tmp/sock,server,nowait \
96           -net user,vlan=0 \
97           -net nic,vlan=0