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
39 doc/examples/gnt-debug \
62 ganeti-[0-9]*.[0-9]*.[0-9]* \
65 MAINTAINERCLEANFILES = \
68 doc/install-quick.rst \
72 maintainer-clean-local:
73 rm -rf $(BUILDTIME_DIRS)
76 $(addsuffix /*.py[co],$(DIRS)) \
77 autotools/replace_vars.sed \
80 daemons/ganeti-cleaner \
82 doc/examples/bash_completion \
83 doc/examples/ganeti.initd \
84 doc/examples/ganeti.cron \
85 doc/examples/gnt-config-backup \
86 doc/examples/hooks/ipsec \
91 $(nodist_pkgpython_PYTHON)
99 nodist_pkgpython_PYTHON = \
103 lib/build/__init__.py
107 lib/asyncnotifier.py \
136 hypervisor_PYTHON = \
137 lib/hypervisor/__init__.py \
138 lib/hypervisor/hv_base.py \
139 lib/hypervisor/hv_chroot.py \
140 lib/hypervisor/hv_fake.py \
141 lib/hypervisor/hv_kvm.py \
142 lib/hypervisor/hv_lxc.py \
143 lib/hypervisor/hv_xen.py
146 lib/rapi/__init__.py \
147 lib/rapi/baserlib.py \
149 lib/rapi/client_utils.py \
150 lib/rapi/connector.py \
154 lib/http/__init__.py \
160 lib/confd/__init__.py \
161 lib/confd/client.py \
162 lib/confd/querylib.py \
166 lib/masterd/__init__.py \
167 lib/masterd/instance.py
170 lib/impexpd/__init__.py
178 doc/cluster-merge.rst \
184 doc/install-quick.rst \
187 doc/move-instance.rst \
193 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
194 @test -n "$(SPHINX)" || \
195 { echo 'sphinx-build' not found during configure; exit 1; }
196 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
198 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
199 -D release="$(PACKAGE_VERSION)" \
200 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
201 rm -f doc/html/.buildinfo doc/html/objects.inv
204 doc/html: doc/html/.stamp
208 { echo '.. This file is automatically updated at build time from $<.'; \
209 echo '.. Do not edit.'; \
214 doc/install-quick.rst: INSTALL
216 { echo '.. This file is automatically updated at build time from $<.'; \
217 echo '.. Do not edit.'; \
224 doc/design-2.1-lock-acquire.dot \
225 doc/design-2.1-lock-release.dot
227 docpng = $(patsubst %.dot,%.png,$(docdot))
229 # Things to build but not to install (add it to EXTRA_DIST if it should be
234 doc/examples/bash_completion \
235 doc/examples/ganeti.cron \
236 doc/examples/ganeti.initd \
237 doc/examples/gnt-config-backup \
238 doc/examples/hooks/ipsec \
243 scripts/gnt-cluster \
245 scripts/gnt-instance \
250 dist_sbin_SCRIPTS = \
251 daemons/ganeti-noded \
252 daemons/ganeti-watcher \
253 daemons/ganeti-masterd \
254 daemons/ganeti-confd \
255 daemons/ganeti-rapi \
258 nodist_sbin_SCRIPTS = \
259 daemons/ganeti-cleaner
261 dist_tools_SCRIPTS = \
266 tools/cluster-merge \
268 tools/move-instance \
270 tools/sanitize-config
272 pkglib_python_scripts = \
273 daemons/import-export \
274 tools/check-cert-expired
277 daemons/daemon-util \
278 daemons/ensure-dirs \
279 $(pkglib_python_scripts)
284 autotools/build-bash-completion \
285 autotools/check-python-code \
286 autotools/check-man \
287 autotools/docbook-wrapper \
288 autotools/gen-coverage \
289 autotools/testrunner \
291 daemons/daemon-util.in \
292 daemons/ensure-dirs.in \
293 daemons/ganeti-cleaner.in \
294 $(pkglib_python_scripts) \
301 doc/examples/ganeti.initd.in \
302 doc/examples/ganeti.cron.in \
303 doc/examples/gnt-config-backup.in \
304 doc/examples/dumb-allocator \
305 doc/examples/ganeti.default \
306 doc/examples/ganeti.default-debug \
307 doc/examples/hooks/ethers \
308 doc/examples/hooks/ipsec.in \
309 doc/examples/gnt-debug/README \
310 doc/examples/gnt-debug/delay0.json \
311 doc/examples/gnt-debug/delay50.json \
335 man/ganeti-cleaner.8 \
337 man/ganeti-masterd.8 \
339 man/ganeti-os-interface.7 \
341 man/ganeti-watcher.8 \
350 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
351 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
353 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
354 $(patsubst %.html,%.html.in,$(manhtml))
357 test/data/bdev-drbd-8.0.txt \
358 test/data/bdev-drbd-8.3.txt \
359 test/data/bdev-drbd-disk.txt \
360 test/data/bdev-drbd-net-ip4.txt \
361 test/data/bdev-drbd-net-ip6.txt \
362 test/data/cert1.pem \
363 test/data/proc_drbd8.txt \
364 test/data/proc_drbd80-emptyline.txt \
365 test/data/proc_drbd83.txt \
366 test/data/sys_drbd_usermode_helper.txt \
367 test/import-export_unittest-helper
370 test/ganeti.asyncnotifier_unittest.py \
371 test/ganeti.backend_unittest.py \
372 test/ganeti.bdev_unittest.py \
373 test/ganeti.cli_unittest.py \
374 test/ganeti.daemon_unittest.py \
375 test/ganeti.cmdlib_unittest.py \
376 test/ganeti.compat_unittest.py \
377 test/ganeti.confd.client_unittest.py \
378 test/ganeti.config_unittest.py \
379 test/ganeti.constants_unittest.py \
380 test/ganeti.errors_unittest.py \
381 test/ganeti.hooks_unittest.py \
382 test/ganeti.http_unittest.py \
383 test/ganeti.hypervisor.hv_kvm_unittest.py \
384 test/ganeti.impexpd_unittest.py \
385 test/ganeti.jqueue_unittest.py \
386 test/ganeti.locking_unittest.py \
387 test/ganeti.luxi_unittest.py \
388 test/ganeti.masterd.instance_unittest.py \
389 test/ganeti.mcpu_unittest.py \
390 test/ganeti.netutils_unittest.py \
391 test/ganeti.objects_unittest.py \
392 test/ganeti.opcodes_unittest.py \
393 test/ganeti.rapi.client_unittest.py \
394 test/ganeti.rapi.resources_unittest.py \
395 test/ganeti.rapi.rlib2_unittest.py \
396 test/ganeti.rpc_unittest.py \
397 test/ganeti.runtime_unittest.py \
398 test/ganeti.serializer_unittest.py \
399 test/ganeti.ssh_unittest.py \
400 test/ganeti.uidpool_unittest.py \
401 test/ganeti.utils_unittest.py \
402 test/ganeti.utils_mlockall_unittest.py \
403 test/ganeti.workerpool_unittest.py \
404 test/cfgupgrade_unittest.py \
405 test/docs_unittest.py \
406 test/tempfile_fork_unittest.py
409 test/check-cert-expired_unittest.bash \
410 test/daemon-util_unittest.bash \
411 test/ganeti-cleaner_unittest.bash \
412 test/import-export_unittest.bash \
417 TESTS = $(dist_TESTS) $(nodist_TESTS)
419 # Environment for all tests
420 PLAIN_TESTS_ENVIRONMENT = \
421 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
423 # Environment for tests run by automake
424 TESTS_ENVIRONMENT = \
425 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
428 $(dist_sbin_SCRIPTS) \
429 $(dist_tools_SCRIPTS) \
430 $(pkglib_python_scripts) \
432 $(pkgpython_PYTHON) \
433 $(hypervisor_PYTHON) \
443 test/check-cert-expired_unittest.bash \
444 test/daemon-util_unittest.bash \
445 test/ganeti-cleaner_unittest.bash \
446 test/import-export_unittest.bash \
449 check_python_code = \
450 $(BUILD_BASH_COMPLETION) \
455 $(dist_sbin_SCRIPTS) \
456 $(dist_tools_SCRIPTS) \
457 $(pkglib_python_scripts) \
458 $(BUILD_BASH_COMPLETION)
460 test/daemon-util_unittest.bash: daemons/daemon-util
462 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
464 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
465 sed -f $(REPLACE_VARS_SED) < $< > $@
468 daemons/%: daemons/%.in \
470 sed -f $(REPLACE_VARS_SED) < $< > $@
473 doc/examples/%: doc/examples/%.in \
475 sed -f $(REPLACE_VARS_SED) < $< > $@
477 doc/examples/hooks/%: doc/examples/hooks/%.in \
479 sed -f $(REPLACE_VARS_SED) < $< > $@
481 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
482 lib/cli.py $(gnt_scripts) tools/burnin
483 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
486 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
487 $(DOT) -Tpng -o $@ $<
489 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
490 @test -n "$(DOCBOOK2MAN)" || \
491 { echo 'docbook2man' not found during configure; exit 1; }
492 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
493 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
495 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
496 @test -n "$(DOCBOOK2HTML)" || \
497 { echo 'docbook2html' not found during configure; exit 1; }
498 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
500 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
501 sed -f $(REPLACE_VARS_SED) < $< > $@
503 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
504 sed -f $(REPLACE_VARS_SED) < $< > $@
506 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
507 sed -f $(REPLACE_VARS_SED) < $< > $@
510 if test -d .git; then \
512 elif test ! -f $@ ; then \
513 echo "Cannot auto-generate $@ file"; exit 1; \
516 .PHONY: regen-vcs-version
520 if test -d .git; then \
522 $(MAKE) vcs-version; \
525 lib/_autoconf.py: Makefile stamp-directories vcs-version
527 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
528 { echo '# This file is automatically generated, do not edit!'; \
531 echo '"""Build-time configuration for Ganeti.'; \
533 echo 'This file is autogenerated by the build process.'; \
534 echo 'For any changes you need to re-run ./configure (and'; \
535 echo 'not edit by hand).'; \
539 echo '# pylint: disable-msg=C0301,C0324'; \
540 echo '# because this is autogenerated, we do not want'; \
541 echo '# style warnings' ; \
543 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
544 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
545 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
546 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
547 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
548 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
549 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
550 echo "SYSCONFDIR = '$(sysconfdir)'"; \
551 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
552 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
553 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
554 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
555 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
556 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
557 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
558 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
559 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
560 echo "KVM_PATH = '$(KVM_PATH)'"; \
561 echo "SOCAT_PATH = '$(SOCAT)'"; \
562 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
563 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
564 echo "TOOLSDIR = '$(toolsdir)'"; \
565 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
566 echo "PKGLIBDIR = '$(pkglibdir)'"; \
567 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
568 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
569 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
570 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
571 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
572 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
573 echo "RAPI_USER = '$(RAPI_USER)'"; \
574 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
575 echo "CONFD_USER = '$(CONFD_USER)'"; \
576 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
577 echo "NODED_USER = '$(NODED_USER)'"; \
578 echo "VCS_VERSION = '$$VCSVER'"; \
581 $(REPLACE_VARS_SED): Makefile
583 { echo 's#@PREFIX@#$(prefix)#g'; \
584 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
585 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
586 echo 's#@BINDIR@#$(bindir)#g'; \
587 echo 's#@SBINDIR@#$(sbindir)#g'; \
588 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
589 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
590 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
591 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
592 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
593 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
594 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
595 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
596 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
597 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
598 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
599 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
600 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
601 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
602 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
603 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
606 # We need to create symlinks because "make distcheck" will not install Python
607 # files when building.
608 stamp-srclinks: Makefile stamp-directories
610 for i in $(srclink_files); do \
611 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
612 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
619 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
622 check-dirs: $(BUILT_SOURCES)
624 find . -type d \( \( -name . \) -o \( \
626 -name autom4te.cache \
627 \) -prune -o -print \) | { \
631 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
632 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
635 for dir in $(DIRS); do \
636 if ! test -d "$$dir"; then \
637 echo "Directory $$dir listed in DIRS does not exist" >&2; \
641 if test -n "$$error"; then exit 1; else exit 0; fi; \
644 check-local: check-dirs
645 $(CHECK_PYTHON_CODE) $(check_python_code)
648 lint: ganeti $(BUILT_SOURCES)
649 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
650 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
652 # a dist hook rule for updating the vcs-version file; this is
653 # hardcoded due to where it needs to build the file...
655 $(MAKE) regen-vcs-version && \
656 rm -f $(top_distdir)/vcs-version && \
657 cp -p $(srcdir)/vcs-version $(top_distdir)
659 # a distcheck hook rule for catching revision control directories
661 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
662 echo "Found revision control files in final archive." 1>&2; \
665 if find $(top_distdir) -name '*.py[co]' | grep .; then \
666 echo "Found Python byte code in final archive." 1>&2; \
669 if find $(top_distdir) -name '*~' | grep .; then \
670 echo "Found backup files in final archive." 1>&2; \
675 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
676 "$(DESTDIR)${localstatedir}/log/ganeti" \
677 "$(DESTDIR)${localstatedir}/run/ganeti"
679 stamp-directories: Makefile
684 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
685 test -e doc/api || mkdir doc/api
686 $(RUN_IN_TEMPDIR) epydoc -v \
687 --conf $(CURDIR)/epydoc.conf \
688 --output $(CURDIR)/doc/api
691 TAGS: $(BUILT_SOURCES)
693 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
694 -path './daemons/ganeti-*' -o -path './tools/*' -o \
695 -path './qa/*.py' | \
699 coverage: $(BUILT_SOURCES) $(python_tests)
701 mkdir -p doc/coverage; \
702 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
703 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
704 HTML_COVERAGE=$(CURDIR)/doc/coverage \
705 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
708 commit-check: distcheck lint apidoc
710 -include ./Makefile.local