Mac OS X: Use gnulib setenv module explicitly.
[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 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 EXTRA_DIST = \
60         $(generator_built) \
61         html/pod.css \
62         HACKING TODO \
63         libguestfs.pc libguestfs.pc.in \
64         recipes/LICENSE \
65         recipes/README \
66         recipes/*.html \
67         recipes/*.sh \
68         recipes/*.example \
69         html/recipes.css \
70         make-recipes.sh \
71         contrib/README \
72         bindtests \
73         .gitignore \
74         m4/.gitignore
75
76 # HTML versions of manual pages.
77
78 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
79
80 html/guestfs.3.html: src/guestfs.pod \
81                 src/guestfs-actions.pod \
82                 src/guestfs-availability.pod \
83                 src/guestfs-structs.pod
84         mkdir -p html
85         sed \
86           -e '/@ACTIONS@/rsrc/guestfs-actions.pod' \
87           -e 's/@ACTIONS@//' \
88           -e '/@AVAILABILITY@/rsrc/guestfs-availability.pod' \
89           -e 's/@AVAILABILITY@//' \
90           -e '/@STRUCTS@/rsrc/guestfs-structs.pod' \
91           -e 's/@STRUCTS@//' \
92           < $< | \
93         pod2html \
94           --css 'pod.css' \
95           --title "libguestfs API documentation" \
96           --htmldir html \
97           --outfile $@
98
99 html/guestfish.1.html: fish/guestfish.pod fish/guestfish-actions.pod
100         mkdir -p html
101         sed \
102           -e '/@ACTIONS@/rfish/guestfish-actions.pod' -e 's/@ACTIONS@//' \
103           < $< | \
104         pod2html \
105           --css 'pod.css' \
106           --title "guestfish, libguestfs filesystem interactive shell" \
107           --htmldir html \
108           --outfile $@
109
110 # Recipes web page.
111 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
112         mkdir -p html
113         rm -f $@ $@-t
114         sh make-recipes.sh recipes/*.sh > $@-t
115         mv $@-t $@
116
117 HTMLFILES = \
118         html/guestfs.3.html \
119         html/guestfish.1.html \
120         html/guestmount.1.html \
121         html/virt-cat.1.html \
122         html/virt-df.1.html \
123         html/virt-edit.1.html \
124         html/virt-inspector.1.html \
125         html/virt-list-filesystems.1.html \
126         html/virt-ls.1.html \
127         html/virt-rescue.1.html \
128         html/virt-tar.1.html \
129         html/virt-win-reg.1.html \
130         html/recipes.html \
131         html/pod.css html/recipes.css
132
133 TEXTFILES = README TODO HACKING
134
135 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
136
137 website: $(HTMLFILES) $(TEXTFILES)
138         cp $(HTMLFILES) $(WEBSITEDIR)
139         for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
140         cd $(WEBSITEDIR) && \
141         date=`date +%F`; \
142         sed -e "s/SUBST_VERSION/$(VERSION)/" \
143             -e "s/SUBST_DATE/$$date/" \
144         < index.html.in > index.html
145
146 # Generate the ChangeLog automatically from the gitlog.
147
148 dist-hook:
149         $(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
150         cp ChangeLog $(distdir)/ChangeLog
151
152 # Update the list of translatable files in po/POTFILES.in.
153 all-local:
154         cd $(srcdir); \
155         find $(DIST_SUBDIRS) \
156             -name '*.c' -o -name '*.pl' -o -name '*.pm' -o \
157             -name 'virt-cat' -o \
158             -name 'virt-df' -o \
159             -name 'virt-edit' -o \
160             -name 'virt-inspector' -o \
161             -name 'virt-list-filesystems' -o \
162             -name 'virt-ls' -o \
163             -name 'virt-rescue' -o \
164             -name 'virt-tar' -o \
165             -name 'virt-win-reg' | \
166         grep -v '^perl/blib/' | \
167         grep -v '^capitests/' | \
168         grep -v '^daemon/lib/' | \
169         grep -v '^daemon/tests/' | \
170         grep -v '^examples/' | \
171         grep -v '^gnulib/' | \
172         grep -v '^perl/examples/' | \
173         grep -v '/guestfs_protocol.c' | \
174         grep -v '/rc_protocol.c' | \
175         grep -v 'appliance/debian/root' | \
176         LC_ALL=C sort | \
177         sed 's,^\./,,' > po/POTFILES.in
178
179 # Pkgconfig.
180
181 pkgconfigdir = $(libdir)/pkgconfig
182 pkgconfig_DATA = libguestfs.pc
183
184 # Make clean.
185
186 CLEANFILES = $(fs_DATA) \
187         emptydisk \
188         pod2htm?.tmp \
189         html/*.html \
190         guestfs.3 guestfish.1
191
192 clean-local:
193         rm -rf initramfs
194
195 # If you don't want to run all of the tests ('make check') then this
196 # will just run libguestfs-test-tool for a quick check.  Note this
197 # is NOT a substitute for proper testing!
198
199 quickcheck:
200         LIBGUESTFS_PATH=appliance \
201         test-tool/libguestfs-test-tool \
202           --helper test-tool/libguestfs-test-tool-helper