Readd node: allow changed primary IP
[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_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
15 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
16 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
17 CHECK_MAN = $(top_srcdir)/autotools/check-man
18 REPLACE_VARS_SED = autotools/replace_vars.sed
19
20 hypervisordir = $(pkgpythondir)/hypervisor
21 httpdir = $(pkgpythondir)/http
22 confddir = $(pkgpythondir)/confd
23 rapidir = $(pkgpythondir)/rapi
24 toolsdir = $(pkglibdir)/tools
25 docdir = $(datadir)/doc/$(PACKAGE)
26
27 # Delete output file if an error occurred while building it
28 .DELETE_ON_ERROR:
29
30 DIRS = \
31         autotools \
32         daemons \
33         devel \
34         doc \
35         doc/examples \
36         doc/examples/hooks \
37         lib \
38         lib/build \
39         lib/http \
40         lib/hypervisor \
41         lib/rapi \
42         lib/confd \
43         man \
44         qa \
45         scripts \
46         test \
47         test/data \
48         tools
49
50 MAINTAINERCLEANFILES = \
51         $(docpng) \
52         $(maninput) \
53         doc/install-quick.rst \
54         doc/news.rst
55
56 maintainer-clean-local:
57         rm -rf doc/api doc/html doc/coverage
58
59 CLEANFILES = \
60         autotools/replace_vars.sed \
61         daemons/daemon-util \
62         daemons/ganeti-cleaner \
63         devel/upload \
64         doc/examples/bash_completion \
65         doc/examples/ganeti.initd \
66         doc/examples/ganeti.cron \
67         doc/examples/gnt-config-backup \
68         doc/examples/hooks/ipsec \
69         lib/*.py[co] \
70         lib/build/*.py[co] \
71         lib/http/*.py[co] \
72         lib/hypervisor/*.py[co] \
73         lib/rapi/*.py[co] \
74         $(man_MANS) \
75         $(manhtml) \
76         qa/*.py[co] \
77         test/*.py[co] \
78         stamp-directories \
79         stamp-srclinks \
80         $(nodist_pkgpython_PYTHON)
81
82 BUILT_SOURCES = \
83         ganeti \
84         stamp-srclinks \
85         stamp-directories \
86         lib/_autoconf.py
87
88 nodist_pkgpython_PYTHON = \
89         lib/_autoconf.py
90
91 noinst_PYTHON = \
92         lib/build/__init__.py
93
94 pkgpython_PYTHON = \
95         lib/__init__.py \
96         lib/asyncnotifier.py \
97         lib/backend.py \
98         lib/bdev.py \
99         lib/bootstrap.py \
100         lib/cli.py \
101         lib/cmdlib.py \
102         lib/config.py \
103         lib/constants.py \
104         lib/daemon.py \
105         lib/errors.py \
106         lib/jqueue.py \
107         lib/jstore.py \
108         lib/locking.py \
109         lib/luxi.py \
110         lib/mcpu.py \
111         lib/objects.py \
112         lib/opcodes.py \
113         lib/rpc.py \
114         lib/serializer.py \
115         lib/ssconf.py \
116         lib/ssh.py \
117         lib/storage.py \
118         lib/utils.py \
119         lib/uidpool.py \
120         lib/workerpool.py
121
122 hypervisor_PYTHON = \
123         lib/hypervisor/__init__.py \
124         lib/hypervisor/hv_base.py \
125         lib/hypervisor/hv_chroot.py \
126         lib/hypervisor/hv_fake.py \
127         lib/hypervisor/hv_kvm.py \
128         lib/hypervisor/hv_xen.py
129
130 rapi_PYTHON = \
131         lib/rapi/__init__.py \
132         lib/rapi/baserlib.py \
133         lib/rapi/client.py \
134         lib/rapi/connector.py \
135         lib/rapi/rlib2.py
136
137 http_PYTHON = \
138         lib/http/__init__.py \
139         lib/http/auth.py \
140         lib/http/client.py \
141         lib/http/server.py
142
143 confd_PYTHON = \
144         lib/confd/__init__.py \
145         lib/confd/client.py \
146         lib/confd/server.py \
147         lib/confd/querylib.py
148
149 docrst = \
150         doc/admin.rst \
151         doc/design-2.0.rst \
152         doc/design-2.1.rst \
153         doc/devnotes.rst \
154         doc/glossary.rst \
155         doc/hooks.rst \
156         doc/iallocator.rst \
157         doc/index.rst \
158         doc/install-quick.rst \
159         doc/install.rst \
160         doc/locking.rst \
161         doc/news.rst \
162         doc/rapi.rst \
163         doc/security.rst \
164         doc/walkthrough.rst
165
166 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
167         @test -n "$(SPHINX)" || \
168             { echo 'sphinx-build' not found during configure; exit 1; }
169         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
170             -d . \
171             -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
172             -D release="$(PACKAGE_VERSION)" \
173             $(abs_top_srcdir)/doc $(CURDIR)/doc/html
174         rm -f doc/html/.buildinfo doc/html/objects.inv
175         touch $@
176
177 doc/html: doc/html/.stamp
178
179 doc/news.rst: NEWS
180         set -e; \
181         { echo '.. This file is automatically updated at build time from $<.'; \
182           echo '.. Do not edit.'; \
183           echo; \
184           cat $<; \
185         } > $@
186
187 doc/install-quick.rst: INSTALL
188         set -e; \
189         { echo '.. This file is automatically updated at build time from $<.'; \
190           echo '.. Do not edit.'; \
191           echo; \
192           cat $<; \
193         } > $@
194
195 docdot = \
196         doc/arch-2.0.dot \
197         doc/design-2.1-lock-acquire.dot \
198         doc/design-2.1-lock-release.dot
199
200 docpng = $(patsubst %.dot,%.png,$(docdot))
201
202 # Things to build but not to install (add it to EXTRA_DIST if it should be
203 # distributed)
204 noinst_DATA = \
205         devel/upload \
206         doc/html \
207         doc/examples/bash_completion \
208         doc/examples/ganeti.cron \
209         doc/examples/ganeti.initd \
210         doc/examples/gnt-config-backup \
211         doc/examples/hooks/ipsec \
212         $(manhtml)
213
214 gnt_scripts = \
215         scripts/gnt-backup \
216         scripts/gnt-cluster \
217         scripts/gnt-debug \
218         scripts/gnt-instance \
219         scripts/gnt-job \
220         scripts/gnt-node \
221         scripts/gnt-os
222
223 dist_sbin_SCRIPTS = \
224         daemons/ganeti-noded \
225         daemons/ganeti-watcher \
226         daemons/ganeti-masterd \
227         daemons/ganeti-confd \
228         daemons/ganeti-rapi \
229         $(gnt_scripts)
230
231 nodist_sbin_SCRIPTS = \
232         daemons/ganeti-cleaner
233
234 dist_tools_SCRIPTS = \
235         tools/burnin \
236         tools/cfgshell \
237         tools/cfgupgrade \
238         tools/cfgupgrade12 \
239         tools/cluster-merge \
240         tools/lvmstrap \
241         tools/sanitize-config
242
243 pkglib_SCRIPTS = \
244         daemons/daemon-util
245
246 EXTRA_DIST = \
247         NEWS \
248         pylintrc \
249         autotools/build-bash-completion \
250         autotools/check-python-code \
251         autotools/check-man \
252         autotools/docbook-wrapper \
253         autotools/gen-coverage \
254         autotools/testrunner \
255         $(RUN_IN_TEMPDIR) \
256         daemons/daemon-util.in \
257         daemons/ganeti-cleaner.in \
258         devel/upload.in \
259         $(docdot) \
260         $(docpng) \
261         $(docrst) \
262         doc/conf.py \
263         doc/html \
264         doc/examples/ganeti.initd.in \
265         doc/examples/ganeti.cron.in \
266         doc/examples/gnt-config-backup.in \
267         doc/examples/dumb-allocator \
268         doc/examples/ganeti.default \
269         doc/examples/ganeti.default-debug \
270         doc/examples/hooks/ethers \
271         doc/examples/hooks/ipsec.in \
272         test/testutils.py \
273         test/mocks.py \
274         $(dist_TESTS) \
275         $(TEST_FILES) \
276         man/footer.sgml \
277         $(mansgml) \
278         $(maninput) \
279         qa/ganeti-qa.py \
280         qa/qa-sample.json \
281         qa/qa_cluster.py \
282         qa/qa_config.py \
283         qa/qa_daemon.py \
284         qa/qa_env.py \
285         qa/qa_error.py \
286         qa/qa_instance.py \
287         qa/qa_node.py \
288         qa/qa_os.py \
289         qa/qa_rapi.py \
290         qa/qa_tags.py \
291         qa/qa_utils.py
292
293 man_MANS = \
294         man/ganeti.7 \
295         man/ganeti-cleaner.8 \
296         man/ganeti-confd.8 \
297         man/ganeti-masterd.8 \
298         man/ganeti-noded.8 \
299         man/ganeti-os-interface.7 \
300         man/ganeti-rapi.8 \
301         man/ganeti-watcher.8 \
302         man/gnt-backup.8 \
303         man/gnt-cluster.8 \
304         man/gnt-debug.8 \
305         man/gnt-instance.8 \
306         man/gnt-job.8 \
307         man/gnt-node.8 \
308         man/gnt-os.8
309
310 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
311 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
312 maninput = \
313         $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
314         $(patsubst %.html,%.html.in,$(manhtml))
315
316 TEST_FILES = \
317         test/data/bdev-both.txt \
318         test/data/bdev-8.3-both.txt \
319         test/data/bdev-disk.txt \
320         test/data/bdev-net.txt \
321         test/data/cert1.pem \
322         test/data/proc_drbd8.txt \
323         test/data/proc_drbd80-emptyline.txt \
324         test/data/proc_drbd83.txt
325
326 python_tests = \
327         test/ganeti.bdev_unittest.py \
328         test/ganeti.cli_unittest.py \
329         test/ganeti.cmdlib_unittest.py \
330         test/ganeti.confd.client_unittest.py \
331         test/ganeti.config_unittest.py \
332         test/ganeti.constants_unittest.py \
333         test/ganeti.errors_unittest.py \
334         test/ganeti.hooks_unittest.py \
335         test/ganeti.http_unittest.py \
336         test/ganeti.locking_unittest.py \
337         test/ganeti.mcpu_unittest.py \
338         test/ganeti.objects_unittest.py \
339         test/ganeti.opcodes_unittest.py \
340         test/ganeti.rapi.client_unittest.py \
341         test/ganeti.rapi.resources_unittest.py \
342         test/ganeti.serializer_unittest.py \
343         test/ganeti.ssh_unittest.py \
344         test/ganeti.uidpool_unittest.py \
345         test/ganeti.utils_unittest.py \
346         test/ganeti.workerpool_unittest.py \
347         test/docs_unittest.py \
348         test/tempfile_fork_unittest.py
349
350 dist_TESTS = \
351         test/daemon-util_unittest.bash \
352         $(python_tests)
353
354 nodist_TESTS =
355
356 TESTS = $(dist_TESTS) $(nodist_TESTS)
357
358 # Environment for all tests
359 PLAIN_TESTS_ENVIRONMENT = \
360         PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
361
362 # Environment for tests run by automake
363 TESTS_ENVIRONMENT = \
364         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
365
366 all_python_code = \
367         $(dist_sbin_SCRIPTS) \
368         $(dist_tools_SCRIPTS) \
369         $(python_tests) \
370         $(pkgpython_PYTHON) \
371         $(hypervisor_PYTHON) \
372         $(rapi_PYTHON) \
373         $(http_PYTHON) \
374         $(confd_PYTHON) \
375         $(noinst_PYTHON)
376
377 srclink_files = \
378         man/footer.sgml \
379         test/daemon-util_unittest.bash \
380         $(all_python_code)
381
382 check_python_code = \
383         $(BUILD_BASH_COMPLETION) \
384         $(all_python_code)
385
386 lint_python_code = \
387         ganeti \
388         $(dist_sbin_SCRIPTS) \
389         $(dist_tools_SCRIPTS) \
390         $(BUILD_BASH_COMPLETION)
391
392 test/daemon-util_unittest.bash: daemons/daemon-util
393
394 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
395         sed -f $(REPLACE_VARS_SED) < $< > $@
396         chmod u+x $@
397
398 daemons/%: daemons/%.in \
399                 $(REPLACE_VARS_SED)
400         sed -f $(REPLACE_VARS_SED) < $< > $@
401         chmod +x $@
402
403 doc/examples/%: doc/examples/%.in \
404                 $(REPLACE_VARS_SED)
405         sed -f $(REPLACE_VARS_SED) < $< > $@
406
407 doc/examples/hooks/%: doc/examples/hooks/%.in \
408                 $(REPLACE_VARS_SED)
409         sed -f $(REPLACE_VARS_SED) < $< > $@
410
411 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
412         lib/cli.py $(gnt_scripts) tools/burnin
413         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
414
415 doc/%.png: doc/%.dot
416         @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
417         $(DOT) -Tpng -o $@ $<
418
419 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
420         @test -n "$(DOCBOOK2MAN)" || \
421           { echo 'docbook2man' not found during configure; exit 1; }
422         $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
423         $(CHECK_MAN) $@
424
425 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
426         @test -n "$(DOCBOOK2HTML)" || \
427           { echo 'docbook2html' not found during configure; exit 1; }
428         $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
429
430 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
431         sed -f $(REPLACE_VARS_SED) < $< > $@
432
433 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
434         sed -f $(REPLACE_VARS_SED) < $< > $@
435         $(CHECK_MAN) $@
436
437 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
438         sed -f $(REPLACE_VARS_SED) < $< > $@
439
440 lib/_autoconf.py: Makefile stamp-directories
441         set -e; \
442         { echo '# This file is automatically generated, do not edit!'; \
443           echo '#'; \
444           echo ''; \
445           echo '"""Build-time configuration for Ganeti.'; \
446           echo '';\
447           echo 'This file is autogenerated by the build process.'; \
448           echo 'For any changes you need to re-run ./configure (and'; \
449           echo 'not edit by hand).'; \
450           echo ''; \
451           echo '"""'; \
452           echo ''; \
453           echo '# pylint: disable-msg=C0301,C0324'; \
454           echo '# because this is autogenerated, we do not want'; \
455           echo '# style warnings' ; \
456           echo ''; \
457           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
458           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
459           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
460           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
461           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
462           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
463           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
464           echo "SYSCONFDIR = '$(sysconfdir)'"; \
465           echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
466           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
467           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
468           echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
469           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
470           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
471           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
472           echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
473           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
474           echo "KVM_PATH = '$(KVM_PATH)'"; \
475           echo "SOCAT_PATH = '$(SOCAT)'"; \
476           echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
477           echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
478           echo "TOOLSDIR = '$(toolsdir)'"; \
479           echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
480           echo "PKGLIBDIR = '$(pkglibdir)'"; \
481           echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
482           echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
483         } > $@
484
485 $(REPLACE_VARS_SED): Makefile
486         set -e; \
487         { echo 's#@PREFIX@#$(prefix)#g'; \
488           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
489           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
490           echo 's#@BINDIR@#$(bindir)#g'; \
491           echo 's#@SBINDIR@#$(sbindir)#g'; \
492           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
493           echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
494           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
495           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
496           echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
497           echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
498           echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
499         } > $@
500
501 # We need to create symlinks because "make distcheck" will not install Python
502 # files when building.
503 stamp-srclinks: Makefile stamp-directories
504         set -e; \
505         for i in $(srclink_files); do \
506                 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
507                         $(LN_S) $(abs_top_srcdir)/$$i $$i; \
508                 fi; \
509         done
510         touch $@
511
512 .PHONY: ganeti
513 ganeti:
514         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
515
516 check-local:
517         $(CHECK_PYTHON_CODE) $(check_python_code)
518
519 .PHONY: lint
520 lint: ganeti $(BUILT_SOURCES)
521         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
522         $(PYLINT) $(LINT_OPTS) $(lint_python_code)
523
524 # a dist hook rule for catching revision control directories
525 distcheck-hook:
526         if find $(top_distdir) -name .svn -or -name .git | grep .; then \
527                 echo "Found revision control files in final archive." 1>&2; \
528                 exit 1; \
529         fi
530         if find $(top_distdir) -name '*.py[co]' | grep .; then \
531                 echo "Found Python byte code in final archive." 1>&2; \
532                 exit 1; \
533         fi
534         if find $(top_distdir) -name '*~' | grep .; then \
535                 echo "Found backup files in final archive." 1>&2; \
536                 exit 1; \
537         fi
538
539 install-exec-local:
540         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
541           "$(DESTDIR)${localstatedir}/log/ganeti" \
542           "$(DESTDIR)${localstatedir}/run/ganeti"
543
544 stamp-directories: Makefile
545         @mkdir_p@ $(DIRS)
546         touch $@
547
548 .PHONY: apidoc
549 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
550         test -e doc/api || mkdir doc/api
551         $(RUN_IN_TEMPDIR) epydoc -v \
552                 --conf $(CURDIR)/epydoc.conf \
553                 --output $(CURDIR)/doc/api
554
555 .PHONY: TAGS
556 TAGS: $(BUILT_SOURCES)
557         rm -f TAGS
558         find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
559           -path 'daemons/ganeti-*' -o -path 'tools/*' | \
560           etags -
561
562 .PHONY: coverage
563 coverage: $(BUILT_SOURCES) $(python_tests)
564         set -e; \
565         mkdir -p doc/coverage; \
566         COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
567         TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
568         HTML_COVERAGE=$(CURDIR)/doc/coverage \
569         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
570         $(python_tests)
571
572 # vim: set noet :