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