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