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