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