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