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