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 examples images
42 make-initramfs.sh update-initramfs.sh \
43 guestfs.pod guestfs-actions.pod guestfs-structs.pod \
44 guestfish.pod guestfish-actions.pod \
49 libguestfs.pc libguestfs.pc.in \
59 # Build the root filesystem.
60 # Currently this is arch-dependent, so it seems like putting it in
61 # $(libdir) is best. When we build cross-architecture filesystems we
62 # should probably move them to $(datadir).
64 fsdir = $(libdir)/guestfs
66 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
67 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
69 fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
71 $(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
73 initramfs/fakeroot.log: make-initramfs.sh.in
74 -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
75 -mv $(VMLINUZ) $(VMLINUZ).bak
76 if ! bash $(top_builddir)/make-initramfs.sh; then rm -f $@; exit 1; fi
78 $(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
80 bash $(top_builddir)/update-initramfs.sh
83 # Tests. These are auto-generated from the test descriptions.
85 check_PROGRAMS = tests
87 tests_SOURCES = tests.c
89 -I$(top_builddir)/src -Wall
90 tests_LDADD = $(top_builddir)/src/libguestfs.la
92 TESTS = $(check_PROGRAMS)
94 $(TESTS): $(INITRAMFS) $(VMLINUZ)
97 # guestfs-actions.pod and guestfs-structs are autogenerated. There is
98 # no include mechanism for POD, so we have to do it by hand.
100 man_MANS = guestfs.3 guestfish.1
102 guestfs.3: guestfs.pod guestfs-actions.pod guestfs-structs.pod
104 -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
105 -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
109 -c "Virtualization Support" \
111 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
114 guestfish.1: guestfish.pod guestfish-actions.pod
116 -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
120 -c "Virtualization Support" \
122 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
125 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
127 html/guestfs.3.html: guestfs.pod guestfs-actions.pod guestfs-structs.pod
129 -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
130 -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
134 --title "libguestfs API documentation" \
138 html/guestfish.1.html: guestfish.pod guestfish-actions.pod
140 -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
144 --title "guestfish, libguestfs filesystem interactive shell" \
149 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
151 sh make-recipes.sh recipes/*.sh > $@-t
154 website: html/guestfs.3.html html/guestfish.1.html html/recipes.html
155 cp $^ html/pod.css html/recipes.css \
156 $(HOME)/d/redhat/et-website/libguestfs/
158 # Generate the ChangeLog automatically from the gitlog.
161 ./gitlog-to-changelog > ChangeLog
162 cp ChangeLog $(distdir)/ChangeLog
166 pkgconfigdir = $(libdir)/pkgconfig
167 pkgconfig_DATA = libguestfs.pc
169 # Test-boot the image.
172 qemu-system-$(host_cpu) \
174 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
179 dd if=/dev/zero of=emptydisk bs=1024 count=1440
180 echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
182 # This is a more realistic test boot command line which better
183 # reflects what the library does.
185 test-boot-realistic: emptydisk
186 qemu-system-$(host_cpu) \
188 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
190 -append "console=ttyS0 guestfs=10.0.2.4:6666" \
193 -net channel,6666:unix:/tmp/sock,server,nowait \
199 CLEANFILES = $(fs_DATA) emptydisk pod2htm?.tmp *~ html/*~ recipes/*~