regressions: Test just-built guestfish.
[libguestfs.git] / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009-2010 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 include $(top_srcdir)/subdir-rules.mk
19
20 ACLOCAL_AMFLAGS = -I m4
21
22 # Basic source for the library.
23 SUBDIRS = gnulib/lib images generator src examples po
24
25 if ENABLE_DAEMON
26 SUBDIRS += daemon
27 endif
28 if ENABLE_APPLIANCE
29 SUBDIRS += appliance
30 endif
31
32 # Tests and the test-tool.
33 SUBDIRS += gnulib/tests capitests regressions test-tool
34
35 # Guestfish.
36 SUBDIRS += fish
37
38 # Language bindings.
39 if HAVE_PERL
40 SUBDIRS += perl
41 endif
42 if HAVE_OCAML
43 SUBDIRS += ocaml ocaml/examples
44 endif
45 if HAVE_PYTHON
46 SUBDIRS += python
47 endif
48 if HAVE_RUBY
49 SUBDIRS += ruby
50 endif
51 if HAVE_JAVA
52 SUBDIRS += java
53 endif
54 if HAVE_HASKELL
55 SUBDIRS += haskell
56 endif
57 if HAVE_PHP
58 SUBDIRS += php
59 endif
60
61 # Virt-inspector, tools and guestmount.
62 if HAVE_INSPECTOR
63 SUBDIRS += inspector
64 endif
65
66 if HAVE_TOOLS
67 SUBDIRS += tools
68 endif
69
70 if HAVE_FUSE
71 SUBDIRS += fuse
72 endif
73
74 # po-docs must come after tools, inspector.
75 SUBDIRS += po-docs
76
77 EXTRA_DIST = \
78         $(generator_built) \
79         html/pod.css \
80         BUGS HACKING RELEASE-NOTES TODO \
81         libguestfs.pc libguestfs.pc.in \
82         recipes/LICENSE \
83         recipes/README \
84         recipes/*.html \
85         recipes/*.sh \
86         recipes/*.example \
87         html/recipes.css \
88         make-recipes.sh \
89         contrib/README \
90         bindtests \
91         .gitignore \
92         m4/.gitignore
93
94 # HTML versions of manual pages.
95
96 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
97
98 html/guestfs.3.html: src/guestfs.pod \
99                 src/guestfs-actions.pod \
100                 src/guestfs-availability.pod \
101                 src/guestfs-structs.pod
102         mkdir -p html
103         sed \
104           -e '/@ACTIONS@/rsrc/guestfs-actions.pod' \
105           -e 's/@ACTIONS@//' \
106           -e '/@AVAILABILITY@/rsrc/guestfs-availability.pod' \
107           -e 's/@AVAILABILITY@//' \
108           -e '/@STRUCTS@/rsrc/guestfs-structs.pod' \
109           -e 's/@STRUCTS@//' \
110           < $< | \
111         pod2html \
112           --css 'pod.css' \
113           --title "libguestfs API documentation" \
114           --htmldir html \
115           --outfile $@
116
117 html/guestfish.1.html: fish/guestfish.pod fish/guestfish-actions.pod fish/guestfish-commands.pod
118         mkdir -p html
119         sed \
120           -e '/@ACTIONS@/rfish/guestfish-actions.pod' -e 's/@ACTIONS@//' \
121           -e '/@FISH_COMMANDS@/rguestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
122           < $< | \
123         pod2html \
124           --css 'pod.css' \
125           --title "guestfish, libguestfs filesystem interactive shell" \
126           --htmldir html \
127           --outfile $@
128
129 # Recipes web page.
130 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
131         mkdir -p html
132         rm -f $@ $@-t
133         sh make-recipes.sh recipes/*.sh > $@-t
134         mv $@-t $@
135
136 HTMLFILES = \
137         html/guestfs.3.html \
138         html/guestfish.1.html \
139         html/guestmount.1.html \
140         html/virt-cat.1.html \
141         html/virt-df.1.html \
142         html/virt-edit.1.html \
143         html/virt-inspector.1.html \
144         html/virt-list-filesystems.1.html \
145         html/virt-list-partitions.1.html \
146         html/virt-ls.1.html \
147         html/virt-make-fs.1.html \
148         html/virt-rescue.1.html \
149         html/virt-resize.1.html \
150         html/virt-tar.1.html \
151         html/virt-win-reg.1.html \
152         html/recipes.html \
153         html/pod.css html/recipes.css
154
155 TEXTFILES = README TODO HACKING
156
157 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
158
159 website: $(HTMLFILES) $(TEXTFILES)
160         cp $(HTMLFILES) $(WEBSITEDIR)
161         for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
162         cd $(WEBSITEDIR) && \
163         date=`date +%F`; \
164         sed -e "s/SUBST_VERSION/$(VERSION)/" \
165             -e "s/SUBST_DATE/$$date/" \
166         < index.html.in > index.html
167
168 # When doing 'make dist' update a few files automatically.
169 dist-hook:
170         $(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
171         cp ChangeLog $(distdir)/ChangeLog
172         $(top_srcdir)/update-bugs > BUGS-t
173         mv BUGS-t BUGS
174         cp BUGS $(distdir)/BUGS
175
176 # Update the list of translatable files in po/POTFILES.in.
177 all-local:
178         cd $(srcdir); \
179         find $(DIST_SUBDIRS) \
180             -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
181         grep -v '^perl/blib/' | \
182         grep -v '^capitests/' | \
183         grep -v '^daemon/lib/' | \
184         grep -v '^daemon/tests/' | \
185         grep -v '^examples/' | \
186         grep -v '^gnulib/' | \
187         grep -v '^perl/examples/' | \
188         grep -v '/guestfs_protocol.c' | \
189         grep -v '/rc_protocol.c' | \
190         grep -v 'appliance/debian/root' | \
191         grep -v '^po-docs/' | \
192         LC_ALL=C sort | \
193         sed 's,^\./,,' > po/POTFILES.in
194
195 # Pkgconfig.
196
197 pkgconfigdir = $(libdir)/pkgconfig
198 pkgconfig_DATA = libguestfs.pc
199
200 # Make clean.
201
202 CLEANFILES = $(fs_DATA) \
203         emptydisk \
204         pod2htm?.tmp \
205         html/*.html \
206         guestfs.3 guestfish.1
207
208 clean-local:
209         rm -rf initramfs
210
211 # If you don't want to run all of the tests ('make check') then this
212 # will just run libguestfs-test-tool for a quick check.  Note this
213 # is NOT a substitute for proper testing!
214
215 quickcheck:
216         test-tool/run-test-tool-locally
217
218 # Mostly static binary distribution.
219 #
220 # Some binaries are relinked partially statically.  You can make these
221 # binaries "more static" by making sure that as many foo-static
222 # packages are installed as possible.
223 #
224 # We remove the supermin appliance and adjust some directories to make
225 # them non-Fedora-specific.
226
227 BINTMPDIR = /tmp/libguestfs-bin
228 bindist:
229         rm -rf $(BINTMPDIR)
230         mkdir $(BINTMPDIR)
231         $(MAKE)
232         $(MAKE) DESTDIR=$(BINTMPDIR) install
233         rm -r $(BINTMPDIR)$(libdir)/guestfs/supermin.d
234         rm $(BINTMPDIR)$(libdir)/guestfs/kmod.whitelist
235         mv $(BINTMPDIR)$(prefix)/lib64/* $(BINTMPDIR)$(libdir)
236         mv $(BINTMPDIR)/usr/lib64/* $(BINTMPDIR)$(libdir)
237         -find $(BINTMPDIR) -type d -exec rmdir --ignore-fail-on-non-empty {} \;
238         $(MAKE) -C fish guestfish.static
239         cp fish/guestfish.static $(BINTMPDIR)$(bindir)/guestfish
240         $(MAKE) -C fuse guestmount.static
241         cp fuse/guestmount.static $(BINTMPDIR)$(bindir)/guestmount
242         $(MAKE) -C test-tool libguestfs-test-tool.static
243         cp test-tool/libguestfs-test-tool.static $(BINTMPDIR)$(bindir)/libguestfs-test-tool
244         (cd $(BINTMPDIR) && tar cf - .) | \
245           gzip -c -9 > libguestfs-$(VERSION)-$(host_cpu).tar.gz