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