Updated TODO, BUGS.
[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 images
21
22 if HAVE_OCAML
23 SUBDIRS += ocaml
24 endif
25 if HAVE_PERL
26 SUBDIRS += perl
27 endif
28 if HAVE_PYTHON
29 SUBDIRS += python
30 endif
31
32 EXTRA_DIST = \
33         make-initramfs.sh update-initramfs.sh \
34         guestfs.pod guestfs-actions.pod guestfs-structs.pod \
35         guestfish.pod guestfish-actions.pod \
36         libguestfs.spec \
37         html/pod.css \
38         HACKING TODO \
39         tests.c
40
41 # Build the root filesystem.
42 # Currently this is arch-dependent, so it seems like putting it in
43 # $(libdir) is best.  When we build cross-architecture filesystems we
44 # should probably move them to $(datadir).
45
46 fsdir = $(libdir)/guestfs
47
48 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
49 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
50
51 fs_DATA =  $(INITRAMFSIMG) $(VMLINUZ)
52
53 $(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
54
55 initramfs/fakeroot.log: make-initramfs.sh.in
56         -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
57         -mv $(VMLINUZ) $(VMLINUZ).bak
58         if ! bash $(builddir)/make-initramfs.sh; then rm -f $@; exit 1; fi
59
60 $(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
61         rm -f $@
62         bash $(builddir)/update-initramfs.sh
63         touch $@
64
65 # Tests.  These are auto-generated from the test descriptions.
66
67 check_PROGRAMS = tests
68
69 tests_SOURCES = tests.c
70 tests_CFLAGS = \
71         -I$(top_builddir)/src -Wall
72 tests_LDADD = $(top_builddir)/src/libguestfs.la
73
74 TESTS = $(check_PROGRAMS)
75
76 $(TESTS): $(INITRAMFS) $(VMLINUZ)
77
78 # Manual pages.
79 # guestfs-actions.pod and guestfs-structs are autogenerated.  There is
80 # no include mechanism for POD, so we have to do it by hand.
81
82 man_MANS = guestfs.3 guestfish.1
83
84 guestfs.3: guestfs.pod guestfs-actions.pod guestfs-structs.pod
85         sed \
86           -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
87           -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
88           < $< | \
89         $(POD2MAN) \
90           --section 3 \
91           -c "Virtualization Support" \
92           --name "guestfs" \
93           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
94           > $@
95
96 guestfish.1: guestfish.pod guestfish-actions.pod
97         sed \
98           -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
99           < $< | \
100         $(POD2MAN) \
101           --section 1 \
102           -c "Virtualization Support" \
103           --name "guestfish" \
104           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
105           > $@
106
107 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
108
109 html/guestfs.3.html: guestfs.pod guestfs-actions.pod guestfs-structs.pod
110         sed \
111           -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
112           -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
113           < $< | \
114         pod2html \
115           --css 'pod.css' \
116           --title "libguestfs API documentation" \
117           --htmldir html \
118           --outfile $@
119
120 html/guestfish.1.html: guestfish.pod guestfish-actions.pod
121         sed \
122           -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
123           < $< | \
124         pod2html \
125           --css 'pod.css' \
126           --title "guestfish, libguestfs filesystem interactive shell" \
127           --htmldir html \
128           --outfile $@
129
130 website: html/guestfs.3.html html/guestfish.1.html
131         cp $^ html/pod.css $(HOME)/d/redhat/et-website/libguestfs/
132
133 # Test-boot the image.
134
135 test-boot: emptydisk
136         qemu-system-$(host_cpu) \
137           -m 384 \
138           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
139           -hda emptydisk
140
141 emptydisk:
142         rm -f emptydisk
143         dd if=/dev/zero of=emptydisk bs=1024 count=1440
144         echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
145
146 # This is a more realistic test boot command line which better
147 # reflects what the library does.
148
149 test-boot-realistic: emptydisk
150         qemu-system-$(host_cpu) \
151           -m 384 \
152           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
153           -hda emptydisk \
154           -append "console=ttyS0 guestfs=10.0.2.4:6666" \
155           -nographic \
156           -serial stdio \
157           -net channel,6666:unix:/tmp/sock,server,nowait \
158           -net user,vlan=0 \
159           -net nic,vlan=0
160
161 # Make clean.
162
163 CLEANFILES = $(fs_DATA) emptydisk pod2htm?.tmp *~ html/*~
164
165 clean-local:
166         rm -rf initramfs