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