lib: Add thread-safety to global list of handles.
[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-actions.pod \
61         guestfs-availability.pod \
62         guestfs-structs.pod \
63         guestfish-actions.pod
64
65 EXTRA_DIST = \
66         $(generator_built) \
67         guestfs.pod \
68         guestfish.pod \
69         html/pod.css \
70         HACKING TODO \
71         libguestfs.pc libguestfs.pc.in \
72         recipes/LICENSE \
73         recipes/README \
74         recipes/*.html \
75         recipes/*.sh \
76         recipes/*.example \
77         html/recipes.css \
78         make-recipes.sh \
79         contrib/README \
80         contrib/febootstrap/install.title \
81         contrib/febootstrap/install.html \
82         contrib/febootstrap/install.sh \
83         bindtests \
84         libguestfs.3
85
86 # Manual pages.
87 # guestfs-actions.pod, guestfs-availability.pod and guestfs-structs
88 # are autogenerated.  There is no include mechanism for POD, so we
89 # have to do it by hand.
90
91 man_MANS = guestfs.3 libguestfs.3 guestfish.1
92
93 guestfs.3: guestfs.pod \
94                 guestfs-actions.pod \
95                 guestfs-availability.pod \
96                 guestfs-structs.pod
97         sed \
98           -e '/@ACTIONS@/rguestfs-actions.pod' \
99           -e 's/@ACTIONS@//' \
100           -e '/@AVAILABILITY@/rguestfs-availability.pod' \
101           -e 's/@AVAILABILITY@//' \
102           -e '/@STRUCTS@/rguestfs-structs.pod' \
103           -e 's/@STRUCTS@//' \
104           < $< | \
105         $(POD2MAN) \
106           --section 3 \
107           -c "Virtualization Support" \
108           --name "guestfs" \
109           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
110           > $@
111
112 guestfish.1: guestfish.pod guestfish-actions.pod
113         sed \
114           -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
115           < $< | \
116         $(POD2MAN) \
117           --section 1 \
118           -c "Virtualization Support" \
119           --name "guestfish" \
120           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
121           > $@
122
123 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
124
125 html/guestfs.3.html: guestfs.pod \
126                 guestfs-actions.pod \
127                 guestfs-availability.pod \
128                 guestfs-structs.pod
129         mkdir -p html
130         sed \
131           -e '/@ACTIONS@/rguestfs-actions.pod' \
132           -e 's/@ACTIONS@//' \
133           -e '/@AVAILABILITY@/rguestfs-availability.pod' \
134           -e 's/@AVAILABILITY@//' \
135           -e '/@STRUCTS@/rguestfs-structs.pod' \
136           -e 's/@STRUCTS@//' \
137           < $< | \
138         pod2html \
139           --css 'pod.css' \
140           --title "libguestfs API documentation" \
141           --htmldir html \
142           --outfile $@
143
144 html/guestfish.1.html: guestfish.pod guestfish-actions.pod
145         mkdir -p html
146         sed \
147           -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
148           < $< | \
149         pod2html \
150           --css 'pod.css' \
151           --title "guestfish, libguestfs filesystem interactive shell" \
152           --htmldir html \
153           --outfile $@
154
155 # Recipes web page.
156 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
157         mkdir -p html
158         rm -f $@ $@-t
159         sh make-recipes.sh recipes/*.sh > $@-t
160         mv $@-t $@
161
162 HTMLFILES = \
163         html/guestfs.3.html \
164         html/guestfish.1.html \
165         html/guestmount.1.html \
166         html/hivex.3.html \
167         html/hivexget.1.html \
168         html/hivexml.1.html \
169         html/virt-cat.1.html \
170         html/virt-df.1.html \
171         html/virt-edit.1.html \
172         html/virt-inspector.1.html \
173         html/virt-list-filesystems.1.html \
174         html/virt-ls.1.html \
175         html/virt-rescue.1.html \
176         html/virt-tar.1.html \
177         html/virt-win-reg.1.html \
178         html/recipes.html \
179         html/pod.css html/recipes.css
180
181 TEXTFILES = README TODO HACKING
182
183 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
184
185 website: $(HTMLFILES) $(TEXTFILES)
186         cp $(HTMLFILES) $(WEBSITEDIR)
187         for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
188         cd $(WEBSITEDIR) && \
189         date=`date +%F`; \
190         sed -e "s/SUBST_VERSION/$(VERSION)/" \
191             -e "s/SUBST_DATE/$$date/" \
192         < index.html.in > index.html
193
194 # Generate the ChangeLog automatically from the gitlog.
195
196 dist-hook:
197         $(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
198         cp ChangeLog $(distdir)/ChangeLog
199
200 # Update the list of translatable files in po/POTFILES.in.
201 all-local:
202         cd $(srcdir); \
203         find $(DIST_SUBDIRS) \
204             -name '*.c' -o -name '*.pl' -o -name '*.pm' -o \
205             -name 'virt-cat' -o \
206             -name 'virt-df' -o \
207             -name 'virt-edit' -o \
208             -name 'virt-inspector' -o \
209             -name 'virt-list-filesystems' -o \
210             -name 'virt-ls' -o \
211             -name 'virt-rescue' -o \
212             -name 'virt-tar' -o \
213             -name 'virt-win-reg' | \
214         grep -v '^perl/blib/' | \
215         grep -v '^capitests/' | \
216         grep -v '^daemon/lib/' | \
217         grep -v '^daemon/tests/' | \
218         grep -v '^examples/' | \
219         grep -v '^gnulib/' | \
220         grep -v '^perl/examples/' | \
221         grep -v '/guestfs_protocol.c' | \
222         grep -v '/rc_protocol.c' | \
223         grep -v 'appliance/debian/root' | \
224         LC_ALL=C sort | \
225         sed 's,^\./,,' > po/POTFILES.in
226
227 # Pkgconfig.
228
229 pkgconfigdir = $(libdir)/pkgconfig
230 pkgconfig_DATA = libguestfs.pc
231
232 # Make clean.
233
234 CLEANFILES = $(fs_DATA) \
235         emptydisk \
236         pod2htm?.tmp \
237         html/*.html \
238         guestfs.3 guestfish.1
239
240 clean-local:
241         rm -rf initramfs