Fix mixed pvm/hvm clusters and instance listing
[ganeti-local] / Makefile.am
1 # Ganeti makefile
2 # - Indent with tabs only.
3 # - Keep files sorted; one line per file.
4 # - Directories in lib/ must have their own *dir variable (see hypervisor).
5 # - All directories must be listed DIRS.
6 # - Use autogen.sh to generate Makefile.in and configure script.
7
8 # Automake doesn't export these variables before version 1.10.
9 abs_top_builddir = @abs_top_builddir@
10 abs_top_srcdir = @abs_top_srcdir@
11
12 ACLOCAL_AMFLAGS = -I autotools
13 DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
14 BUILD_RAPI_RESOURCE_DOC = $(top_srcdir)/doc/build-rapi-resources-doc
15 REPLACE_VARS_SED = autotools/replace_vars.sed
16
17 hypervisordir = $(pkgpythondir)/hypervisor
18 httpdir = $(pkgpythondir)/http
19 rapidir = $(pkgpythondir)/rapi
20 toolsdir = $(pkglibdir)/tools
21 docdir = $(datadir)/doc/$(PACKAGE)
22
23 DIRS = \
24         autotools \
25         daemons \
26         devel \
27         doc \
28         doc/examples \
29         lib \
30         lib/http \
31         lib/hypervisor \
32         lib/rapi \
33         man \
34         qa \
35         scripts \
36         test \
37         test/data \
38         tools
39
40 CLEANFILES = \
41         autotools/replace_vars.sed \
42         devel/upload \
43         doc/*.html \
44         doc/*.in \
45         doc/*.pdf \
46         $(patsubst %.dot,%.png,$(docdot)) \
47         doc/rapi-resources.sgml \
48         doc/examples/ganeti.initd \
49         doc/examples/ganeti.cron \
50         lib/*.py[co] \
51         lib/http/*.py[co] \
52         lib/hypervisor/*.py[co] \
53         lib/rapi/*.py[co] \
54         man/*.[78] \
55         man/*.in \
56         man/*.html \
57         qa/*.py[co] \
58         test/*.py[co] \
59         stamp-directories \
60         $(nodist_pkgpython_PYTHON)
61
62 nodist_pkgpython_PYTHON = \
63         lib/_autoconf.py
64
65 pkgpython_PYTHON = \
66         lib/__init__.py \
67         lib/backend.py \
68         lib/bdev.py \
69         lib/bootstrap.py \
70         lib/cli.py \
71         lib/cmdlib.py \
72         lib/config.py \
73         lib/constants.py \
74         lib/daemon.py \
75         lib/errors.py \
76         lib/jqueue.py \
77         lib/jstore.py \
78         lib/locking.py \
79         lib/luxi.py \
80         lib/mcpu.py \
81         lib/objects.py \
82         lib/opcodes.py \
83         lib/rpc.py \
84         lib/serializer.py \
85         lib/ssconf.py \
86         lib/ssh.py \
87         lib/utils.py \
88         lib/workerpool.py
89
90 hypervisor_PYTHON = \
91         lib/hypervisor/__init__.py \
92         lib/hypervisor/hv_base.py \
93         lib/hypervisor/hv_fake.py \
94         lib/hypervisor/hv_kvm.py \
95         lib/hypervisor/hv_xen.py
96
97 rapi_PYTHON = \
98         lib/rapi/__init__.py \
99         lib/rapi/baserlib.py \
100         lib/rapi/connector.py \
101         lib/rapi/rlib2.py
102
103 http_PYTHON = \
104         lib/http/__init__.py \
105         lib/http/auth.py \
106         lib/http/client.py \
107         lib/http/server.py
108
109
110 docsgml = \
111         doc/install.sgml \
112         doc/rapi.sgml
113
114 docrst = \
115         doc/admin.rst \
116         doc/design-2.0.rst \
117         doc/hooks.rst \
118         doc/iallocator.rst \
119         doc/security.rst
120
121 docdot = \
122         doc/arch-2.0.dot
123
124 doc_DATA = \
125         $(patsubst %.rst,%.html,$(docrst)) \
126         $(patsubst %.sgml,%.html,$(docsgml)) \
127         $(patsubst %.sgml,%.pdf,$(docsgml))
128
129 noinst_DATA = $(manhtml)
130
131 dist_sbin_SCRIPTS = \
132         daemons/ganeti-noded \
133         daemons/ganeti-watcher \
134         daemons/ganeti-masterd \
135         daemons/ganeti-rapi \
136         scripts/gnt-backup \
137         scripts/gnt-cluster \
138         scripts/gnt-debug \
139         scripts/gnt-instance \
140         scripts/gnt-job \
141         scripts/gnt-node \
142         scripts/gnt-os
143
144 dist_tools_SCRIPTS = \
145         tools/burnin \
146         tools/cfgshell \
147         tools/cfgupgrade \
148         tools/lvmstrap
149
150 EXTRA_DIST = \
151         NEWS \
152         DEVNOTES \
153         autotools/docbook-wrapper \
154         devel/upload.in \
155         $(docrst) \
156         $(docdot) \
157         $(docsgml) \
158         doc/build-rapi-resources-doc \
159         doc/examples/ganeti.initd.in \
160         doc/examples/ganeti.cron.in \
161         doc/examples/dumb-allocator \
162         doc/locking.txt \
163         test/testutils.py \
164         test/mocks.py \
165         $(dist_TESTS) \
166         $(TEST_FILES) \
167         man/footer.sgml \
168         $(mansgml) \
169         qa/ganeti-qa.py \
170         qa/qa-sample.json \
171         qa/qa_cluster.py \
172         qa/qa_config.py \
173         qa/qa_daemon.py \
174         qa/qa_env.py \
175         qa/qa_error.py \
176         qa/qa_instance.py \
177         qa/qa_node.py \
178         qa/qa_os.py \
179         qa/qa_rapi.py \
180         qa/qa_tags.py \
181         qa/qa_utils.py
182
183 man_MANS = \
184         man/ganeti.7 \
185         man/ganeti-masterd.8 \
186         man/ganeti-noded.8 \
187         man/ganeti-os-interface.7 \
188         man/ganeti-rapi.8 \
189         man/ganeti-watcher.8 \
190         man/gnt-backup.8 \
191         man/gnt-cluster.8 \
192         man/gnt-debug.8 \
193         man/gnt-instance.8 \
194         man/gnt-job.8 \
195         man/gnt-node.8 \
196         man/gnt-os.8
197
198 maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
199 mansgml = $(patsubst %.in,%.sgml,$(maninput))
200 manhtml = $(patsubst %.in,%.html,$(maninput))
201
202 TEST_FILES = \
203         test/data/bdev-both.txt \
204         test/data/bdev-disk.txt \
205         test/data/bdev-net.txt \
206         test/data/proc_drbd8.txt
207
208 dist_TESTS = \
209         test/ganeti.bdev_unittest.py \
210         test/ganeti.cli_unittest.py \
211         test/ganeti.cmdlib_unittest.py \
212         test/ganeti.config_unittest.py \
213         test/ganeti.constants_unittest.py \
214         test/ganeti.hooks_unittest.py \
215         test/ganeti.http_unittest.py \
216         test/ganeti.locking_unittest.py \
217         test/ganeti.rapi.resources_unittest.py \
218         test/ganeti.serializer_unittest.py \
219         test/ganeti.ssh_unittest.py \
220         test/ganeti.utils_unittest.py \
221         test/ganeti.workerpool_unittest.py
222
223 nodist_TESTS =
224
225 TESTS = $(dist_TESTS) $(nodist_TESTS)
226
227 TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
228
229
230 all-local: stamp-directories lib/_autoconf.py devel/upload \
231         doc/examples/ganeti.initd doc/examples/ganeti.cron
232
233 devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
234         sed -f $(REPLACE_VARS_SED) < $< > $@
235         chmod u+x $@
236
237 doc/examples/ganeti.%: doc/examples/ganeti.%.in stamp-directories \
238                 $(REPLACE_VARS_SED)
239         sed -f $(REPLACE_VARS_SED) < $< > $@
240
241 doc/%.in: doc/%.sgml stamp-directories $(REPLACE_VARS_SED)
242         sed -f $(REPLACE_VARS_SED) < $< > $@
243
244 man/%.in: man/%.sgml stamp-directories $(REPLACE_VARS_SED)
245         sed -f $(REPLACE_VARS_SED) < $< > $@
246
247 doc/%.pdf: doc/%.in $(DOCBOOK_WRAPPER)
248         $(DOCBOOK_WRAPPER) "$(DOCBOOK2PDF)" $< $@
249
250 doc/%.html: doc/%.in $(DOCBOOK_WRAPPER)
251         $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $@
252
253 doc/%.html: doc/%.rst
254         $(RST2HTML) $< $@
255
256 doc/%.png: doc/%.dot
257         $(DOT) -Tpng -o $@ $<
258
259 doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png
260
261 doc/rapi.pdf doc/rapi.html doc/rapi.in: doc/rapi-resources.sgml
262
263 doc/rapi-resources.sgml: $(BUILD_RAPI_RESOURCE_DOC) lib/rapi/connector.py
264         PYTHONPATH=.:$(top_builddir) $(BUILD_RAPI_RESOURCE_DOC) > $@ || rm -f $@
265
266 man/%.7: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
267         $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $@
268
269 man/%.8: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
270         $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $@
271
272 man/%.html: man/%.in $(DOCBOOK_WRAPPER)
273         $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $@
274
275 man/footer.sgml $(TESTS): srclinks
276
277 $(TESTS) $(BUILD_RAPI_RESOURCE_DOC): ganeti lib/_autoconf.py
278
279 lib/_autoconf.py: Makefile stamp-directories
280         set -e; \
281         { echo '# This file is automatically generated, do not edit!'; \
282           echo '#'; \
283           echo ''; \
284           echo '"""Build-time configuration for Ganeti.'; \
285           echo '';\
286           echo 'This file is autogenerated by the build process.'; \
287           echo 'For any changes you need to re-run ./configure (and'; \
288           echo 'not edit by hand).'; \
289           echo ''; \
290           echo '"""'; \
291           echo ''; \
292           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
293           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
294           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
295           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
296           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
297           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
298           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
299           echo "SYSCONFDIR = '$(sysconfdir)'"; \
300           echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
301           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
302           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
303           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
304           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
305           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
306           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
307           echo "KVM_PATH = '$(KVM_PATH)'"; \
308           echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
309           echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
310         } > $@
311
312 $(REPLACE_VARS_SED): Makefile stamp-directories
313         set -e; \
314         { echo 's#@PREFIX@#$(prefix)#g'; \
315           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
316           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
317           echo 's#@SBINDIR@#$(sbindir)#g'; \
318           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
319           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
320           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
321           echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
322           echo '/@INCLUDE_RAPI_RESOURCES@/ {'; \
323           echo '  r $(abs_top_builddir)/doc/rapi-resources.sgml'; \
324           echo '  d'; \
325           echo '}'; \
326         } > $@
327
328 # We need to create symlinks because "make distcheck" will not install Python
329 # files when building.
330 #.PHONY: srclinks
331 srclinks: stamp-directories
332         set -e; \
333         for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) \
334                         $(rapi_PYTHON) $(http_PYTHON); do \
335                 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
336                         $(LN_S) $(abs_top_srcdir)/$$i $$i; \
337                 fi; \
338         done
339
340 .PHONY: ganeti
341 ganeti:
342         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
343
344 # a dist hook rule for catching revision control directories
345 distcheck-hook:
346         if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
347                 echo "Found revision control files in final archive" 1>&2 ; \
348                 exit 1; \
349         fi
350
351 install-exec-local:
352         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
353           "$(DESTDIR)${localstatedir}/log/ganeti" \
354           "$(DESTDIR)${localstatedir}/run/ganeti"
355
356 stamp-directories: Makefile
357         @mkdir_p@ $(DIRS)
358         touch $@
359
360 .PHONY: apidoc
361 apidoc:
362         test -e doc/api || mkdir doc/api
363         TMPDIR=`mktemp -d ` && { \
364                 cp -r scripts daemons lib $$TMPDIR && \
365                 ( \
366                         CDIR=`pwd` && \
367                         cd $$TMPDIR && \
368                         mv lib ganeti && \
369                         epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
370                 ) ; \
371                 rm -rf $$TMPDIR ; \
372         }
373
374 # vim: set noet :