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