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