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