17adf1ca09acd03656d59771f9572e127d6067f5
[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 = src daemon appliance fish po examples images
21
22 if HAVE_OCAML
23 SUBDIRS += ocaml
24 endif
25 if HAVE_PERL
26 SUBDIRS += perl
27 endif
28 if HAVE_PYTHON
29 SUBDIRS += python
30 endif
31 if HAVE_RUBY
32 SUBDIRS += ruby
33 endif
34 if HAVE_JAVA
35 SUBDIRS += java
36 endif
37 if HAVE_HASKELL
38 SUBDIRS += haskell
39 endif
40 if HAVE_INSPECTOR
41 SUBDIRS += inspector
42 endif
43
44 EXTRA_DIST = \
45         config.rpath \
46         guestfs.pod guestfs-actions.pod guestfs-structs.pod \
47         guestfish.pod guestfish-actions.pod \
48         html/pod.css \
49         HACKING TODO \
50         tests.c \
51         libguestfs.pc libguestfs.pc.in \
52         gitlog-to-changelog \
53         recipes/LICENSE \
54         recipes/README \
55         recipes/*.html \
56         recipes/*.sh \
57         recipes/*.example \
58         html/recipes.css \
59         make-recipes.sh \
60         test-cleanup.sh \
61         contrib/README \
62         contrib/febootstrap/install.title \
63         contrib/febootstrap/install.html \
64         contrib/febootstrap/install.sh \
65         test-bootbootboot.sh
66
67 # Tests.  These are auto-generated from the test descriptions
68 # in the generator.
69
70 check_PROGRAMS = tests test-command
71
72 tests_SOURCES = tests.c
73 tests_CFLAGS = \
74         -I$(top_builddir)/src -Wall
75 tests_LDADD = $(top_builddir)/src/libguestfs.la
76
77 TESTS = tests test-bootbootboot.sh
78 TESTS_ENVIRONMENT = \
79         SKIP_TEST_COMMAND=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
80         SKIP_TEST_COMMAND_LINES=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
81         SKIP_TEST_ZEROFREE=$(shell test -x initramfs/usr/sbin/zerofree || echo 1) \
82         $(VG)
83
84 # Run the tests under valgrind.
85
86 valgrind:
87         $(MAKE) check VG="valgrind --quiet --leak-check=full"
88
89 # This binary must be statically linked.  It is used for testing
90 # the "guestfs_command" and "guestfs_command_lines" functions.
91
92 test_command_SOURCES = test-command.c
93 test_command_LDFLAGS = -all-static
94
95 # Manual pages.
96 # guestfs-actions.pod and guestfs-structs are autogenerated.  There is
97 # no include mechanism for POD, so we have to do it by hand.
98
99 man_MANS = guestfs.3 guestfish.1
100
101 guestfs.3: guestfs.pod guestfs-actions.pod guestfs-structs.pod
102         sed \
103           -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
104           -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
105           < $< | \
106         $(POD2MAN) \
107           --section 3 \
108           -c "Virtualization Support" \
109           --name "guestfs" \
110           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
111           > $@
112
113 guestfish.1: guestfish.pod guestfish-actions.pod
114         sed \
115           -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
116           < $< | \
117         $(POD2MAN) \
118           --section 1 \
119           -c "Virtualization Support" \
120           --name "guestfish" \
121           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
122           > $@
123
124 noinst_DATA = html/guestfs.3.html html/guestfish.1.html
125
126 html/guestfs.3.html: guestfs.pod guestfs-actions.pod guestfs-structs.pod
127         sed \
128           -e '/@ACTIONS@/rguestfs-actions.pod' -e 's/@ACTIONS@//' \
129           -e '/@STRUCTS@/rguestfs-structs.pod' -e 's/@STRUCTS@//' \
130           < $< | \
131         pod2html \
132           --css 'pod.css' \
133           --title "libguestfs API documentation" \
134           --htmldir html \
135           --outfile $@
136
137 html/guestfish.1.html: guestfish.pod guestfish-actions.pod
138         sed \
139           -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
140           < $< | \
141         pod2html \
142           --css 'pod.css' \
143           --title "guestfish, libguestfs filesystem interactive shell" \
144           --htmldir html \
145           --outfile $@
146
147 # Recipes web page.
148 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
149         rm -f $@ $@-t
150         sh make-recipes.sh recipes/*.sh > $@-t
151         mv $@-t $@
152
153 HTMLFILES = html/guestfs.3.html html/guestfish.1.html \
154         html/virt-inspector.1.html \
155         html/recipes.html \
156         html/pod.css html/recipes.css
157
158 TEXTFILES = README TODO HACKING
159
160 WEBSITEDIR = $(HOME)/d/redhat/et-website/libguestfs
161
162 website: $(HTMLFILES) $(TEXTFILES)
163         cp $(HTMLFILES) $(WEBSITEDIR)
164         for f in $(TEXTFILES); do cp $$f $(WEBSITEDIR)/$$f.txt; done
165
166 # Generate the ChangeLog automatically from the gitlog.
167
168 dist-hook:
169         ./gitlog-to-changelog > ChangeLog
170         cp ChangeLog $(distdir)/ChangeLog
171
172 # Pkgconfig.
173
174 pkgconfigdir = $(libdir)/pkgconfig
175 pkgconfig_DATA = libguestfs.pc
176
177 # Make clean.
178
179 CLEANFILES = $(fs_DATA) emptydisk pod2htm?.tmp
180
181 clean-local:
182         rm -rf initramfs