cc16b78326e8607ce9177cf156193fa38388b8ec
[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
26 CLEANFILES = *.cmi *.cmo *.cmx *.o guestfs-browser
27
28 # These are listed here in alphabetical order.
29 SOURCES = \
30         config.mli \
31         config.ml \
32         deviceSet.mli \
33         deviceSet.ml \
34         filetree.mli \
35         filetree.ml \
36         main.ml \
37         slave.mli \
38         slave.ml \
39         throbber.ml \
40         utils.mli \
41         utils.ml \
42         window.mli \
43         window.ml
44
45 # Note this list must be in dependency order.
46 OBJECTS = \
47         config.cmx \
48         throbber.cmx \
49         utils.cmx \
50         deviceSet.cmx \
51         slave.cmx \
52         filetree.cmx \
53         window.cmx \
54         main.cmx
55
56 bin_SCRIPTS = guestfs-browser
57
58 OCAMLPACKAGES = libvirt,guestfs,lablgtk2,extlib,xml-light,threads
59 OCAMLCFLAGS = \
60         -g \
61         -warn-error CDEFLMPSUVYZX \
62         -thread \
63         -package $(OCAMLPACKAGES) \
64         -predicates threads
65 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
66 OCAMLDOCFLAGS = \
67         -package $(OCAMLPACKAGES) \
68         -predicates threads \
69         -I +threads \
70         -sort -html
71
72 guestfs-browser: $(OBJECTS)
73         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
74           -predicates init,threads \
75           -linkpkg gtkThread.cmx \
76           $^ -o $@
77
78 # This file is built.  However gdk_pixbuf_mlsource requires X11 to
79 # run, which prevents this from being built in places where an X
80 # display is not available, such as on automated builders.  So we'll
81 # bundle this file in with the tarball anyway.
82 throbber.ml: Throbber.png Throbber.gif
83         $(GDK_PIXBUF_MLSOURCE) --build-list \
84           static Throbber.png \
85           animation Throbber.gif \
86           > $@-t && mv $@-t $@
87
88 .mli.cmi:
89         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
90 .ml.cmo:
91         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
92 .ml.cmx:
93         $(OCAMLFIND) ocamlopt $(OCAMLCFLAGS) -c $< -o $@
94
95 # Convert internal documentation to HTML.
96 docs:
97         rm -rf doc
98         mkdir -p doc
99         $(OCAMLFIND) ocamldoc -d doc $(OCAMLDOCFLAGS) $(SOURCES)
100
101 # Dependencies.
102 depend: .depend
103
104 .depend: $(wildcard *.mli) $(wildcard *.ml)
105         rm -f $@ $@-t
106         $(OCAMLFIND) ocamldep $^ > $@-t
107         mv $@-t $@
108
109 include .depend
110
111 .PHONY: depend docs