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