df6a721f36805b21490e97df2b5289eb22dacd60
[guestfs-browser.git] / Makefile.am
1 # Guestfs Browser.
2 # Copyright (C) 2010-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 along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 ACLOCAL_AMFLAGS = -I m4
19
20 EXTRA_DIST = \
21         $(SOURCES) \
22         HACKING \
23         Throbber.png Throbber.gif \
24         .gitignore \
25         guestfs-browser.pod \
26         guestfs-browser.1 \
27         guestfs-browser.desktop.in \
28         guestfs-browser.png \
29         guestfs-browser-large.png \
30         guestfs-browser.svg \
31         test-desktop-file-validate.sh \
32         html/pod.css
33
34 CLEANFILES = *.cmi *.cmo *.cmx *.cmxa *.o guestfs-browser *~
35
36 TESTS =
37
38 # These are listed here in alphabetical order.
39 SOURCES = \
40         cmdline.mli \
41         cmdline.ml \
42         config.mli \
43         config.ml \
44         deviceSet.mli \
45         deviceSet.ml \
46         filetree.mli \
47         filetree.ml \
48         filetree_markup.mli \
49         filetree_markup.ml \
50         main.ml \
51         op_checksum_file.mli \
52         op_checksum_file.ml \
53         op_copy_regvalue.mli \
54         op_copy_regvalue.ml \
55         op_disk_usage.mli \
56         op_disk_usage.ml \
57         op_download_as_reg.mli \
58         op_download_as_reg.ml \
59         op_download_dir_find0.mli \
60         op_download_dir_find0.ml \
61         op_download_dir_tarball.mli \
62         op_download_dir_tarball.ml \
63         op_download_file.mli \
64         op_download_file.ml \
65         op_file_information.mli \
66         op_file_information.ml \
67         op_inspection_dialog.mli \
68         op_inspection_dialog.ml \
69         op_view_file.mli \
70         op_view_file.ml \
71         slave.mli \
72         slave.ml \
73         slave_types.mli \
74         slave_types.ml \
75         slave_utils.mli \
76         slave_utils.ml \
77         throbber.ml \
78         utils.mli \
79         utils.ml \
80         window.mli \
81         window.ml
82
83 # Note this list must be in dependency order.
84 OBJECTS = \
85         config.cmo \
86         throbber.cmo \
87         utils.cmo \
88         cmdline.cmo \
89         deviceSet.cmo \
90         slave_types.cmo \
91         slave_utils.cmo \
92         slave.cmo \
93         filetree_markup.cmo \
94         filetree.cmo \
95         op_checksum_file.cmo \
96         op_copy_regvalue.cmo \
97         op_disk_usage.cmo \
98         op_download_as_reg.cmo \
99         op_download_dir_find0.cmo \
100         op_download_dir_tarball.cmo \
101         op_download_file.cmo \
102         op_file_information.cmo \
103         op_inspection_dialog.cmo \
104         op_view_file.cmo \
105         window.cmo \
106         main.cmo
107
108 XOBJECTS = $(OBJECTS:.cmo=.cmx)
109
110 bin_SCRIPTS = guestfs-browser
111
112 OCAMLPACKAGES = \
113         -package libvirt,guestfs,hivex,lablgtk2,extlib,xml-light,camomile,threads,bitstring,bitstring.syntax -syntax bitstring
114 OCAMLCFLAGS = \
115         -g \
116         -warn-error CDEFLMPSUVYZX \
117         -thread \
118         $(OCAMLPACKAGES) \
119         -predicates threads
120 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
121 OCAMLDOCFLAGS = \
122         $(OCAMLPACKAGES) \
123         -predicates threads \
124         -I +threads \
125         -sort -html
126
127 if HAVE_OCAMLOPT
128 guestfs-browser: $(XOBJECTS)
129         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
130           -predicates init,threads \
131           -linkpkg gtkThread.cmx \
132           $^ -o $@
133 else
134 guestfs-browser: $(OBJECTS)
135         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
136           -predicates init,threads \
137           -linkpkg gtkThread.cmo \
138           $^ -o $@
139 endif
140
141 # This file is built.  However gdk_pixbuf_mlsource requires X11 to
142 # run, which prevents this from being built in places where an X
143 # display is not available, such as on automated builders.  So we'll
144 # bundle this file in with the tarball anyway.
145 throbber.ml: Throbber.png Throbber.gif
146         $(GDK_PIXBUF_MLSOURCE) --build-list \
147           static Throbber.png \
148           animation Throbber.gif \
149           > $@-t && mv $@-t $@
150
151 .mli.cmi:
152         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
153 .ml.cmo:
154         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
155 .ml.cmx:
156         $(OCAMLFIND) ocamlopt $(OCAMLCFLAGS) -c $< -o $@
157
158 # Icon.
159 icondir = $(datadir)/$(PACKAGE_NAME)/pixmaps
160 icon_DATA = guestfs-browser.svg guestfs-browser-large.png guestfs-browser.png
161
162 # Desktop file.
163 desktopdir = $(datadir)/applications
164 desktop_DATA = guestfs-browser.desktop
165
166 guestfs-browser.desktop: guestfs-browser.desktop.in
167         $(SED) "s,\@icondir\@,$(icondir),g" < $< > $@
168
169 TESTS += test-desktop-file-validate.sh
170
171 # Man page.
172 man_MANS = guestfs-browser.1
173
174 if HAVE_PERLDOC
175
176 guestfs-browser.1: guestfs-browser.pod
177         pod2man \
178           --section 1 \
179           -c "Virtualization Support" \
180           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
181           $< > $@
182
183 noinst_DATA = \
184         html/guestfs-browser.1.html
185
186 html/guestfs-browser.1.html: guestfs-browser.pod
187         mkdir -p html
188         pod2html \
189           --css 'pod.css' \
190           --htmldir html \
191           --outfile html/guestfs-browser.1.html \
192           guestfs-browser.pod
193
194 endif
195
196 # Maintainer website update.
197 HTMLFILES = \
198         html/guestfs-browser.1.html
199
200 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
201
202 website: $(HTMLFILES)
203         cp $(HTMLFILES) $(WEBSITEDIR)
204
205 CLEANFILES += $(HTMLFILES) pod2*.tmp
206
207 # Convert internal documentation to HTML.
208 docs:
209         rm -rf doc
210         mkdir -p doc
211         $(OCAMLFIND) ocamldoc -d doc $(OCAMLDOCFLAGS) $(SOURCES)
212
213 # Dependencies.
214 depend: .depend
215
216 .depend: $(wildcard *.mli) $(wildcard *.ml)
217         rm -f $@ $@-t
218         $(OCAMLFIND) ocamldep $(OCAMLPACKAGES) $^ | \
219           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
220           sort > $@-t
221         mv $@-t $@
222
223 include .depend
224
225 .PHONY: depend docs