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