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