Initial commit.
[virt-resize-ui.git] / Makefile.am
1 # Virt resize UI.
2 # Copyright (C) 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         config.ml.in \
23         .gitignore \
24         virt-resize-ui.pod \
25         virt-resize-ui.1 \
26         html/pod.css
27
28 CLEANFILES = *.cmi *.cmo *.cmx *.cmxa *.o virt-resize-ui *~
29
30 # These are listed here in alphabetical order.
31 SOURCES = \
32         config.mli \
33         destination_tab.mli \
34         destination_tab.ml \
35         logvols_tab.mli \
36         logvols_tab.ml \
37         main.ml \
38         partitions_tab.mli \
39         partitions_tab.ml \
40         slave.mli \
41         slave.ml \
42         slave_types.mli \
43         slave_types.ml \
44         source_tab.mli \
45         source_tab.ml \
46         utils.mli \
47         utils.ml \
48         window.ml \
49         window.mli
50
51 BUILT_SOURCES = \
52         config.ml
53
54 # Note this list must be in dependency order.
55 OBJECTS = \
56         config.cmo \
57         utils.cmo \
58         slave_types.cmo \
59         slave.cmo \
60         source_tab.cmo \
61         destination_tab.cmo \
62         partitions_tab.cmo \
63         logvols_tab.cmo \
64         window.cmo \
65         main.cmo
66
67 XOBJECTS = $(OBJECTS:.cmo=.cmx)
68
69 bin_SCRIPTS = virt-resize-ui
70
71 OCAMLPACKAGES = \
72         -package threads,libvirt,guestfs,lablgtk2,extlib
73 OCAMLCFLAGS = \
74         -g \
75         -warn-error CDEFLMPSUVYZX \
76         -thread \
77         $(OCAMLPACKAGES) \
78         -predicates threads
79 OCAMLOPTFLAGS = \
80         -ccopt -g \
81         $(OCAMLCFLAGS)
82 OCAMLDOCFLAGS = \
83         $(OCAMLPACKAGES) \
84         -predicates threads \
85         -I +threads \
86         -sort -html
87
88 if HAVE_OCAMLOPT
89 virt-resize-ui: $(XOBJECTS)
90         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
91           -predicates init,threads \
92           -linkpkg gtkThread.cmx \
93           $^ -o $@
94 else
95 virt-resize-ui: $(OBJECTS)
96         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
97           -predicates init,threads \
98           -linkpkg gtkThread.cmo \
99           $^ -o $@
100 endif
101
102 .mli.cmi:
103         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
104 .ml.cmo:
105         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
106 .ml.cmx:
107         $(OCAMLFIND) ocamlopt $(OCAMLCFLAGS) -c $< -o $@
108
109 # Man page.
110 man_MANS = virt-resize-ui.1
111
112 if HAVE_PERLDOC
113
114 virt-resize-ui.1: virt-resize-ui.pod
115         pod2man \
116           --section 1 \
117           -c "Virtualization Support" \
118           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
119           $< > $@
120
121 noinst_DATA = \
122         html/virt-resize-ui.1.html
123
124 html/virt-resize-ui.1.html: virt-resize-ui.pod
125         mkdir -p html
126         pod2html \
127           --css 'pod.css' \
128           --htmldir html \
129           --outfile html/virt-resize-ui.1.html \
130           virt-resize-ui.pod
131
132 endif
133
134 # Maintainer website update.
135 HTMLFILES = \
136         html/virt-resize-ui.1.html
137
138 WEBSITEDIR = $(HOME)/d/redhat/websites/libguestfs
139
140 website: $(HTMLFILES)
141         cp $(HTMLFILES) $(WEBSITEDIR)
142
143 CLEANFILES += $(HTMLFILES) pod2*.tmp
144
145 # Convert internal documentation to HTML.
146 docs:
147         rm -rf doc
148         mkdir -p doc
149         $(OCAMLFIND) ocamldoc -d doc $(OCAMLDOCFLAGS) $(SOURCES)
150
151 # Dependencies.
152 depend: .depend
153
154 .depend: $(wildcard *.mli) $(wildcard *.ml)
155         $(OCAMLFIND) ocamldep $(OCAMLPACKAGES) $^ | \
156           $(SED) -e 's/ *$$//' | \
157           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
158           LANG=C sort > $@-t
159         mv $@-t $@
160
161 include .depend
162
163 .PHONY: depend docs