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