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