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_debug.py \
145 hypervisor_PYTHON = \
146 lib/hypervisor/__init__.py \
147 lib/hypervisor/hv_base.py \
148 lib/hypervisor/hv_chroot.py \
149 lib/hypervisor/hv_fake.py \
150 lib/hypervisor/hv_kvm.py \
151 lib/hypervisor/hv_lxc.py \
152 lib/hypervisor/hv_xen.py
155 lib/rapi/__init__.py \
156 lib/rapi/baserlib.py \
158 lib/rapi/client_utils.py \
159 lib/rapi/connector.py \
163 lib/http/__init__.py \
169 lib/confd/__init__.py \
170 lib/confd/client.py \
171 lib/confd/querylib.py \
175 lib/masterd/__init__.py \
176 lib/masterd/instance.py
179 lib/impexpd/__init__.py
187 doc/cluster-merge.rst \
193 doc/install-quick.rst \
196 doc/move-instance.rst \
202 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
203 @test -n "$(SPHINX)" || \
204 { echo 'sphinx-build' not found during configure; exit 1; }
205 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
207 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
208 -D release="$(PACKAGE_VERSION)" \
209 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
210 rm -f doc/html/.buildinfo doc/html/objects.inv
213 doc/html: doc/html/.stamp
217 { echo '.. This file is automatically updated at build time from $<.'; \
218 echo '.. Do not edit.'; \
223 doc/install-quick.rst: INSTALL
225 { echo '.. This file is automatically updated at build time from $<.'; \
226 echo '.. Do not edit.'; \
233 doc/design-2.1-lock-acquire.dot \
234 doc/design-2.1-lock-release.dot
236 docpng = $(patsubst %.dot,%.png,$(docdot))
238 # Things to build but not to install (add it to EXTRA_DIST if it should be
243 doc/examples/bash_completion \
244 doc/examples/ganeti.cron \
245 doc/examples/ganeti.initd \
246 doc/examples/gnt-config-backup \
247 doc/examples/hooks/ipsec \
252 scripts/gnt-cluster \
254 scripts/gnt-instance \
263 dist_sbin_SCRIPTS = \
264 daemons/ganeti-noded \
265 daemons/ganeti-watcher \
266 daemons/ganeti-masterd \
267 daemons/ganeti-confd \
268 daemons/ganeti-rapi \
270 scripts/gnt-cluster \
271 scripts/gnt-instance \
275 nodist_sbin_SCRIPTS = \
276 $(PYTHON_BOOTSTRAP) \
277 daemons/ganeti-cleaner
279 dist_tools_SCRIPTS = \
284 tools/cluster-merge \
286 tools/move-instance \
288 tools/sanitize-config
290 pkglib_python_scripts = \
291 daemons/import-export \
292 tools/check-cert-expired
295 daemons/daemon-util \
296 daemons/ensure-dirs \
297 $(pkglib_python_scripts)
302 autotools/build-bash-completion \
303 autotools/check-python-code \
304 autotools/check-man \
305 autotools/docbook-wrapper \
306 autotools/gen-coverage \
307 autotools/testrunner \
309 daemons/daemon-util.in \
310 daemons/ensure-dirs.in \
311 daemons/ganeti-cleaner.in \
312 $(pkglib_python_scripts) \
319 doc/examples/ganeti.initd.in \
320 doc/examples/ganeti.cron.in \
321 doc/examples/gnt-config-backup.in \
322 doc/examples/dumb-allocator \
323 doc/examples/ganeti.default \
324 doc/examples/ganeti.default-debug \
325 doc/examples/hooks/ethers \
326 doc/examples/hooks/ipsec.in \
327 doc/examples/gnt-debug/README \
328 doc/examples/gnt-debug/delay0.json \
329 doc/examples/gnt-debug/delay50.json \
353 man/ganeti-cleaner.8 \
355 man/ganeti-masterd.8 \
357 man/ganeti-os-interface.7 \
359 man/ganeti-watcher.8 \
368 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
369 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
371 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
372 $(patsubst %.html,%.html.in,$(manhtml))
375 test/data/bdev-drbd-8.0.txt \
376 test/data/bdev-drbd-8.3.txt \
377 test/data/bdev-drbd-disk.txt \
378 test/data/bdev-drbd-net-ip4.txt \
379 test/data/bdev-drbd-net-ip6.txt \
380 test/data/cert1.pem \
381 test/data/proc_drbd8.txt \
382 test/data/proc_drbd80-emptyline.txt \
383 test/data/proc_drbd83.txt \
384 test/data/sys_drbd_usermode_helper.txt \
385 test/import-export_unittest-helper
388 test/ganeti.asyncnotifier_unittest.py \
389 test/ganeti.backend_unittest.py \
390 test/ganeti.bdev_unittest.py \
391 test/ganeti.cli_unittest.py \
392 test/ganeti.daemon_unittest.py \
393 test/ganeti.cmdlib_unittest.py \
394 test/ganeti.compat_unittest.py \
395 test/ganeti.confd.client_unittest.py \
396 test/ganeti.config_unittest.py \
397 test/ganeti.constants_unittest.py \
398 test/ganeti.errors_unittest.py \
399 test/ganeti.hooks_unittest.py \
400 test/ganeti.http_unittest.py \
401 test/ganeti.hypervisor.hv_kvm_unittest.py \
402 test/ganeti.impexpd_unittest.py \
403 test/ganeti.jqueue_unittest.py \
404 test/ganeti.locking_unittest.py \
405 test/ganeti.luxi_unittest.py \
406 test/ganeti.masterd.instance_unittest.py \
407 test/ganeti.mcpu_unittest.py \
408 test/ganeti.netutils_unittest.py \
409 test/ganeti.objects_unittest.py \
410 test/ganeti.opcodes_unittest.py \
411 test/ganeti.rapi.client_unittest.py \
412 test/ganeti.rapi.resources_unittest.py \
413 test/ganeti.rapi.rlib2_unittest.py \
414 test/ganeti.rpc_unittest.py \
415 test/ganeti.runtime_unittest.py \
416 test/ganeti.serializer_unittest.py \
417 test/ganeti.ssh_unittest.py \
418 test/ganeti.uidpool_unittest.py \
419 test/ganeti.utils_unittest.py \
420 test/ganeti.utils_mlockall_unittest.py \
421 test/ganeti.workerpool_unittest.py \
422 test/cfgupgrade_unittest.py \
423 test/docs_unittest.py \
424 test/tempfile_fork_unittest.py
427 test/check-cert-expired_unittest.bash \
428 test/daemon-util_unittest.bash \
429 test/ganeti-cleaner_unittest.bash \
430 test/import-export_unittest.bash \
435 TESTS = $(dist_TESTS) $(nodist_TESTS)
437 # Environment for all tests
438 PLAIN_TESTS_ENVIRONMENT = \
439 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
441 # Environment for tests run by automake
442 TESTS_ENVIRONMENT = \
443 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
446 $(dist_sbin_SCRIPTS) \
447 $(dist_tools_SCRIPTS) \
448 $(pkglib_python_scripts) \
450 $(pkgpython_PYTHON) \
452 $(hypervisor_PYTHON) \
462 test/check-cert-expired_unittest.bash \
463 test/daemon-util_unittest.bash \
464 test/ganeti-cleaner_unittest.bash \
465 test/import-export_unittest.bash \
468 check_python_code = \
469 $(BUILD_BASH_COMPLETION) \
474 ganeti/http/server.py \
475 $(dist_sbin_SCRIPTS) \
476 $(dist_tools_SCRIPTS) \
477 $(pkglib_python_scripts) \
478 $(BUILD_BASH_COMPLETION)
480 test/daemon-util_unittest.bash: daemons/daemon-util
482 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
484 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
485 sed -f $(REPLACE_VARS_SED) < $< > $@
488 daemons/%: daemons/%.in \
490 sed -f $(REPLACE_VARS_SED) < $< > $@
493 doc/examples/%: doc/examples/%.in \
495 sed -f $(REPLACE_VARS_SED) < $< > $@
497 doc/examples/hooks/%: doc/examples/hooks/%.in \
499 sed -f $(REPLACE_VARS_SED) < $< > $@
501 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
502 lib/cli.py $(gnt_scripts) tools/burnin
503 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
506 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
507 $(DOT) -Tpng -o $@ $<
509 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
510 @test -n "$(DOCBOOK2MAN)" || \
511 { echo 'docbook2man' not found during configure; exit 1; }
512 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
513 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
515 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
516 @test -n "$(DOCBOOK2HTML)" || \
517 { echo 'docbook2html' not found during configure; exit 1; }
518 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
520 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
521 sed -f $(REPLACE_VARS_SED) < $< > $@
523 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
524 sed -f $(REPLACE_VARS_SED) < $< > $@
526 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
527 sed -f $(REPLACE_VARS_SED) < $< > $@
530 if test -d .git; then \
532 elif test ! -f $@ ; then \
533 echo "Cannot auto-generate $@ file"; exit 1; \
536 .PHONY: regen-vcs-version
540 if test -d .git; then \
542 $(MAKE) vcs-version; \
545 lib/_autoconf.py: Makefile stamp-directories vcs-version
547 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
548 { echo '# This file is automatically generated, do not edit!'; \
551 echo '"""Build-time configuration for Ganeti.'; \
553 echo 'This file is autogenerated by the build process.'; \
554 echo 'For any changes you need to re-run ./configure (and'; \
555 echo 'not edit by hand).'; \
559 echo '# pylint: disable-msg=C0301,C0324'; \
560 echo '# because this is autogenerated, we do not want'; \
561 echo '# style warnings' ; \
563 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
564 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
565 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
566 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
567 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
568 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
569 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
570 echo "SYSCONFDIR = '$(sysconfdir)'"; \
571 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
572 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
573 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
574 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
575 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
576 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
577 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
578 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
579 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
580 echo "KVM_PATH = '$(KVM_PATH)'"; \
581 echo "SOCAT_PATH = '$(SOCAT)'"; \
582 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
583 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
584 echo "TOOLSDIR = '$(toolsdir)'"; \
585 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
586 echo "PKGLIBDIR = '$(pkglibdir)'"; \
587 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
588 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
589 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
590 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
591 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
592 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
593 echo "RAPI_USER = '$(RAPI_USER)'"; \
594 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
595 echo "CONFD_USER = '$(CONFD_USER)'"; \
596 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
597 echo "NODED_USER = '$(NODED_USER)'"; \
598 echo "VCS_VERSION = '$$VCSVER'"; \
601 $(REPLACE_VARS_SED): Makefile
603 { echo 's#@PREFIX@#$(prefix)#g'; \
604 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
605 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
606 echo 's#@BINDIR@#$(bindir)#g'; \
607 echo 's#@SBINDIR@#$(sbindir)#g'; \
608 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
609 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
610 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
611 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
612 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
613 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
614 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
615 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
616 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
617 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
618 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
619 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
620 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
621 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
622 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
623 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
626 $(PYTHON_BOOTSTRAP): Makefile
628 module='$(subst -,_,$(notdir $@))'; \
629 { echo '#!/usr/bin/python'; \
630 echo '# This file is automatically generated, do not edit!'; \
631 echo "# Edit ganeti.client.$$module instead."; \
633 echo '"""Bootstrap script for L{ganeti.client.'"$$module"'}"""'; \
635 echo '# pylint: disable-msg=C0103'; \
636 echo '# C0103: Invalid name'; \
639 echo "from ganeti.client import $$module"; \
641 echo '# Temporarily alias commands until bash completion'; \
642 echo '# generator is changed'; \
643 echo "if hasattr($$module, \"commands\"):"; \
644 echo " commands = $$module.commands"; \
646 echo 'if __name__ == "__main__":'; \
647 echo " sys.exit($$module.Main())"; \
651 # We need to create symlinks because "make distcheck" will not install Python
652 # files when building.
653 stamp-srclinks: Makefile stamp-directories
655 for i in $(srclink_files); do \
656 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
657 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
664 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
667 check-dirs: $(BUILT_SOURCES)
669 find . -type d \( \( -name . \) -o \( \
671 -name autom4te.cache \
672 \) -prune -o -print \) | { \
676 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
677 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
680 for dir in $(DIRS); do \
681 if ! test -d "$$dir"; then \
682 echo "Directory $$dir listed in DIRS does not exist" >&2; \
686 if test -n "$$error"; then exit 1; else exit 0; fi; \
689 check-local: check-dirs
690 $(CHECK_PYTHON_CODE) $(check_python_code)
693 lint: ganeti $(BUILT_SOURCES)
694 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
695 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
697 # a dist hook rule for updating the vcs-version file; this is
698 # hardcoded due to where it needs to build the file...
700 $(MAKE) regen-vcs-version && \
701 rm -f $(top_distdir)/vcs-version && \
702 cp -p $(srcdir)/vcs-version $(top_distdir)
704 # a distcheck hook rule for catching revision control directories
706 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
707 echo "Found revision control files in final archive." 1>&2; \
710 if find $(top_distdir) -name '*.py[co]' | grep .; then \
711 echo "Found Python byte code in final archive." 1>&2; \
714 if find $(top_distdir) -name '*~' | grep .; then \
715 echo "Found backup files in final archive." 1>&2; \
720 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
721 "$(DESTDIR)${localstatedir}/log/ganeti" \
722 "$(DESTDIR)${localstatedir}/run/ganeti"
724 stamp-directories: Makefile
729 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
730 test -e doc/api || mkdir doc/api
731 $(RUN_IN_TEMPDIR) epydoc -v \
732 --conf $(CURDIR)/epydoc.conf \
733 --output $(CURDIR)/doc/api
736 TAGS: $(BUILT_SOURCES)
738 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
739 -path './daemons/ganeti-*' -o -path './tools/*' -o \
740 -path './qa/*.py' | \
744 coverage: $(BUILT_SOURCES) $(python_tests)
746 mkdir -p doc/coverage; \
747 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
748 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
749 HTML_COVERAGE=$(CURDIR)/doc/coverage \
750 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
753 commit-check: distcheck lint apidoc
755 -include ./Makefile.local