96c4d3540a59e23922c3f1ff5780e6d2a31c4c4d
[libguestfs.git] / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009-2011 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 # Basic source for the library.
23 SUBDIRS = gnulib/lib images generator src examples po
24
25 if ENABLE_DAEMON
26 SUBDIRS += daemon
27 endif
28 if ENABLE_APPLIANCE
29 SUBDIRS += appliance
30 endif
31
32 # Tests and the test-tool.
33 SUBDIRS += gnulib/tests capitests regressions test-tool
34
35 # Guestfish.
36 SUBDIRS += fish
37
38 # virt-tools in C.
39 SUBDIRS += cat df inspector rescue
40
41 # Language bindings.
42 if HAVE_PERL
43 SUBDIRS += perl perl/examples
44 endif
45 if HAVE_OCAML
46 SUBDIRS += ocaml ocaml/examples
47 endif
48 if HAVE_PYTHON
49 SUBDIRS += python python/examples
50 endif
51 if HAVE_RUBY
52 SUBDIRS += ruby ruby/examples
53 endif
54 if HAVE_JAVA
55 SUBDIRS += java
56 endif
57 if HAVE_HASKELL
58 SUBDIRS += haskell
59 endif
60 if HAVE_PHP
61 SUBDIRS += php
62 endif
63
64 # Unconditional because nothing is built yet.
65 SUBDIRS += csharp
66
67 # Perl tools and guestmount.
68 if HAVE_TOOLS
69 SUBDIRS += tools
70 endif
71
72 if HAVE_FUSE
73 SUBDIRS += fuse
74 endif
75
76 # po-docs must come after tools, inspector.
77 if HAVE_PO4A
78 SUBDIRS += po-docs
79 endif
80
81 EXTRA_DIST = \
82         $(generator_built) \
83         html/pod.css \
84         BUGS HACKING RELEASE-NOTES ROADMAP TODO \
85         libguestfs.pc libguestfs.pc.in \
86         recipes/LICENSE \
87         recipes/README \
88         recipes/*.html \
89         recipes/*.sh \
90         recipes/*.example \
91         html/recipes.css \
92         make-recipes.sh \
93         contrib/README \
94         bindtests \
95         .gitignore \
96         m4/.gitignore \
97         libtool-kill-dependency_libs.sh \
98         autogen.sh \
99         bugs-in-changelog.sh \
100         update-bugs.sh \
101         logo/fish.svg logo/fish.png
102
103 # Recipes web page.
104 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
105         mkdir -p html
106         rm -f $@ $@-t
107         sh make-recipes.sh recipes/*.sh > $@-t
108         mv $@-t $@
109
110 HTMLFILES = \
111         html/guestfs.3.html \
112         html/guestfs-examples.3.html \
113         html/guestfs-ocaml.3.html \
114         html/guestfs-perl.3.html \
115         html/guestfs-python.3.html \
116         html/guestfs-ruby.3.html \
117         html/guestfish.1.html \
118         html/guestmount.1.html \
119         html/virt-cat.1.html \
120         html/virt-copy-in.1.html \
121         html/virt-copy-out.1.html \
122         html/virt-df.1.html \
123         html/virt-edit.1.html \
124         html/virt-filesystems.1.html \
125         html/virt-inspector.1.html \
126         html/virt-list-filesystems.1.html \
127         html/virt-list-partitions.1.html \
128         html/virt-ls.1.html \
129         html/virt-make-fs.1.html \
130         html/virt-rescue.1.html \
131         html/virt-resize.1.html \
132         html/virt-tar.1.html \
133         html/virt-tar-in.1.html \
134         html/virt-tar-out.1.html \
135         html/virt-win-reg.1.html \
136         html/recipes.html \
137         html/pod.css html/recipes.css
138
139 TEXTFILES = BUGS README RELEASE-NOTES ROADMAP TODO
140
141 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
142
143 website: $(HTMLFILES) $(TEXTFILES)
144         cp $(HTMLFILES) $(WEBSITEDIR)
145         for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
146         cd $(WEBSITEDIR) && \
147         date=`date +%F`; \
148         sed -e "s/SUBST_VERSION/$(VERSION)/" \
149             -e "s/SUBST_DATE/$$date/" \
150         < index.html.in > index.html
151
152 # When doing 'make dist' update a few files automatically.
153 dist-hook:
154         $(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
155         cp ChangeLog $(distdir)/ChangeLog
156         $(top_srcdir)/update-bugs.sh > BUGS-t
157         mv BUGS-t BUGS
158         cp BUGS $(distdir)/BUGS
159         git log --pretty="format:%an" | sort -u | \
160                 grep -v rjones | \
161                 grep -v "Richard Jones" \
162                 > AUTHORS-t
163         mv AUTHORS-t AUTHORS
164         cp AUTHORS $(distdir)/AUTHORS
165
166 # Update the list of translatable files in po/POTFILES.in.
167 all-local:
168         cd $(srcdir); \
169         find $(DIST_SUBDIRS) \
170             -name '*.c' -o -name '*.pl' -o -name '*.pm' | \
171         grep -v '^perl/blib/' | \
172         grep -v '^capitests/' | \
173         grep -v '^daemon/lib/' | \
174         grep -v '^daemon/tests/' | \
175         grep -v '^examples/' | \
176         grep -v '^gnulib/' | \
177         grep -v '^perl/examples/' | \
178         grep -v '/guestfs_protocol.c' | \
179         grep -v '/rc_protocol.c' | \
180         grep -v 'appliance/debian/root' | \
181         grep -v '^po-docs/' | \
182         LC_ALL=C sort | \
183         sed 's,^\./,,' > po/POTFILES.in
184
185 # Pkgconfig.
186
187 pkgconfigdir = $(libdir)/pkgconfig
188 pkgconfig_DATA = libguestfs.pc
189
190 # Make clean.
191
192 CLEANFILES = \
193         pod2htm?.tmp \
194         html/*.html
195
196 # If you don't want to run all of the tests ('make check') then this
197 # will just run libguestfs-test-tool for a quick check.  Note this
198 # is NOT a substitute for proper testing!
199
200 quickcheck:
201         test-tool/run-test-tool-locally
202
203 # Make binary distribution.
204
205 BINTMPDIR = /tmp/libguestfs-bin
206 bindist:
207         rm -rf $(BINTMPDIR)
208         mkdir $(BINTMPDIR)
209         $(MAKE)
210         $(MAKE) DESTDIR=$(BINTMPDIR) install
211         -find $(BINTMPDIR) -type d -exec rmdir --ignore-fail-on-non-empty {} \;
212         (cd $(BINTMPDIR) && tar cf - .) | \
213           gzip -c -9 > libguestfs-$(VERSION)-$(DISTRO)-$(host_cpu).tar.gz