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