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.
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@
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
20 hypervisordir = $(pkgpythondir)/hypervisor
21 httpdir = $(pkgpythondir)/http
22 masterddir = $(pkgpythondir)/masterd
23 confddir = $(pkgpythondir)/confd
24 rapidir = $(pkgpythondir)/rapi
25 impexpddir = $(pkgpythondir)/impexpd
26 toolsdir = $(pkglibdir)/tools
27 docdir = $(datadir)/doc/$(PACKAGE)
29 # Delete output file if an error occurred while building it
54 MAINTAINERCLEANFILES = \
57 doc/install-quick.rst \
60 maintainer-clean-local:
61 rm -rf doc/api doc/html doc/coverage
64 $(addsuffix /*.py[co],$(DIRS)) \
65 autotools/replace_vars.sed \
68 daemons/ganeti-cleaner \
70 doc/examples/bash_completion \
71 doc/examples/ganeti.initd \
72 doc/examples/ganeti.cron \
73 doc/examples/gnt-config-backup \
74 doc/examples/hooks/ipsec \
79 $(nodist_pkgpython_PYTHON)
87 nodist_pkgpython_PYTHON = \
95 lib/asyncnotifier.py \
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
131 lib/rapi/__init__.py \
132 lib/rapi/baserlib.py \
134 lib/rapi/client_utils.py \
135 lib/rapi/connector.py \
139 lib/http/__init__.py \
145 lib/confd/__init__.py \
146 lib/confd/client.py \
147 lib/confd/querylib.py \
151 lib/masterd/__init__.py \
152 lib/masterd/instance.py
155 lib/impexpd/__init__.py
162 doc/design-cluster-merger.rst \
168 doc/install-quick.rst \
171 doc/move-instance.rst \
177 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
178 @test -n "$(SPHINX)" || \
179 { echo 'sphinx-build' not found during configure; exit 1; }
180 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
182 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
183 -D release="$(PACKAGE_VERSION)" \
184 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
185 rm -f doc/html/.buildinfo doc/html/objects.inv
188 doc/html: doc/html/.stamp
192 { echo '.. This file is automatically updated at build time from $<.'; \
193 echo '.. Do not edit.'; \
198 doc/install-quick.rst: INSTALL
200 { echo '.. This file is automatically updated at build time from $<.'; \
201 echo '.. Do not edit.'; \
208 doc/design-2.1-lock-acquire.dot \
209 doc/design-2.1-lock-release.dot
211 docpng = $(patsubst %.dot,%.png,$(docdot))
213 # Things to build but not to install (add it to EXTRA_DIST if it should be
218 doc/examples/bash_completion \
219 doc/examples/ganeti.cron \
220 doc/examples/ganeti.initd \
221 doc/examples/gnt-config-backup \
222 doc/examples/hooks/ipsec \
227 scripts/gnt-cluster \
229 scripts/gnt-instance \
234 dist_sbin_SCRIPTS = \
235 daemons/ganeti-noded \
236 daemons/ganeti-watcher \
237 daemons/ganeti-masterd \
238 daemons/ganeti-confd \
239 daemons/ganeti-rapi \
242 nodist_sbin_SCRIPTS = \
243 daemons/ganeti-cleaner
245 dist_tools_SCRIPTS = \
250 tools/cluster-merge \
252 tools/move-instance \
253 tools/sanitize-config
255 pkglib_python_scripts = \
256 daemons/import-export \
257 tools/check-cert-expired
260 daemons/daemon-util \
261 daemons/ensure-dirs \
262 $(pkglib_python_scripts)
267 autotools/build-bash-completion \
268 autotools/check-python-code \
269 autotools/check-man \
270 autotools/docbook-wrapper \
271 autotools/gen-coverage \
272 autotools/testrunner \
274 daemons/daemon-util.in \
275 daemons/ensure-dirs.in \
276 daemons/ganeti-cleaner.in \
277 $(pkglib_python_scripts) \
284 doc/examples/ganeti.initd.in \
285 doc/examples/ganeti.cron.in \
286 doc/examples/gnt-config-backup.in \
287 doc/examples/dumb-allocator \
288 doc/examples/ganeti.default \
289 doc/examples/ganeti.default-debug \
290 doc/examples/hooks/ethers \
291 doc/examples/hooks/ipsec.in \
315 man/ganeti-cleaner.8 \
317 man/ganeti-masterd.8 \
319 man/ganeti-os-interface.7 \
321 man/ganeti-watcher.8 \
330 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
331 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
333 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
334 $(patsubst %.html,%.html.in,$(manhtml))
337 test/data/bdev-both.txt \
338 test/data/bdev-8.3-both.txt \
339 test/data/bdev-disk.txt \
340 test/data/bdev-net.txt \
341 test/data/cert1.pem \
342 test/data/proc_drbd8.txt \
343 test/data/proc_drbd80-emptyline.txt \
344 test/data/proc_drbd83.txt \
345 test/import-export_unittest-helper
348 test/ganeti.asyncnotifier_unittest.py \
349 test/ganeti.backend_unittest.py \
350 test/ganeti.bdev_unittest.py \
351 test/ganeti.cli_unittest.py \
352 test/ganeti.daemon_unittest.py \
353 test/ganeti.cmdlib_unittest.py \
354 test/ganeti.compat_unittest.py \
355 test/ganeti.confd.client_unittest.py \
356 test/ganeti.config_unittest.py \
357 test/ganeti.constants_unittest.py \
358 test/ganeti.errors_unittest.py \
359 test/ganeti.hooks_unittest.py \
360 test/ganeti.http_unittest.py \
361 test/ganeti.impexpd_unittest.py \
362 test/ganeti.locking_unittest.py \
363 test/ganeti.luxi_unittest.py \
364 test/ganeti.masterd.instance_unittest.py \
365 test/ganeti.mcpu_unittest.py \
366 test/ganeti.objects_unittest.py \
367 test/ganeti.opcodes_unittest.py \
368 test/ganeti.rapi.client_unittest.py \
369 test/ganeti.rapi.resources_unittest.py \
370 test/ganeti.rapi.rlib2_unittest.py \
371 test/ganeti.serializer_unittest.py \
372 test/ganeti.ssh_unittest.py \
373 test/ganeti.uidpool_unittest.py \
374 test/ganeti.utils_unittest.py \
375 test/ganeti.utils_mlockall_unittest.py \
376 test/ganeti.workerpool_unittest.py \
377 test/docs_unittest.py \
378 test/tempfile_fork_unittest.py
381 test/check-cert-expired_unittest.bash \
382 test/daemon-util_unittest.bash \
383 test/ganeti-cleaner_unittest.bash \
384 test/import-export_unittest.bash \
389 TESTS = $(dist_TESTS) $(nodist_TESTS)
391 # Environment for all tests
392 PLAIN_TESTS_ENVIRONMENT = \
393 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
395 # Environment for tests run by automake
396 TESTS_ENVIRONMENT = \
397 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
400 $(dist_sbin_SCRIPTS) \
401 $(dist_tools_SCRIPTS) \
402 $(pkglib_python_scripts) \
404 $(pkgpython_PYTHON) \
405 $(hypervisor_PYTHON) \
415 test/check-cert-expired_unittest.bash \
416 test/daemon-util_unittest.bash \
417 test/ganeti-cleaner_unittest.bash \
418 test/import-export_unittest.bash \
421 check_python_code = \
422 $(BUILD_BASH_COMPLETION) \
427 $(dist_sbin_SCRIPTS) \
428 $(dist_tools_SCRIPTS) \
429 $(pkglib_python_scripts) \
430 $(BUILD_BASH_COMPLETION)
432 test/daemon-util_unittest.bash: daemons/daemon-util
434 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
436 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
437 sed -f $(REPLACE_VARS_SED) < $< > $@
440 daemons/%: daemons/%.in \
442 sed -f $(REPLACE_VARS_SED) < $< > $@
445 doc/examples/%: doc/examples/%.in \
447 sed -f $(REPLACE_VARS_SED) < $< > $@
449 doc/examples/hooks/%: doc/examples/hooks/%.in \
451 sed -f $(REPLACE_VARS_SED) < $< > $@
453 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
454 lib/cli.py $(gnt_scripts) tools/burnin
455 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
458 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
459 $(DOT) -Tpng -o $@ $<
461 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
462 @test -n "$(DOCBOOK2MAN)" || \
463 { echo 'docbook2man' not found during configure; exit 1; }
464 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
467 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
468 @test -n "$(DOCBOOK2HTML)" || \
469 { echo 'docbook2html' not found during configure; exit 1; }
470 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
472 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
473 sed -f $(REPLACE_VARS_SED) < $< > $@
475 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
476 sed -f $(REPLACE_VARS_SED) < $< > $@
478 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
479 sed -f $(REPLACE_VARS_SED) < $< > $@
481 lib/_autoconf.py: Makefile stamp-directories
483 { echo '# This file is automatically generated, do not edit!'; \
486 echo '"""Build-time configuration for Ganeti.'; \
488 echo 'This file is autogenerated by the build process.'; \
489 echo 'For any changes you need to re-run ./configure (and'; \
490 echo 'not edit by hand).'; \
494 echo '# pylint: disable-msg=C0301,C0324'; \
495 echo '# because this is autogenerated, we do not want'; \
496 echo '# style warnings' ; \
498 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
499 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
500 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
501 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
502 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
503 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
504 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
505 echo "SYSCONFDIR = '$(sysconfdir)'"; \
506 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
507 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
508 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
509 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
510 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
511 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
512 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
513 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
514 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
515 echo "KVM_PATH = '$(KVM_PATH)'"; \
516 echo "SOCAT_PATH = '$(SOCAT)'"; \
517 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
518 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
519 echo "TOOLSDIR = '$(toolsdir)'"; \
520 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
521 echo "PKGLIBDIR = '$(pkglibdir)'"; \
522 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
523 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
524 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
525 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
526 echo "RAPI_USER = '$(RAPI_USER)'"; \
529 $(REPLACE_VARS_SED): Makefile
531 { echo 's#@PREFIX@#$(prefix)#g'; \
532 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
533 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
534 echo 's#@BINDIR@#$(bindir)#g'; \
535 echo 's#@SBINDIR@#$(sbindir)#g'; \
536 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
537 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
538 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
539 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
540 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
541 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
542 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
543 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
544 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
545 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
546 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
547 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
548 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
549 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
550 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
551 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
554 # We need to create symlinks because "make distcheck" will not install Python
555 # files when building.
556 stamp-srclinks: Makefile stamp-directories
558 for i in $(srclink_files); do \
559 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
560 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
567 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
570 $(CHECK_PYTHON_CODE) $(check_python_code)
573 lint: ganeti $(BUILT_SOURCES)
574 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
575 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
577 # a dist hook rule for catching revision control directories
579 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
580 echo "Found revision control files in final archive." 1>&2; \
583 if find $(top_distdir) -name '*.py[co]' | grep .; then \
584 echo "Found Python byte code in final archive." 1>&2; \
587 if find $(top_distdir) -name '*~' | grep .; then \
588 echo "Found backup files in final archive." 1>&2; \
593 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
594 "$(DESTDIR)${localstatedir}/log/ganeti" \
595 "$(DESTDIR)${localstatedir}/run/ganeti"
597 stamp-directories: Makefile
602 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
603 test -e doc/api || mkdir doc/api
604 $(RUN_IN_TEMPDIR) epydoc -v \
605 --conf $(CURDIR)/epydoc.conf \
606 --output $(CURDIR)/doc/api
609 TAGS: $(BUILT_SOURCES)
611 find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
612 -path 'daemons/ganeti-*' -o -path 'tools/*' | \
616 coverage: $(BUILT_SOURCES) $(python_tests)
618 mkdir -p doc/coverage; \
619 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
620 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
621 HTML_COVERAGE=$(CURDIR)/doc/coverage \
622 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
625 commit-check: distcheck lint apidoc