df34d38bcd5b2579463a3aac909939ff77bf1a15
[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 SUBDIRS = gnulib/lib src
23
24 if ENABLE_DAEMON
25 SUBDIRS += daemon
26 endif
27 if ENABLE_APPLIANCE
28 SUBDIRS += appliance
29 endif
30
31 SUBDIRS += fish po examples images
32 SUBDIRS += gnulib/tests capitests regressions test-tool
33
34 # NB: Must build inspector directory after perl and before ocaml.
35 # We could relax this if we combined the inspector_generator with
36 # the ordinary generator, but that brings other problems.
37 if HAVE_PERL
38 SUBDIRS += perl
39 endif
40
41 if HAVE_INSPECTOR
42 SUBDIRS += inspector
43 endif
44 if HAVE_TOOLS
45 SUBDIRS += tools
46 endif
47
48 if HAVE_FUSE
49 SUBDIRS += fuse
50 endif
51
52 if HAVE_OCAML
53 SUBDIRS += ocaml ocaml/examples
54 endif
55 if HAVE_PYTHON
56 SUBDIRS += python
57 endif
58 if HAVE_RUBY
59 SUBDIRS += ruby
60 endif
61 if HAVE_JAVA
62 SUBDIRS += java
63 endif
64 if HAVE_HASKELL
65 SUBDIRS += haskell
66 endif
67
68 EXTRA_DIST = \
69         $(generator_built) \
70         html/pod.css \
71         HACKING TODO \
72         libguestfs.pc libguestfs.pc.in \
73         recipes/LICENSE \
74         recipes/README \
75         recipes/*.html \
76         recipes/*.sh \
77         recipes/*.example \
78         html/recipes.css \
79         make-recipes.sh \
80         contrib/README \
81         bindtests \
82         .gitignore \
83         m4/.gitignore
84
85 # HTML versions of manual pages.
86
87 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
88
89 html/guestfs.3.html: src/guestfs.pod \
90                 src/guestfs-actions.pod \
91                 src/guestfs-availability.pod \
92                 src/guestfs-structs.pod
93         mkdir -p html
94         sed \
95           -e '/@ACTIONS@/rsrc/guestfs-actions.pod' \
96           -e 's/@ACTIONS@//' \
97           -e '/@AVAILABILITY@/rsrc/guestfs-availability.pod' \
98           -e 's/@AVAILABILITY@//' \
99           -e '/@STRUCTS@/rsrc/guestfs-structs.pod' \
100           -e 's/@STRUCTS@//' \
101           < $< | \
102         pod2html \
103           --css 'pod.css' \
104           --title "libguestfs API documentation" \
105           --htmldir html \
106           --outfile $@
107
108 html/guestfish.1.html: fish/guestfish.pod fish/guestfish-actions.pod
109         mkdir -p html
110         sed \
111           -e '/@ACTIONS@/rfish/guestfish-actions.pod' -e 's/@ACTIONS@//' \
112           < $< | \
113         pod2html \
114           --css 'pod.css' \
115           --title "guestfish, libguestfs filesystem interactive shell" \
116           --htmldir html \
117           --outfile $@
118
119 # Recipes web page.
120 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
121         mkdir -p html
122         rm -f $@ $@-t
123         sh make-recipes.sh recipes/*.sh > $@-t
124         mv $@-t $@
125
126 HTMLFILES = \
127         html/guestfs.3.html \
128         html/guestfish.1.html \
129         html/guestmount.1.html \
130         html/virt-cat.1.html \
131         html/virt-df.1.html \
132         html/virt-edit.1.html \
133         html/virt-inspector.1.html \
134         html/virt-list-filesystems.1.html \
135         html/virt-ls.1.html \
136         html/virt-rescue.1.html \
137         html/virt-tar.1.html \
138         html/virt-win-reg.1.html \
139         html/recipes.html \
140         html/pod.css html/recipes.css
141
142 TEXTFILES = README TODO HACKING
143
144 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
145
146 website: $(HTMLFILES) $(TEXTFILES)
147         cp $(HTMLFILES) $(WEBSITEDIR)
148         for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
149         cd $(WEBSITEDIR) && \
150         date=`date +%F`; \
151         sed -e "s/SUBST_VERSION/$(VERSION)/" \
152             -e "s/SUBST_DATE/$$date/" \
153         < index.html.in > index.html
154
155 # Generate the ChangeLog automatically from the gitlog.
156
157 dist-hook:
158         $(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
159         cp ChangeLog $(distdir)/ChangeLog
160
161 # Update the list of translatable files in po/POTFILES.in.
162 all-local:
163         cd $(srcdir); \
164         find $(DIST_SUBDIRS) \
165             -name '*.c' -o -name '*.pl' -o -name '*.pm' -o \
166             -name 'virt-cat' -o \
167             -name 'virt-df' -o \
168             -name 'virt-edit' -o \
169             -name 'virt-inspector' -o \
170             -name 'virt-list-filesystems' -o \
171             -name 'virt-ls' -o \
172             -name 'virt-rescue' -o \
173             -name 'virt-tar' -o \
174             -name 'virt-win-reg' | \
175         grep -v '^perl/blib/' | \
176         grep -v '^capitests/' | \
177         grep -v '^daemon/lib/' | \
178         grep -v '^daemon/tests/' | \
179         grep -v '^examples/' | \
180         grep -v '^gnulib/' | \
181         grep -v '^perl/examples/' | \
182         grep -v '/guestfs_protocol.c' | \
183         grep -v '/rc_protocol.c' | \
184         grep -v 'appliance/debian/root' | \
185         LC_ALL=C sort | \
186         sed 's,^\./,,' > po/POTFILES.in
187
188 # Pkgconfig.
189
190 pkgconfigdir = $(libdir)/pkgconfig
191 pkgconfig_DATA = libguestfs.pc
192
193 # Make clean.
194
195 CLEANFILES = $(fs_DATA) \
196         emptydisk \
197         pod2htm?.tmp \
198         html/*.html \
199         guestfs.3 guestfish.1
200
201 clean-local:
202         rm -rf initramfs
203
204 # If you don't want to run all of the tests ('make check') then this
205 # will just run libguestfs-test-tool for a quick check.  Note this
206 # is NOT a substitute for proper testing!
207
208 quickcheck:
209         LIBGUESTFS_PATH=appliance \
210         test-tool/libguestfs-test-tool \
211           --helper test-tool/libguestfs-test-tool-helper