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 clientdir = $(pkgpythondir)/client
21 hypervisordir = $(pkgpythondir)/hypervisor
22 httpdir = $(pkgpythondir)/http
23 masterddir = $(pkgpythondir)/masterd
24 confddir = $(pkgpythondir)/confd
25 rapidir = $(pkgpythondir)/rapi
26 impexpddir = $(pkgpythondir)/impexpd
27 toolsdir = $(pkglibdir)/tools
28 docdir = $(datadir)/doc/$(PACKAGE)
30 # Delete output file if an error occurred while building it
40 doc/examples/gnt-debug \
64 ganeti-[0-9]*.[0-9]*.[0-9]* \
67 MAINTAINERCLEANFILES = \
70 doc/install-quick.rst \
74 maintainer-clean-local:
75 rm -rf $(BUILDTIME_DIRS)
78 $(addsuffix /*.py[co],$(DIRS)) \
80 autotools/replace_vars.sed \
83 daemons/ganeti-cleaner \
85 doc/examples/bash_completion \
86 doc/examples/ganeti.initd \
87 doc/examples/ganeti.cron \
88 doc/examples/gnt-config-backup \
89 doc/examples/hooks/ipsec \
94 $(nodist_pkgpython_PYTHON)
102 nodist_pkgpython_PYTHON = \
106 lib/build/__init__.py
110 lib/asyncnotifier.py \
141 lib/client/__init__.py \
142 lib/client/gnt_cluster.py \
143 lib/client/gnt_debug.py \
144 lib/client/gnt_instance.py \
145 lib/client/gnt_job.py \
146 lib/client/gnt_node.py \
149 hypervisor_PYTHON = \
150 lib/hypervisor/__init__.py \
151 lib/hypervisor/hv_base.py \
152 lib/hypervisor/hv_chroot.py \
153 lib/hypervisor/hv_fake.py \
154 lib/hypervisor/hv_kvm.py \
155 lib/hypervisor/hv_lxc.py \
156 lib/hypervisor/hv_xen.py
159 lib/rapi/__init__.py \
160 lib/rapi/baserlib.py \
162 lib/rapi/client_utils.py \
163 lib/rapi/connector.py \
167 lib/http/__init__.py \
173 lib/confd/__init__.py \
174 lib/confd/client.py \
175 lib/confd/querylib.py \
179 lib/masterd/__init__.py \
180 lib/masterd/instance.py
183 lib/impexpd/__init__.py
191 doc/cluster-merge.rst \
197 doc/install-quick.rst \
200 doc/move-instance.rst \
206 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
207 @test -n "$(SPHINX)" || \
208 { echo 'sphinx-build' not found during configure; exit 1; }
209 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
211 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
212 -D release="$(PACKAGE_VERSION)" \
213 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
214 rm -f doc/html/.buildinfo doc/html/objects.inv
217 doc/html: doc/html/.stamp
221 { echo '.. This file is automatically updated at build time from $<.'; \
222 echo '.. Do not edit.'; \
227 doc/install-quick.rst: INSTALL
229 { echo '.. This file is automatically updated at build time from $<.'; \
230 echo '.. Do not edit.'; \
237 doc/design-2.1-lock-acquire.dot \
238 doc/design-2.1-lock-release.dot
240 docpng = $(patsubst %.dot,%.png,$(docdot))
242 # Things to build but not to install (add it to EXTRA_DIST if it should be
247 doc/examples/bash_completion \
248 doc/examples/ganeti.cron \
249 doc/examples/ganeti.initd \
250 doc/examples/gnt-config-backup \
251 doc/examples/hooks/ipsec \
256 scripts/gnt-cluster \
258 scripts/gnt-instance \
264 scripts/gnt-cluster \
266 scripts/gnt-instance \
271 dist_sbin_SCRIPTS = \
272 daemons/ganeti-noded \
273 daemons/ganeti-watcher \
274 daemons/ganeti-masterd \
275 daemons/ganeti-confd \
276 daemons/ganeti-rapi \
279 nodist_sbin_SCRIPTS = \
280 $(PYTHON_BOOTSTRAP) \
281 daemons/ganeti-cleaner
283 dist_tools_SCRIPTS = \
288 tools/cluster-merge \
290 tools/move-instance \
292 tools/sanitize-config
294 pkglib_python_scripts = \
295 daemons/import-export \
296 tools/check-cert-expired
299 daemons/daemon-util \
300 daemons/ensure-dirs \
301 $(pkglib_python_scripts)
306 autotools/build-bash-completion \
307 autotools/check-python-code \
308 autotools/check-man \
309 autotools/docbook-wrapper \
310 autotools/gen-coverage \
311 autotools/testrunner \
313 daemons/daemon-util.in \
314 daemons/ensure-dirs.in \
315 daemons/ganeti-cleaner.in \
316 $(pkglib_python_scripts) \
323 doc/examples/ganeti.initd.in \
324 doc/examples/ganeti.cron.in \
325 doc/examples/gnt-config-backup.in \
326 doc/examples/dumb-allocator \
327 doc/examples/ganeti.default \
328 doc/examples/ganeti.default-debug \
329 doc/examples/hooks/ethers \
330 doc/examples/hooks/ipsec.in \
331 doc/examples/gnt-debug/README \
332 doc/examples/gnt-debug/delay0.json \
333 doc/examples/gnt-debug/delay50.json \
357 man/ganeti-cleaner.8 \
359 man/ganeti-masterd.8 \
361 man/ganeti-os-interface.7 \
363 man/ganeti-watcher.8 \
372 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
373 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
375 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
376 $(patsubst %.html,%.html.in,$(manhtml))
379 test/data/bdev-drbd-8.0.txt \
380 test/data/bdev-drbd-8.3.txt \
381 test/data/bdev-drbd-disk.txt \
382 test/data/bdev-drbd-net-ip4.txt \
383 test/data/bdev-drbd-net-ip6.txt \
384 test/data/cert1.pem \
385 test/data/proc_drbd8.txt \
386 test/data/proc_drbd80-emptyline.txt \
387 test/data/proc_drbd83.txt \
388 test/data/sys_drbd_usermode_helper.txt \
389 test/import-export_unittest-helper
392 test/ganeti.asyncnotifier_unittest.py \
393 test/ganeti.backend_unittest.py \
394 test/ganeti.bdev_unittest.py \
395 test/ganeti.cli_unittest.py \
396 test/ganeti.daemon_unittest.py \
397 test/ganeti.cmdlib_unittest.py \
398 test/ganeti.compat_unittest.py \
399 test/ganeti.confd.client_unittest.py \
400 test/ganeti.config_unittest.py \
401 test/ganeti.constants_unittest.py \
402 test/ganeti.errors_unittest.py \
403 test/ganeti.hooks_unittest.py \
404 test/ganeti.http_unittest.py \
405 test/ganeti.hypervisor.hv_kvm_unittest.py \
406 test/ganeti.impexpd_unittest.py \
407 test/ganeti.jqueue_unittest.py \
408 test/ganeti.locking_unittest.py \
409 test/ganeti.luxi_unittest.py \
410 test/ganeti.masterd.instance_unittest.py \
411 test/ganeti.mcpu_unittest.py \
412 test/ganeti.netutils_unittest.py \
413 test/ganeti.objects_unittest.py \
414 test/ganeti.opcodes_unittest.py \
415 test/ganeti.rapi.client_unittest.py \
416 test/ganeti.rapi.resources_unittest.py \
417 test/ganeti.rapi.rlib2_unittest.py \
418 test/ganeti.rpc_unittest.py \
419 test/ganeti.runtime_unittest.py \
420 test/ganeti.serializer_unittest.py \
421 test/ganeti.ssh_unittest.py \
422 test/ganeti.uidpool_unittest.py \
423 test/ganeti.utils_unittest.py \
424 test/ganeti.utils_mlockall_unittest.py \
425 test/ganeti.workerpool_unittest.py \
426 test/cfgupgrade_unittest.py \
427 test/docs_unittest.py \
428 test/tempfile_fork_unittest.py
431 test/check-cert-expired_unittest.bash \
432 test/daemon-util_unittest.bash \
433 test/ganeti-cleaner_unittest.bash \
434 test/import-export_unittest.bash \
439 TESTS = $(dist_TESTS) $(nodist_TESTS)
441 # Environment for all tests
442 PLAIN_TESTS_ENVIRONMENT = \
443 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
445 # Environment for tests run by automake
446 TESTS_ENVIRONMENT = \
447 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
450 $(dist_sbin_SCRIPTS) \
451 $(dist_tools_SCRIPTS) \
452 $(pkglib_python_scripts) \
454 $(pkgpython_PYTHON) \
456 $(hypervisor_PYTHON) \
466 test/check-cert-expired_unittest.bash \
467 test/daemon-util_unittest.bash \
468 test/ganeti-cleaner_unittest.bash \
469 test/import-export_unittest.bash \
472 check_python_code = \
473 $(BUILD_BASH_COMPLETION) \
478 ganeti/http/server.py \
479 $(dist_sbin_SCRIPTS) \
480 $(dist_tools_SCRIPTS) \
481 $(pkglib_python_scripts) \
482 $(BUILD_BASH_COMPLETION)
484 test/daemon-util_unittest.bash: daemons/daemon-util
486 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
488 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
489 sed -f $(REPLACE_VARS_SED) < $< > $@
492 daemons/%: daemons/%.in \
494 sed -f $(REPLACE_VARS_SED) < $< > $@
497 doc/examples/%: doc/examples/%.in \
499 sed -f $(REPLACE_VARS_SED) < $< > $@
501 doc/examples/hooks/%: doc/examples/hooks/%.in \
503 sed -f $(REPLACE_VARS_SED) < $< > $@
505 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
506 lib/cli.py $(gnt_scripts) tools/burnin
507 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
510 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
511 $(DOT) -Tpng -o $@ $<
513 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
514 @test -n "$(DOCBOOK2MAN)" || \
515 { echo 'docbook2man' not found during configure; exit 1; }
516 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
517 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
519 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
520 @test -n "$(DOCBOOK2HTML)" || \
521 { echo 'docbook2html' not found during configure; exit 1; }
522 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
524 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
525 sed -f $(REPLACE_VARS_SED) < $< > $@
527 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
528 sed -f $(REPLACE_VARS_SED) < $< > $@
530 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
531 sed -f $(REPLACE_VARS_SED) < $< > $@
534 if test -d .git; then \
536 elif test ! -f $@ ; then \
537 echo "Cannot auto-generate $@ file"; exit 1; \
540 .PHONY: regen-vcs-version
544 if test -d .git; then \
546 $(MAKE) vcs-version; \
549 lib/_autoconf.py: Makefile stamp-directories vcs-version
551 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
552 { echo '# This file is automatically generated, do not edit!'; \
555 echo '"""Build-time configuration for Ganeti.'; \
557 echo 'This file is autogenerated by the build process.'; \
558 echo 'For any changes you need to re-run ./configure (and'; \
559 echo 'not edit by hand).'; \
563 echo '# pylint: disable-msg=C0301,C0324'; \
564 echo '# because this is autogenerated, we do not want'; \
565 echo '# style warnings' ; \
567 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
568 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
569 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
570 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
571 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
572 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
573 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
574 echo "SYSCONFDIR = '$(sysconfdir)'"; \
575 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
576 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
577 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
578 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
579 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
580 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
581 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
582 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
583 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
584 echo "KVM_PATH = '$(KVM_PATH)'"; \
585 echo "SOCAT_PATH = '$(SOCAT)'"; \
586 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
587 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
588 echo "TOOLSDIR = '$(toolsdir)'"; \
589 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
590 echo "PKGLIBDIR = '$(pkglibdir)'"; \
591 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
592 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
593 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
594 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
595 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
596 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
597 echo "RAPI_USER = '$(RAPI_USER)'"; \
598 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
599 echo "CONFD_USER = '$(CONFD_USER)'"; \
600 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
601 echo "NODED_USER = '$(NODED_USER)'"; \
602 echo "VCS_VERSION = '$$VCSVER'"; \
605 $(REPLACE_VARS_SED): Makefile
607 { echo 's#@PREFIX@#$(prefix)#g'; \
608 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
609 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
610 echo 's#@BINDIR@#$(bindir)#g'; \
611 echo 's#@SBINDIR@#$(sbindir)#g'; \
612 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
613 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
614 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
615 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
616 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
617 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
618 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
619 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
620 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
621 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
622 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
623 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
624 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
625 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
626 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
627 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
630 $(PYTHON_BOOTSTRAP): Makefile
632 module='$(subst -,_,$(notdir $@))'; \
633 { echo '#!/usr/bin/python'; \
634 echo '# This file is automatically generated, do not edit!'; \
635 echo "# Edit ganeti.client.$$module instead."; \
637 echo '"""Bootstrap script for L{ganeti.client.'"$$module"'}"""'; \
639 echo '# pylint: disable-msg=C0103'; \
640 echo '# C0103: Invalid name'; \
643 echo "from ganeti.client import $$module"; \
645 echo '# Temporarily alias commands until bash completion'; \
646 echo '# generator is changed'; \
647 echo "if hasattr($$module, \"commands\"):"; \
648 echo " commands = $$module.commands"; \
650 echo 'if __name__ == "__main__":'; \
651 echo " sys.exit($$module.Main())"; \
655 # We need to create symlinks because "make distcheck" will not install Python
656 # files when building.
657 stamp-srclinks: Makefile stamp-directories
659 for i in $(srclink_files); do \
660 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
661 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
668 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
671 check-dirs: $(BUILT_SOURCES)
673 find . -type d \( \( -name . \) -o \( \
675 -name autom4te.cache \
676 \) -prune -o -print \) | { \
680 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
681 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
684 for dir in $(DIRS); do \
685 if ! test -d "$$dir"; then \
686 echo "Directory $$dir listed in DIRS does not exist" >&2; \
690 if test -n "$$error"; then exit 1; else exit 0; fi; \
693 check-local: check-dirs
694 $(CHECK_PYTHON_CODE) $(check_python_code)
697 lint: ganeti $(BUILT_SOURCES)
698 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
699 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
701 # a dist hook rule for updating the vcs-version file; this is
702 # hardcoded due to where it needs to build the file...
704 $(MAKE) regen-vcs-version && \
705 rm -f $(top_distdir)/vcs-version && \
706 cp -p $(srcdir)/vcs-version $(top_distdir)
708 # a distcheck hook rule for catching revision control directories
710 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
711 echo "Found revision control files in final archive." 1>&2; \
714 if find $(top_distdir) -name '*.py[co]' | grep .; then \
715 echo "Found Python byte code in final archive." 1>&2; \
718 if find $(top_distdir) -name '*~' | grep .; then \
719 echo "Found backup files in final archive." 1>&2; \
724 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
725 "$(DESTDIR)${localstatedir}/log/ganeti" \
726 "$(DESTDIR)${localstatedir}/run/ganeti"
728 stamp-directories: Makefile
733 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
734 test -e doc/api || mkdir doc/api
735 $(RUN_IN_TEMPDIR) epydoc -v \
736 --conf $(CURDIR)/epydoc.conf \
737 --output $(CURDIR)/doc/api
740 TAGS: $(BUILT_SOURCES)
742 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
743 -path './daemons/ganeti-*' -o -path './tools/*' -o \
744 -path './qa/*.py' | \
748 coverage: $(BUILT_SOURCES) $(python_tests)
750 mkdir -p doc/coverage; \
751 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
752 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
753 HTML_COVERAGE=$(CURDIR)/doc/coverage \
754 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
757 commit-check: distcheck lint apidoc
759 -include ./Makefile.local