2 # Copyright (C) 2009 Red Hat Inc.
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.
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.
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.
18 ACLOCAL_AMFLAGS = -I m4
20 SUBDIRS = src daemon fish po examples images
46 make-initramfs.sh update-initramfs.sh \
47 guestfs.pod guestfs-actions.pod guestfs-structs.pod \
48 guestfish.pod guestfish-actions.pod \
52 libguestfs.pc libguestfs.pc.in \
63 contrib/centos5.3-libguestfs.spec \
64 contrib/fedora-libguestfs.spec \
65 contrib/febootstrap/install.title \
66 contrib/febootstrap/install.html \
67 contrib/febootstrap/install.sh \
70 # Build the root filesystem.
71 # Currently this is arch-dependent, so it seems like putting it in
72 # $(libdir) is best. When we build cross-architecture filesystems we
73 # should probably move them to $(datadir).
75 fsdir = $(libdir)/guestfs
77 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
78 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
80 fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
82 $(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
84 initramfs/fakeroot.log: make-initramfs.sh.in
85 -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
86 -mv $(VMLINUZ) $(VMLINUZ).bak
87 if ! bash $(top_builddir)/make-initramfs.sh; then rm -f $@; exit 1; fi
89 $(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
91 bash $(top_builddir)/update-initramfs.sh
94 make-initramfs.sh: make-initramfs.sh.in
97 # Tests. These are auto-generated from the test descriptions
100 check_PROGRAMS = tests test-command
102 tests_SOURCES = tests.c
104 -I$(top_builddir)/src -Wall
105 tests_LDADD = $(top_builddir)/src/libguestfs.la
107 TESTS = tests test-bootbootboot.sh
108 TESTS_ENVIRONMENT = \
109 SKIP_TEST_COMMAND=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
110 SKIP_TEST_COMMAND_LINES=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
111 SKIP_TEST_ZEROFREE=$(shell test -x initramfs/usr/sbin/zerofree || echo 1) \
114 $(TESTS): $(INITRAMFS) $(VMLINUZ)
116 # Run the tests under valgrind.
119 $(MAKE) check VG="valgrind --quiet --leak-check=full"
121 # This binary must be statically linked. It is used for testing
122 # the "guestfs_command" and "guestfs_command_lines" functions.
124 test_command_SOURCES = test-command.c
125 test_command_LDFLAGS = -all-static
128 # guestfs-actions.pod and guestfs-structs are autogenerated. There is
129 # no include mechanism for POD, so we have to do it by hand.
131 man_MANS = guestfs.3 guestfish.1
133 guestfs.3: guestfs.pod guestfs-actions.pod guestfs-structs.pod
135 -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
136 -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
140 -c "Virtualization Support" \
142 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
145 guestfish.1: guestfish.pod guestfish-actions.pod
147 -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
151 -c "Virtualization Support" \
153 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
156 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
158 html/guestfs.3.html: guestfs.pod guestfs-actions.pod guestfs-structs.pod
160 -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
161 -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
165 --title "libguestfs API documentation" \
169 html/guestfish.1.html: guestfish.pod guestfish-actions.pod
171 -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
175 --title "guestfish, libguestfs filesystem interactive shell" \
180 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
182 sh make-recipes.sh recipes/*.sh > $@-t
185 website: html/guestfs.3.html html/guestfish.1.html \
186 html/virt-inspector.1.html \
188 cp $^ html/pod.css html/recipes.css \
189 $(HOME)/d/redhat/et-website/libguestfs/
191 # Generate the ChangeLog automatically from the gitlog.
194 ./gitlog-to-changelog > ChangeLog
195 cp ChangeLog $(distdir)/ChangeLog
199 pkgconfigdir = $(libdir)/pkgconfig
200 pkgconfig_DATA = libguestfs.pc
202 # Test-boot the image.
205 qemu-system-$(host_cpu) \
207 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
212 dd if=/dev/zero of=emptydisk bs=1024 count=1440
213 echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
215 # This is a more realistic test boot command line which better
216 # reflects what the library does.
218 test-boot-realistic: emptydisk
219 qemu-system-$(host_cpu) \
221 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
223 -append "console=ttyS0 guestfs=10.0.2.4:6666" \
226 -net channel,6666:unix:/tmp/sock,server,nowait \
228 -net nic,model=virtio,vlan=0
232 CLEANFILES = $(fs_DATA) emptydisk pod2htm?.tmp