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)
103 $(RUN_IN_TEMPDIR): $(BUILT_SOURCES)
105 nodist_pkgpython_PYTHON = \
109 lib/build/__init__.py
113 lib/asyncnotifier.py \
144 lib/client/__init__.py \
145 lib/client/gnt_backup.py \
146 lib/client/gnt_cluster.py \
147 lib/client/gnt_debug.py \
148 lib/client/gnt_instance.py \
149 lib/client/gnt_job.py \
150 lib/client/gnt_node.py \
153 hypervisor_PYTHON = \
154 lib/hypervisor/__init__.py \
155 lib/hypervisor/hv_base.py \
156 lib/hypervisor/hv_chroot.py \
157 lib/hypervisor/hv_fake.py \
158 lib/hypervisor/hv_kvm.py \
159 lib/hypervisor/hv_lxc.py \
160 lib/hypervisor/hv_xen.py
163 lib/rapi/__init__.py \
164 lib/rapi/baserlib.py \
166 lib/rapi/client_utils.py \
167 lib/rapi/connector.py \
171 lib/http/__init__.py \
177 lib/confd/__init__.py \
178 lib/confd/client.py \
179 lib/confd/querylib.py \
183 lib/masterd/__init__.py \
184 lib/masterd/instance.py
187 lib/impexpd/__init__.py
195 doc/cluster-merge.rst \
201 doc/install-quick.rst \
204 doc/move-instance.rst \
210 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac $(RUN_IN_TEMPDIR)
211 @test -n "$(SPHINX)" || \
212 { echo 'sphinx-build' not found during configure; exit 1; }
213 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
215 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
216 -D release="$(PACKAGE_VERSION)" \
217 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
218 rm -f doc/html/.buildinfo doc/html/objects.inv
221 doc/html: doc/html/.stamp
225 { echo '.. This file is automatically updated at build time from $<.'; \
226 echo '.. Do not edit.'; \
231 doc/install-quick.rst: INSTALL
233 { echo '.. This file is automatically updated at build time from $<.'; \
234 echo '.. Do not edit.'; \
241 doc/design-2.1-lock-acquire.dot \
242 doc/design-2.1-lock-release.dot
244 docpng = $(patsubst %.dot,%.png,$(docdot))
246 # Things to build but not to install (add it to EXTRA_DIST if it should be
251 doc/examples/bash_completion \
252 doc/examples/ganeti.cron \
253 doc/examples/ganeti.initd \
254 doc/examples/gnt-config-backup \
255 doc/examples/hooks/ipsec \
260 scripts/gnt-cluster \
262 scripts/gnt-instance \
269 scripts/gnt-cluster \
271 scripts/gnt-instance \
276 dist_sbin_SCRIPTS = \
277 daemons/ganeti-noded \
278 daemons/ganeti-watcher \
279 daemons/ganeti-masterd \
280 daemons/ganeti-confd \
283 nodist_sbin_SCRIPTS = \
284 $(PYTHON_BOOTSTRAP) \
285 daemons/ganeti-cleaner
287 dist_tools_SCRIPTS = \
292 tools/cluster-merge \
294 tools/move-instance \
296 tools/sanitize-config
298 pkglib_python_scripts = \
299 daemons/import-export \
300 tools/check-cert-expired
303 daemons/daemon-util \
304 daemons/ensure-dirs \
305 $(pkglib_python_scripts)
310 autotools/build-bash-completion \
311 autotools/check-python-code \
312 autotools/check-man \
313 autotools/docbook-wrapper \
314 autotools/gen-coverage \
315 autotools/testrunner \
317 daemons/daemon-util.in \
318 daemons/ensure-dirs.in \
319 daemons/ganeti-cleaner.in \
320 $(pkglib_python_scripts) \
327 doc/examples/ganeti.initd.in \
328 doc/examples/ganeti.cron.in \
329 doc/examples/gnt-config-backup.in \
330 doc/examples/dumb-allocator \
331 doc/examples/ganeti.default \
332 doc/examples/ganeti.default-debug \
333 doc/examples/hooks/ethers \
334 doc/examples/hooks/ipsec.in \
335 doc/examples/gnt-debug/README \
336 doc/examples/gnt-debug/delay0.json \
337 doc/examples/gnt-debug/delay50.json \
361 man/ganeti-cleaner.8 \
363 man/ganeti-masterd.8 \
365 man/ganeti-os-interface.7 \
367 man/ganeti-watcher.8 \
376 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
377 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
379 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
380 $(patsubst %.html,%.html.in,$(manhtml))
383 test/data/bdev-drbd-8.0.txt \
384 test/data/bdev-drbd-8.3.txt \
385 test/data/bdev-drbd-disk.txt \
386 test/data/bdev-drbd-net-ip4.txt \
387 test/data/bdev-drbd-net-ip6.txt \
388 test/data/cert1.pem \
389 test/data/proc_drbd8.txt \
390 test/data/proc_drbd80-emptyline.txt \
391 test/data/proc_drbd83.txt \
392 test/data/sys_drbd_usermode_helper.txt \
393 test/import-export_unittest-helper
396 test/ganeti.asyncnotifier_unittest.py \
397 test/ganeti.backend_unittest.py \
398 test/ganeti.bdev_unittest.py \
399 test/ganeti.cli_unittest.py \
400 test/ganeti.daemon_unittest.py \
401 test/ganeti.cmdlib_unittest.py \
402 test/ganeti.compat_unittest.py \
403 test/ganeti.confd.client_unittest.py \
404 test/ganeti.config_unittest.py \
405 test/ganeti.constants_unittest.py \
406 test/ganeti.errors_unittest.py \
407 test/ganeti.hooks_unittest.py \
408 test/ganeti.http_unittest.py \
409 test/ganeti.hypervisor.hv_kvm_unittest.py \
410 test/ganeti.impexpd_unittest.py \
411 test/ganeti.jqueue_unittest.py \
412 test/ganeti.locking_unittest.py \
413 test/ganeti.luxi_unittest.py \
414 test/ganeti.masterd.instance_unittest.py \
415 test/ganeti.mcpu_unittest.py \
416 test/ganeti.netutils_unittest.py \
417 test/ganeti.objects_unittest.py \
418 test/ganeti.opcodes_unittest.py \
419 test/ganeti.rapi.client_unittest.py \
420 test/ganeti.rapi.resources_unittest.py \
421 test/ganeti.rapi.rlib2_unittest.py \
422 test/ganeti.rpc_unittest.py \
423 test/ganeti.runtime_unittest.py \
424 test/ganeti.serializer_unittest.py \
425 test/ganeti.ssh_unittest.py \
426 test/ganeti.uidpool_unittest.py \
427 test/ganeti.utils_unittest.py \
428 test/ganeti.utils_mlockall_unittest.py \
429 test/ganeti.workerpool_unittest.py \
430 test/cfgupgrade_unittest.py \
431 test/docs_unittest.py \
432 test/tempfile_fork_unittest.py
435 test/check-cert-expired_unittest.bash \
436 test/daemon-util_unittest.bash \
437 test/ganeti-cleaner_unittest.bash \
438 test/import-export_unittest.bash \
443 TESTS = $(dist_TESTS) $(nodist_TESTS)
445 # Environment for all tests
446 PLAIN_TESTS_ENVIRONMENT = \
447 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
449 # Environment for tests run by automake
450 TESTS_ENVIRONMENT = \
451 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
454 $(dist_sbin_SCRIPTS) \
455 $(dist_tools_SCRIPTS) \
456 $(pkglib_python_scripts) \
458 $(pkgpython_PYTHON) \
460 $(hypervisor_PYTHON) \
470 test/check-cert-expired_unittest.bash \
471 test/daemon-util_unittest.bash \
472 test/ganeti-cleaner_unittest.bash \
473 test/import-export_unittest.bash \
476 check_python_code = \
477 $(BUILD_BASH_COMPLETION) \
482 ganeti/http/server.py \
483 $(dist_sbin_SCRIPTS) \
484 $(dist_tools_SCRIPTS) \
485 $(pkglib_python_scripts) \
486 $(BUILD_BASH_COMPLETION)
488 test/daemon-util_unittest.bash: daemons/daemon-util
490 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
492 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
493 sed -f $(REPLACE_VARS_SED) < $< > $@
496 daemons/%: daemons/%.in \
498 sed -f $(REPLACE_VARS_SED) < $< > $@
501 doc/examples/%: doc/examples/%.in \
503 sed -f $(REPLACE_VARS_SED) < $< > $@
505 doc/examples/hooks/%: doc/examples/hooks/%.in \
507 sed -f $(REPLACE_VARS_SED) < $< > $@
509 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
510 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
511 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
514 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
515 $(DOT) -Tpng -o $@ $<
517 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
518 @test -n "$(DOCBOOK2MAN)" || \
519 { echo 'docbook2man' not found during configure; exit 1; }
520 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
521 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
523 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
524 @test -n "$(DOCBOOK2HTML)" || \
525 { echo 'docbook2html' not found during configure; exit 1; }
526 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
528 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
529 sed -f $(REPLACE_VARS_SED) < $< > $@
531 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
532 sed -f $(REPLACE_VARS_SED) < $< > $@
534 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
535 sed -f $(REPLACE_VARS_SED) < $< > $@
538 if test -d .git; then \
540 elif test ! -f $@ ; then \
541 echo "Cannot auto-generate $@ file"; exit 1; \
544 .PHONY: regen-vcs-version
548 if test -d .git; then \
550 $(MAKE) vcs-version; \
553 lib/_autoconf.py: Makefile stamp-directories vcs-version
555 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
556 { echo '# This file is automatically generated, do not edit!'; \
559 echo '"""Build-time configuration for Ganeti.'; \
561 echo 'This file is autogenerated by the build process.'; \
562 echo 'For any changes you need to re-run ./configure (and'; \
563 echo 'not edit by hand).'; \
567 echo '# pylint: disable-msg=C0301,C0324'; \
568 echo '# because this is autogenerated, we do not want'; \
569 echo '# style warnings' ; \
571 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
572 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
573 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
574 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
575 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
576 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
577 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
578 echo "SYSCONFDIR = '$(sysconfdir)'"; \
579 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
580 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
581 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
582 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
583 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
584 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
585 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
586 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
587 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
588 echo "KVM_PATH = '$(KVM_PATH)'"; \
589 echo "SOCAT_PATH = '$(SOCAT)'"; \
590 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
591 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
592 echo "TOOLSDIR = '$(toolsdir)'"; \
593 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
594 echo "PKGLIBDIR = '$(pkglibdir)'"; \
595 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
596 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
597 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
598 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
599 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
600 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
601 echo "RAPI_USER = '$(RAPI_USER)'"; \
602 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
603 echo "CONFD_USER = '$(CONFD_USER)'"; \
604 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
605 echo "NODED_USER = '$(NODED_USER)'"; \
606 echo "VCS_VERSION = '$$VCSVER'"; \
609 $(REPLACE_VARS_SED): Makefile
611 { echo 's#@PREFIX@#$(prefix)#g'; \
612 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
613 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
614 echo 's#@BINDIR@#$(bindir)#g'; \
615 echo 's#@SBINDIR@#$(sbindir)#g'; \
616 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
617 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
618 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
619 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
620 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
621 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
622 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
623 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
624 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
625 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
626 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
627 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
628 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
629 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
630 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
631 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
634 $(PYTHON_BOOTSTRAP): Makefile
636 test -e $(dir $@) || mkdir $(dir $@); \
637 module='$(subst -,_,$(notdir $@))'; \
638 { echo '#!/usr/bin/python'; \
639 echo '# This file is automatically generated, do not edit!'; \
640 echo "# Edit ganeti.client.$$module instead."; \
642 echo '"""Bootstrap script for L{ganeti.client.'"$$module"'}"""'; \
644 echo '# pylint: disable-msg=C0103'; \
645 echo '# C0103: Invalid name'; \
648 echo "from ganeti.client import $$module"; \
650 echo '# Temporarily alias commands until bash completion'; \
651 echo '# generator is changed'; \
652 echo "if hasattr($$module, \"commands\"):"; \
653 echo " commands = $$module.commands"; \
655 echo 'if __name__ == "__main__":'; \
656 echo " sys.exit($$module.Main())"; \
660 # We need to create symlinks because "make distcheck" will not install Python
661 # files when building.
662 stamp-srclinks: Makefile stamp-directories
664 for i in $(srclink_files); do \
665 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
666 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
673 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
676 check-dirs: $(BUILT_SOURCES)
678 find . -type d \( \( -name . \) -o \( \
680 -name autom4te.cache \
681 \) -prune -o -print \) | { \
685 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
686 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
689 for dir in $(DIRS); do \
690 if ! test -d "$$dir"; then \
691 echo "Directory $$dir listed in DIRS does not exist" >&2; \
695 if test -n "$$error"; then exit 1; else exit 0; fi; \
698 check-local: check-dirs
699 $(CHECK_PYTHON_CODE) $(check_python_code)
702 lint: ganeti $(BUILT_SOURCES)
703 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
704 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
706 # a dist hook rule for updating the vcs-version file; this is
707 # hardcoded due to where it needs to build the file...
709 $(MAKE) regen-vcs-version && \
710 rm -f $(top_distdir)/vcs-version && \
711 cp -p $(srcdir)/vcs-version $(top_distdir)
713 # a distcheck hook rule for catching revision control directories
715 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
716 echo "Found revision control files in final archive." 1>&2; \
719 if find $(top_distdir) -name '*.py[co]' | grep .; then \
720 echo "Found Python byte code in final archive." 1>&2; \
723 if find $(top_distdir) -name '*~' | grep .; then \
724 echo "Found backup files in final archive." 1>&2; \
729 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
730 "$(DESTDIR)${localstatedir}/log/ganeti" \
731 "$(DESTDIR)${localstatedir}/run/ganeti"
733 stamp-directories: Makefile
738 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
739 test -e doc/api || mkdir doc/api
740 $(RUN_IN_TEMPDIR) epydoc -v \
741 --conf $(CURDIR)/epydoc.conf \
742 --output $(CURDIR)/doc/api
745 TAGS: $(BUILT_SOURCES)
747 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
748 -path './daemons/ganeti-*' -o -path './tools/*' -o \
749 -path './qa/*.py' | \
753 coverage: $(BUILT_SOURCES) $(python_tests)
755 @mkdir_p@ doc/coverage; \
756 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
757 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
758 HTML_COVERAGE=$(CURDIR)/doc/coverage \
759 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
762 commit-check: distcheck lint apidoc
764 -include ./Makefile.local