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