d14cc123334d6748cd37948df0e12f6b7e4ad07d
[libguestfs.git] / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009-2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 include $(top_srcdir)/subdir-rules.mk
19
20 ACLOCAL_AMFLAGS = -I m4
21
22 # Gnulib - must be built and tested before the library.
23 SUBDIRS = gnulib/lib gnulib/tests
24
25 # Basic source for the library.
26 SUBDIRS += tests/data generator src examples po
27
28 if ENABLE_DAEMON
29 SUBDIRS += daemon
30 endif
31 if ENABLE_APPLIANCE
32 SUBDIRS += appliance
33 endif
34
35 # Tests - order is important.
36 SUBDIRS += tests/qemu
37 SUBDIRS += tests/guests
38 SUBDIRS += tests/c-api
39 SUBDIRS += tests/protocol
40 SUBDIRS += tests/lvm
41 SUBDIRS += tests/luks
42 SUBDIRS += tests/md
43 SUBDIRS += tests/regressions
44
45 # Extra tests don't run by default.  You have to do 'make extra-tests'.
46 SUBDIRS += tests/extra
47
48 # libguestfs-test-tool
49 SUBDIRS += test-tool
50
51 # Guestfish.
52 SUBDIRS += fish
53
54 # virt-tools in C.
55 SUBDIRS += align cat df edit inspector rescue
56
57 # Language bindings.
58 if HAVE_PERL
59 SUBDIRS += perl perl/examples
60 endif
61 if HAVE_OCAML
62 SUBDIRS += ocaml ocaml/examples
63 endif
64 if HAVE_PYTHON
65 SUBDIRS += python python/examples
66 endif
67 if HAVE_RUBY
68 SUBDIRS += ruby ruby/examples
69 endif
70 if HAVE_JAVA
71 SUBDIRS += java java/examples
72 endif
73 if HAVE_HASKELL
74 SUBDIRS += haskell
75 endif
76 if HAVE_PHP
77 SUBDIRS += php
78 endif
79 if HAVE_ERLANG
80 SUBDIRS += erlang erlang/examples
81 endif
82
83 # Unconditional because nothing is built yet.
84 SUBDIRS += csharp
85
86 # virt-resize (new version) and virt-sparsify are written in OCaml.
87 if HAVE_OCAML
88 SUBDIRS += resize sparsify
89 endif
90
91 # Perl tools.
92 if HAVE_TOOLS
93 SUBDIRS += tools
94 endif
95
96 # guestmount
97 if HAVE_FUSE
98 SUBDIRS += fuse
99 endif
100
101 # virt-tools in shell.  This uses guestmount and virt-inspector.
102 if HAVE_FUSE
103 SUBDIRS += clone
104 endif
105
106 # po-docs must come after tools, inspector.
107 if HAVE_PO4A
108 SUBDIRS += po-docs
109 endif
110
111 EXTRA_DIST = \
112         $(generator_built) \
113         BUGS HACKING RELEASE-NOTES ROADMAP TODO \
114         .gitignore \
115         bugs-in-changelog.sh \
116         autogen.sh \
117         bindtests \
118         contrib/autobuild/autobuild.sh \
119         contrib/guestfsd-in-wine.sh \
120         contrib/intro/libguestfs-intro.html \
121         contrib/intro/overview.svg \
122         contrib/intro/talk.txt \
123         contrib/intro/tools.svg \
124         contrib/README \
125         contrib/visualize-alignment/.gitignore \
126         contrib/visualize-alignment/guestfish-add-mount.qtr \
127         contrib/visualize-alignment/guestfish-lv-ext4-4k.qtr \
128         contrib/visualize-alignment/guestfish-lv-ext4-4k-write-hello.qtr \
129         contrib/visualize-alignment/guestfish-N-fs-10M-aligned-part-disk.qtr \
130         contrib/visualize-alignment/guestfish-N-fs-10M.qtr \
131         contrib/visualize-alignment/guestfish-write-hello.qtr \
132         contrib/visualize-alignment/qemu-0.13-trace-block-device-access.patch \
133         contrib/visualize-alignment/README \
134         contrib/visualize-alignment/tracetops.ml \
135         debian/.gitignore \
136         debian/changelog \
137         debian/compat \
138         debian/control \
139         debian/copyright \
140         debian/docs \
141         debian/guestfish.dirs \
142         debian/guestfish.install \
143         debian/guestfsd.dirs \
144         debian/guestfsd.install \
145         debian/guestmount.dirs \
146         debian/guestmount.install \
147         debian/libguestfs-dev.dirs \
148         debian/libguestfs-dev.install \
149         debian/libguestfs-doc.docs \
150         debian/libguestfs-perl.examples \
151         debian/libguestfs-perl.install \
152         debian/libguestfs-tools.dirs \
153         debian/libguestfs-tools.install \
154         debian/libguestfs0.dirs \
155         debian/libguestfs0.install \
156         debian/patches/series \
157         debian/python-guestfs.install \
158         debian/pyversions \
159         debian/rules \
160         debian/shlibs.local \
161         debian/watch \
162         html/pod.css \
163         libguestfs.pc libguestfs.pc.in \
164         libtool-kill-dependency_libs.sh \
165         logo/fish.svg logo/fish.png \
166         m4/.gitignore \
167         run \
168         update-bugs.sh
169
170 HTMLFILES = \
171         html/guestfs.3.html \
172         html/guestfs-examples.3.html \
173         html/guestfs-erlang.3.html \
174         html/guestfs-java.3.html \
175         html/guestfs-ocaml.3.html \
176         html/guestfs-perl.3.html \
177         html/guestfs-python.3.html \
178         html/guestfs-recipes.1.html \
179         html/guestfs-ruby.3.html \
180         html/guestfs-testing.1.html \
181         html/guestfish.1.html \
182         html/guestmount.1.html \
183         html/virt-alignment-scan.1.html \
184         html/virt-cat.1.html \
185         html/virt-copy-in.1.html \
186         html/virt-copy-out.1.html \
187         html/virt-df.1.html \
188         html/virt-edit.1.html \
189         html/virt-filesystems.1.html \
190         html/virt-inspector.1.html \
191         html/virt-list-filesystems.1.html \
192         html/virt-list-partitions.1.html \
193         html/virt-ls.1.html \
194         html/virt-make-fs.1.html \
195         html/virt-rescue.1.html \
196         html/virt-resize.1.html \
197         html/virt-sparsify.1.html \
198         html/virt-sysprep.1.html \
199         html/virt-tar.1.html \
200         html/virt-tar-in.1.html \
201         html/virt-tar-out.1.html \
202         html/virt-win-reg.1.html
203
204 TEXTFILES = BUGS README RELEASE-NOTES ROADMAP TODO
205
206 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
207
208 website: $(HTMLFILES) $(TEXTFILES)
209         cp $(HTMLFILES) $(WEBSITEDIR)
210         for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
211         cd $(WEBSITEDIR) && \
212         date=`date +%F`; \
213         sed -e "s/SUBST_VERSION/$(VERSION)/" \
214             -e "s/SUBST_DATE/$$date/" \
215         < index.html.in > index.html
216
217 # When doing 'make dist' update a few files automatically.
218 dist-hook:
219         $(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
220         cp ChangeLog $(distdir)/ChangeLog
221         $(top_srcdir)/update-bugs.sh > BUGS-t
222         mv BUGS-t BUGS
223         cp BUGS $(distdir)/BUGS
224         git log --pretty="format:%an <%ae>" | sort -u | uniq -w 10 | \
225                 grep -v rjones | \
226                 grep -v "Richard Jones" \
227                 > AUTHORS-t
228         mv AUTHORS-t AUTHORS
229         cp AUTHORS $(distdir)/AUTHORS
230
231 # Update the list of translatable files in po/POTFILES.in.
232 all-local:
233         cd $(srcdir); \
234         find $(DIST_SUBDIRS) \
235             -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
236         grep -v '^perl/blib/' | \
237         grep -v '^tests/' | \
238         grep -v '^daemon/lib/' | \
239         grep -v '^daemon/tests/' | \
240         grep -v '^examples/' | \
241         grep -v '^gnulib/' | \
242         grep -v '^perl/examples/' | \
243         grep -v '/guestfs_protocol.c' | \
244         grep -v '/rc_protocol.c' | \
245         grep -v 'appliance/debian/root' | \
246         grep -v '^po-docs/' | \
247         grep -v '^images/' | \
248         LC_ALL=C sort | \
249         sed 's,^\./,,' > po/POTFILES.in
250
251 # Pkgconfig.
252
253 pkgconfigdir = $(libdir)/pkgconfig
254 pkgconfig_DATA = libguestfs.pc
255
256 # Make clean.
257
258 CLEANFILES = \
259         pod2htm?.tmp \
260         html/*.html
261
262 # If you don't want to run all of the tests ('make check') then this
263 # will just run libguestfs-test-tool for a quick check.  Note this
264 # is NOT a substitute for proper testing!
265
266 quickcheck:
267         ./run test-tool/libguestfs-test-tool $(QUICKCHECK_TEST_TOOL_ARGS)
268
269 # Run extra-tests in tests/extra/ subdirectory.
270
271 extra-tests:
272         make -C tests/extra $@
273
274 # Make binary distribution.
275
276 BINTMPDIR = /tmp/libguestfs-bin
277 bindist:
278         rm -rf $(BINTMPDIR)
279         mkdir $(BINTMPDIR)
280         $(MAKE)
281         $(MAKE) DESTDIR=$(BINTMPDIR) install
282         -find $(BINTMPDIR) -type d -exec rmdir --ignore-fail-on-non-empty {} \;
283         (cd $(BINTMPDIR) && tar cf - .) | \
284           gzip -c -9 > libguestfs-$(VERSION)-$(DISTRO)-$(host_cpu).tar.gz