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