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 watcherdir = $(pkgpythondir)/watcher
27 impexpddir = $(pkgpythondir)/impexpd
28 toolsdir = $(pkglibdir)/tools
29 docdir = $(datadir)/doc/$(PACKAGE)
31 # Delete output file if an error occurred while building it
41 doc/examples/gnt-debug \
66 ganeti-[0-9]*.[0-9]*.[0-9]* \
69 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIRS))
71 MAINTAINERCLEANFILES = \
74 doc/install-quick.rst \
78 maintainer-clean-local:
79 rm -rf $(BUILDTIME_DIRS)
82 $(addsuffix /*.py[co],$(DIRS)) \
85 autotools/replace_vars.sed \
88 daemons/ganeti-cleaner \
90 doc/examples/bash_completion \
91 doc/examples/ganeti.initd \
92 doc/examples/ganeti.cron \
93 doc/examples/gnt-config-backup \
94 doc/examples/hooks/ipsec \
98 $(nodist_pkgpython_PYTHON)
100 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
101 # it'll cause the target to rebuild every time.
109 nodist_pkgpython_PYTHON = \
113 lib/build/__init__.py
117 lib/asyncnotifier.py \
148 lib/client/__init__.py \
149 lib/client/gnt_backup.py \
150 lib/client/gnt_cluster.py \
151 lib/client/gnt_debug.py \
152 lib/client/gnt_instance.py \
153 lib/client/gnt_job.py \
154 lib/client/gnt_node.py \
157 hypervisor_PYTHON = \
158 lib/hypervisor/__init__.py \
159 lib/hypervisor/hv_base.py \
160 lib/hypervisor/hv_chroot.py \
161 lib/hypervisor/hv_fake.py \
162 lib/hypervisor/hv_kvm.py \
163 lib/hypervisor/hv_lxc.py \
164 lib/hypervisor/hv_xen.py
167 lib/rapi/__init__.py \
168 lib/rapi/baserlib.py \
170 lib/rapi/client_utils.py \
171 lib/rapi/connector.py \
175 lib/http/__init__.py \
181 lib/confd/__init__.py \
182 lib/confd/client.py \
183 lib/confd/querylib.py \
187 lib/masterd/__init__.py \
188 lib/masterd/instance.py
191 lib/impexpd/__init__.py
194 lib/watcher/__init__.py
202 doc/cluster-merge.rst \
208 doc/install-quick.rst \
211 doc/move-instance.rst \
217 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
219 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
220 $(RUN_IN_TEMPDIR) | doc/html/.dir
221 @test -n "$(SPHINX)" || \
222 { echo 'sphinx-build' not found during configure; exit 1; }
223 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
225 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
226 -D release="$(PACKAGE_VERSION)" \
227 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
228 rm -f doc/html/.buildinfo doc/html/objects.inv
231 doc/html: doc/html/index.html
235 { echo '.. This file is automatically updated at build time from $<.'; \
236 echo '.. Do not edit.'; \
241 doc/install-quick.rst: INSTALL
243 { echo '.. This file is automatically updated at build time from $<.'; \
244 echo '.. Do not edit.'; \
251 doc/design-2.1-lock-acquire.dot \
252 doc/design-2.1-lock-release.dot
254 docpng = $(patsubst %.dot,%.png,$(docdot))
256 # Things to build but not to install (add it to EXTRA_DIST if it should be
261 doc/examples/bash_completion \
262 doc/examples/ganeti.cron \
263 doc/examples/ganeti.initd \
264 doc/examples/gnt-config-backup \
265 doc/examples/hooks/ipsec \
270 scripts/gnt-cluster \
272 scripts/gnt-instance \
278 daemons/ganeti-watcher \
280 scripts/gnt-cluster \
282 scripts/gnt-instance \
287 dist_sbin_SCRIPTS = \
288 daemons/ganeti-noded \
289 daemons/ganeti-masterd \
290 daemons/ganeti-confd \
293 nodist_sbin_SCRIPTS = \
294 $(PYTHON_BOOTSTRAP) \
295 daemons/ganeti-cleaner
297 dist_tools_SCRIPTS = \
302 tools/cluster-merge \
304 tools/move-instance \
306 tools/sanitize-config
308 pkglib_python_scripts = \
309 daemons/import-export \
310 tools/check-cert-expired
313 daemons/daemon-util \
314 daemons/ensure-dirs \
315 $(pkglib_python_scripts)
320 autotools/build-bash-completion \
321 autotools/check-python-code \
322 autotools/check-man \
323 autotools/docbook-wrapper \
324 autotools/gen-coverage \
325 autotools/testrunner \
327 daemons/daemon-util.in \
328 daemons/ensure-dirs.in \
329 daemons/ganeti-cleaner.in \
330 $(pkglib_python_scripts) \
337 doc/examples/ganeti.initd.in \
338 doc/examples/ganeti.cron.in \
339 doc/examples/gnt-config-backup.in \
340 doc/examples/dumb-allocator \
341 doc/examples/ganeti.default \
342 doc/examples/ganeti.default-debug \
343 doc/examples/hooks/ethers \
344 doc/examples/hooks/ipsec.in \
345 doc/examples/gnt-debug/README \
346 doc/examples/gnt-debug/delay0.json \
347 doc/examples/gnt-debug/delay50.json \
371 man/ganeti-cleaner.8 \
373 man/ganeti-masterd.8 \
375 man/ganeti-os-interface.7 \
377 man/ganeti-watcher.8 \
386 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
387 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
389 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
390 $(patsubst %.html,%.html.in,$(manhtml))
393 test/data/bdev-drbd-8.0.txt \
394 test/data/bdev-drbd-8.3.txt \
395 test/data/bdev-drbd-disk.txt \
396 test/data/bdev-drbd-net-ip4.txt \
397 test/data/bdev-drbd-net-ip6.txt \
398 test/data/cert1.pem \
399 test/data/proc_drbd8.txt \
400 test/data/proc_drbd80-emptyline.txt \
401 test/data/proc_drbd83.txt \
402 test/data/sys_drbd_usermode_helper.txt \
403 test/import-export_unittest-helper
406 test/ganeti.asyncnotifier_unittest.py \
407 test/ganeti.backend_unittest.py \
408 test/ganeti.bdev_unittest.py \
409 test/ganeti.cli_unittest.py \
410 test/ganeti.daemon_unittest.py \
411 test/ganeti.cmdlib_unittest.py \
412 test/ganeti.compat_unittest.py \
413 test/ganeti.confd.client_unittest.py \
414 test/ganeti.config_unittest.py \
415 test/ganeti.constants_unittest.py \
416 test/ganeti.errors_unittest.py \
417 test/ganeti.hooks_unittest.py \
418 test/ganeti.http_unittest.py \
419 test/ganeti.hypervisor.hv_kvm_unittest.py \
420 test/ganeti.impexpd_unittest.py \
421 test/ganeti.jqueue_unittest.py \
422 test/ganeti.locking_unittest.py \
423 test/ganeti.luxi_unittest.py \
424 test/ganeti.masterd.instance_unittest.py \
425 test/ganeti.mcpu_unittest.py \
426 test/ganeti.netutils_unittest.py \
427 test/ganeti.objects_unittest.py \
428 test/ganeti.opcodes_unittest.py \
429 test/ganeti.rapi.client_unittest.py \
430 test/ganeti.rapi.resources_unittest.py \
431 test/ganeti.rapi.rlib2_unittest.py \
432 test/ganeti.rpc_unittest.py \
433 test/ganeti.runtime_unittest.py \
434 test/ganeti.serializer_unittest.py \
435 test/ganeti.ssh_unittest.py \
436 test/ganeti.uidpool_unittest.py \
437 test/ganeti.utils_unittest.py \
438 test/ganeti.utils_mlockall_unittest.py \
439 test/ganeti.workerpool_unittest.py \
440 test/cfgupgrade_unittest.py \
441 test/docs_unittest.py \
442 test/tempfile_fork_unittest.py
445 test/check-cert-expired_unittest.bash \
446 test/daemon-util_unittest.bash \
447 test/ganeti-cleaner_unittest.bash \
448 test/import-export_unittest.bash \
453 TESTS = $(dist_TESTS) $(nodist_TESTS)
455 # Environment for all tests
456 PLAIN_TESTS_ENVIRONMENT = \
457 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
459 # Environment for tests run by automake
460 TESTS_ENVIRONMENT = \
461 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
464 $(dist_sbin_SCRIPTS) \
465 $(dist_tools_SCRIPTS) \
466 $(pkglib_python_scripts) \
468 $(pkgpython_PYTHON) \
470 $(hypervisor_PYTHON) \
481 test/check-cert-expired_unittest.bash \
482 test/daemon-util_unittest.bash \
483 test/ganeti-cleaner_unittest.bash \
484 test/import-export_unittest.bash \
487 check_python_code = \
488 $(BUILD_BASH_COMPLETION) \
493 ganeti/http/server.py \
494 $(dist_sbin_SCRIPTS) \
495 $(dist_tools_SCRIPTS) \
496 $(pkglib_python_scripts) \
497 $(BUILD_BASH_COMPLETION)
499 test/daemon-util_unittest.bash: daemons/daemon-util
501 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
503 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
504 sed -f $(REPLACE_VARS_SED) < $< > $@
507 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
508 sed -f $(REPLACE_VARS_SED) < $< > $@
511 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
512 sed -f $(REPLACE_VARS_SED) < $< > $@
514 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
515 sed -f $(REPLACE_VARS_SED) < $< > $@
517 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
518 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
519 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
522 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
523 $(DOT) -Tpng -o $@ $<
525 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
526 @test -n "$(DOCBOOK2MAN)" || \
527 { echo 'docbook2man' not found during configure; exit 1; }
528 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
529 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
531 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
532 @test -n "$(DOCBOOK2HTML)" || \
533 { echo 'docbook2html' not found during configure; exit 1; }
534 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
536 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
537 sed -f $(REPLACE_VARS_SED) < $< > $@
539 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
540 sed -f $(REPLACE_VARS_SED) < $< > $@
542 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
543 sed -f $(REPLACE_VARS_SED) < $< > $@
546 if test -d .git; then \
548 elif test ! -f $@ ; then \
549 echo "Cannot auto-generate $@ file"; exit 1; \
552 .PHONY: regen-vcs-version
556 if test -d .git; then \
558 $(MAKE) vcs-version; \
561 lib/_autoconf.py: Makefile vcs-version | lib/.dir
563 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
564 { echo '# This file is automatically generated, do not edit!'; \
567 echo '"""Build-time configuration for Ganeti.'; \
569 echo 'This file is autogenerated by the build process.'; \
570 echo 'For any changes you need to re-run ./configure (and'; \
571 echo 'not edit by hand).'; \
575 echo '# pylint: disable-msg=C0301,C0324'; \
576 echo '# because this is autogenerated, we do not want'; \
577 echo '# style warnings' ; \
579 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
580 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
581 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
582 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
583 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
584 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
585 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
586 echo "SYSCONFDIR = '$(sysconfdir)'"; \
587 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
588 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
589 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
590 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
591 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
592 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
593 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
594 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
595 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
596 echo "KVM_PATH = '$(KVM_PATH)'"; \
597 echo "SOCAT_PATH = '$(SOCAT)'"; \
598 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
599 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
600 echo "TOOLSDIR = '$(toolsdir)'"; \
601 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
602 echo "PKGLIBDIR = '$(pkglibdir)'"; \
603 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
604 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
605 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
606 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
607 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
608 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
609 echo "RAPI_USER = '$(RAPI_USER)'"; \
610 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
611 echo "CONFD_USER = '$(CONFD_USER)'"; \
612 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
613 echo "NODED_USER = '$(NODED_USER)'"; \
614 echo "VCS_VERSION = '$$VCSVER'"; \
617 $(REPLACE_VARS_SED): Makefile
619 { echo 's#@PREFIX@#$(prefix)#g'; \
620 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
621 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
622 echo 's#@BINDIR@#$(bindir)#g'; \
623 echo 's#@SBINDIR@#$(sbindir)#g'; \
624 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
625 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
626 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
627 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
628 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
629 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
630 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
631 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
632 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
633 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
634 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
635 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
636 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
637 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
638 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
639 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
642 # Using deferred evaluation
643 daemons/ganeti-watcher: MODULE = ganeti.watcher
644 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
646 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
647 test -n "$(MODULE)" || { echo Missing module; exit 1; }
649 { echo '#!/usr/bin/python'; \
650 echo '# This file is automatically generated, do not edit!'; \
651 echo "# Edit $(MODULE) instead."; \
653 echo '"""Bootstrap script for L{$(MODULE)}"""'; \
655 echo '# pylint: disable-msg=C0103'; \
656 echo '# C0103: Invalid name'; \
659 echo 'import $(MODULE) as main'; \
661 echo '# Temporarily alias commands until bash completion'; \
662 echo '# generator is changed'; \
663 echo 'if hasattr(main, "commands"):'; \
664 echo ' commands = main.commands'; \
666 echo 'if __name__ == "__main__":'; \
667 echo ' sys.exit(main.Main())'; \
671 # We need to create symlinks because "make distcheck" will not install Python
672 # files when building.
673 stamp-srclinks: Makefile | $(all_dirfiles)
675 for i in $(srclink_files); do \
676 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
677 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
684 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
687 check-dirs: $(BUILT_SOURCES)
689 find . -type d \( \( -name . \) -o \( \
691 -name autom4te.cache \
692 \) -prune -o -print \) | { \
696 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
697 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
700 for dir in $(DIRS); do \
701 if ! test -d "$$dir"; then \
702 echo "Directory $$dir listed in DIRS does not exist" >&2; \
706 if test -n "$$error"; then exit 1; else exit 0; fi; \
709 check-local: check-dirs
710 $(CHECK_PYTHON_CODE) $(check_python_code)
713 lint: $(BUILT_SOURCES)
714 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
715 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
717 # a dist hook rule for updating the vcs-version file; this is
718 # hardcoded due to where it needs to build the file...
720 $(MAKE) regen-vcs-version && \
721 rm -f $(top_distdir)/vcs-version && \
722 cp -p $(srcdir)/vcs-version $(top_distdir)
724 # a distcheck hook rule for catching revision control directories
726 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
727 echo "Found revision control files in final archive." 1>&2; \
730 if find $(top_distdir) -name '*.py[co]' | grep .; then \
731 echo "Found Python byte code in final archive." 1>&2; \
734 if find $(top_distdir) -name '*~' | grep .; then \
735 echo "Found backup files in final archive." 1>&2; \
738 if test -n "$(BUILD_RELEASE)" && \
739 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
740 echo "Found unreleased version in NEWS." >&2; \
744 # When building a release, stricter checks should be used
745 distcheck-release: export BUILD_RELEASE = 1
746 distcheck-release: distcheck
749 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
750 "$(DESTDIR)${localstatedir}/log/ganeti" \
751 "$(DESTDIR)${localstatedir}/run/ganeti"
753 # To avoid conflicts between directory names and other targets, a file inside
754 # the directory is used to ensure its existence.
756 @mkdir_p@ $* && touch $@
759 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
760 $(RUN_IN_TEMPDIR) epydoc -v \
761 --conf $(CURDIR)/epydoc.conf \
762 --output $(CURDIR)/doc/api
765 TAGS: $(BUILT_SOURCES)
767 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
768 -path './daemons/ganeti-*' -o -path './tools/*' -o \
769 -path './qa/*.py' | \
773 coverage: $(BUILT_SOURCES) $(python_tests)
775 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
776 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
777 HTML_COVERAGE=$(CURDIR)/doc/coverage \
778 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
781 commit-check: distcheck lint apidoc
783 -include ./Makefile.local