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