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