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 CHECK_VERSION = $(top_srcdir)/autotools/check-version
19 REPLACE_VARS_SED = autotools/replace_vars.sed
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 \
63 ganeti-[0-9]*.[0-9]*.[0-9]* \
66 MAINTAINERCLEANFILES = \
69 doc/install-quick.rst \
73 maintainer-clean-local:
74 rm -rf $(BUILDTIME_DIRS)
77 $(addsuffix /*.py[co],$(DIRS)) \
78 autotools/replace_vars.sed \
81 daemons/ganeti-cleaner \
83 doc/examples/bash_completion \
84 doc/examples/ganeti.initd \
85 doc/examples/ganeti.cron \
86 doc/examples/gnt-config-backup \
87 doc/examples/hooks/ipsec \
92 $(nodist_pkgpython_PYTHON)
100 nodist_pkgpython_PYTHON = \
104 lib/build/__init__.py
108 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
177 doc/cluster-merge.rst \
183 doc/install-quick.rst \
186 doc/move-instance.rst \
192 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
193 @test -n "$(SPHINX)" || \
194 { echo 'sphinx-build' not found during configure; exit 1; }
195 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
197 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
198 -D release="$(PACKAGE_VERSION)" \
199 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
200 rm -f doc/html/.buildinfo doc/html/objects.inv
203 doc/html: doc/html/.stamp
207 { echo '.. This file is automatically updated at build time from $<.'; \
208 echo '.. Do not edit.'; \
213 doc/install-quick.rst: INSTALL
215 { echo '.. This file is automatically updated at build time from $<.'; \
216 echo '.. Do not edit.'; \
223 doc/design-2.1-lock-acquire.dot \
224 doc/design-2.1-lock-release.dot
226 docpng = $(patsubst %.dot,%.png,$(docdot))
228 # Things to build but not to install (add it to EXTRA_DIST if it should be
233 doc/examples/bash_completion \
234 doc/examples/ganeti.cron \
235 doc/examples/ganeti.initd \
236 doc/examples/gnt-config-backup \
237 doc/examples/hooks/ipsec \
242 scripts/gnt-cluster \
244 scripts/gnt-instance \
249 dist_sbin_SCRIPTS = \
250 daemons/ganeti-noded \
251 daemons/ganeti-watcher \
252 daemons/ganeti-masterd \
253 daemons/ganeti-confd \
254 daemons/ganeti-rapi \
257 nodist_sbin_SCRIPTS = \
258 daemons/ganeti-cleaner
260 dist_tools_SCRIPTS = \
265 tools/cluster-merge \
267 tools/move-instance \
269 tools/sanitize-config
271 pkglib_python_scripts = \
272 daemons/import-export \
273 tools/check-cert-expired
276 daemons/daemon-util \
277 daemons/ensure-dirs \
278 $(pkglib_python_scripts)
283 autotools/build-bash-completion \
284 autotools/check-python-code \
285 autotools/check-man \
286 autotools/check-tar \
287 autotools/check-version \
288 autotools/docbook-wrapper \
289 autotools/gen-coverage \
290 autotools/testrunner \
292 daemons/daemon-util.in \
293 daemons/ensure-dirs.in \
294 daemons/ganeti-cleaner.in \
295 $(pkglib_python_scripts) \
302 doc/examples/ganeti.initd.in \
303 doc/examples/ganeti.cron.in \
304 doc/examples/gnt-config-backup.in \
305 doc/examples/dumb-allocator \
306 doc/examples/ganeti.default \
307 doc/examples/ganeti.default-debug \
308 doc/examples/hooks/ethers \
309 doc/examples/hooks/ipsec.in \
310 doc/examples/gnt-debug/README \
311 doc/examples/gnt-debug/delay0.json \
312 doc/examples/gnt-debug/delay50.json \
336 man/ganeti-cleaner.8 \
338 man/ganeti-masterd.8 \
340 man/ganeti-os-interface.7 \
342 man/ganeti-watcher.8 \
351 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
352 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
354 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
355 $(patsubst %.html,%.html.in,$(manhtml))
358 test/data/bdev-drbd-8.0.txt \
359 test/data/bdev-drbd-8.3.txt \
360 test/data/bdev-drbd-disk.txt \
361 test/data/bdev-drbd-net-ip4.txt \
362 test/data/bdev-drbd-net-ip6.txt \
363 test/data/cert1.pem \
364 test/data/proc_drbd8.txt \
365 test/data/proc_drbd80-emptyline.txt \
366 test/data/proc_drbd83.txt \
367 test/data/sys_drbd_usermode_helper.txt \
368 test/import-export_unittest-helper
371 test/ganeti.asyncnotifier_unittest.py \
372 test/ganeti.backend_unittest.py \
373 test/ganeti.bdev_unittest.py \
374 test/ganeti.cli_unittest.py \
375 test/ganeti.daemon_unittest.py \
376 test/ganeti.cmdlib_unittest.py \
377 test/ganeti.compat_unittest.py \
378 test/ganeti.confd.client_unittest.py \
379 test/ganeti.config_unittest.py \
380 test/ganeti.constants_unittest.py \
381 test/ganeti.errors_unittest.py \
382 test/ganeti.hooks_unittest.py \
383 test/ganeti.http_unittest.py \
384 test/ganeti.hypervisor.hv_kvm_unittest.py \
385 test/ganeti.impexpd_unittest.py \
386 test/ganeti.jqueue_unittest.py \
387 test/ganeti.locking_unittest.py \
388 test/ganeti.luxi_unittest.py \
389 test/ganeti.masterd.instance_unittest.py \
390 test/ganeti.mcpu_unittest.py \
391 test/ganeti.netutils_unittest.py \
392 test/ganeti.objects_unittest.py \
393 test/ganeti.opcodes_unittest.py \
394 test/ganeti.rapi.client_unittest.py \
395 test/ganeti.rapi.resources_unittest.py \
396 test/ganeti.rapi.rlib2_unittest.py \
397 test/ganeti.rpc_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 ganeti/http/server.py \
456 $(dist_sbin_SCRIPTS) \
457 $(dist_tools_SCRIPTS) \
458 $(pkglib_python_scripts) \
459 $(BUILD_BASH_COMPLETION)
461 test/daemon-util_unittest.bash: daemons/daemon-util
463 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
465 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
466 sed -f $(REPLACE_VARS_SED) < $< > $@
469 daemons/%: daemons/%.in \
471 sed -f $(REPLACE_VARS_SED) < $< > $@
474 doc/examples/%: doc/examples/%.in \
476 sed -f $(REPLACE_VARS_SED) < $< > $@
478 doc/examples/hooks/%: doc/examples/hooks/%.in \
480 sed -f $(REPLACE_VARS_SED) < $< > $@
482 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
483 lib/cli.py $(gnt_scripts) tools/burnin
484 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
487 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
488 $(DOT) -Tpng -o $@ $<
490 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
491 @test -n "$(DOCBOOK2MAN)" || \
492 { echo 'docbook2man' not found during configure; exit 1; }
493 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
494 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
496 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
497 @test -n "$(DOCBOOK2HTML)" || \
498 { echo 'docbook2html' not found during configure; exit 1; }
499 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
501 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
502 sed -f $(REPLACE_VARS_SED) < $< > $@
504 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
505 sed -f $(REPLACE_VARS_SED) < $< > $@
507 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
508 sed -f $(REPLACE_VARS_SED) < $< > $@
511 if test -d .git; then \
513 elif test ! -f $@ ; then \
514 echo "Cannot auto-generate $@ file"; exit 1; \
517 .PHONY: regen-vcs-version
521 if test -d .git; then \
523 $(MAKE) vcs-version; \
526 lib/_autoconf.py: Makefile stamp-directories vcs-version
528 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
529 { echo '# This file is automatically generated, do not edit!'; \
532 echo '"""Build-time configuration for Ganeti.'; \
534 echo 'This file is autogenerated by the build process.'; \
535 echo 'For any changes you need to re-run ./configure (and'; \
536 echo 'not edit by hand).'; \
540 echo '# pylint: disable-msg=C0301,C0324'; \
541 echo '# because this is autogenerated, we do not want'; \
542 echo '# style warnings' ; \
544 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
545 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
546 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
547 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
548 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
549 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
550 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
551 echo "SYSCONFDIR = '$(sysconfdir)'"; \
552 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
553 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
554 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
555 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
556 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
557 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
558 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
559 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
560 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
561 echo "KVM_PATH = '$(KVM_PATH)'"; \
562 echo "SOCAT_PATH = '$(SOCAT)'"; \
563 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
564 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
565 echo "TOOLSDIR = '$(toolsdir)'"; \
566 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
567 echo "PKGLIBDIR = '$(pkglibdir)'"; \
568 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
569 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
570 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
571 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
572 echo "RAPI_USER = '$(RAPI_USER)'"; \
573 echo "VCS_VERSION = '$$VCSVER'"; \
576 $(REPLACE_VARS_SED): Makefile
578 { echo 's#@PREFIX@#$(prefix)#g'; \
579 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
580 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
581 echo 's#@BINDIR@#$(bindir)#g'; \
582 echo 's#@SBINDIR@#$(sbindir)#g'; \
583 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
584 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
585 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
586 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
587 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
588 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
589 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
590 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
591 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
592 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
593 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
594 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
595 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
596 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
597 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
598 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
601 # We need to create symlinks because "make distcheck" will not install Python
602 # files when building.
603 stamp-srclinks: Makefile stamp-directories
605 for i in $(srclink_files); do \
606 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
607 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
614 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
617 check-dirs: $(BUILT_SOURCES)
619 find . -type d \( \( -name . \) -o \( \
621 -name autom4te.cache \
622 \) -prune -o -print \) | { \
626 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
627 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
630 for dir in $(DIRS); do \
631 if ! test -d "$$dir"; then \
632 echo "Directory $$dir listed in DIRS does not exist" >&2; \
636 if test -n "$$error"; then exit 1; else exit 0; fi; \
639 check-local: check-dirs
640 $(CHECK_PYTHON_CODE) $(check_python_code)
641 $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
644 lint: ganeti $(BUILT_SOURCES)
645 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
646 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
648 # a dist hook rule for updating the vcs-version file; this is
649 # hardcoded due to where it needs to build the file...
651 $(MAKE) regen-vcs-version && \
652 rm -f $(top_distdir)/vcs-version && \
653 cp -p $(srcdir)/vcs-version $(top_distdir)
655 # a distcheck hook rule for catching revision control directories
657 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
658 echo "Found revision control files in final archive." 1>&2; \
661 if find $(top_distdir) -name '*.py[co]' | grep .; then \
662 echo "Found Python byte code in final archive." 1>&2; \
665 if find $(top_distdir) -name '*~' | grep .; then \
666 echo "Found backup files in final archive." 1>&2; \
669 if test -n "$(BUILD_RELEASE)" && \
670 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
671 echo "Found unreleased version in NEWS." >&2; \
675 # When building a release, stricter checks should be used
676 distcheck-release dist-release: export BUILD_RELEASE = 1
677 distcheck-release: distcheck
681 for i in $(DIST_ARCHIVES); do \
682 echo -n "Checking $$i ... "; \
683 autotools/check-tar < $$i; \
688 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
689 "$(DESTDIR)${localstatedir}/log/ganeti" \
690 "$(DESTDIR)${localstatedir}/run/ganeti"
692 stamp-directories: Makefile
697 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
698 test -e doc/api || mkdir doc/api
699 $(RUN_IN_TEMPDIR) epydoc -v \
700 --conf $(CURDIR)/epydoc.conf \
701 --output $(CURDIR)/doc/api
704 TAGS: $(BUILT_SOURCES)
706 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
707 -path './daemons/ganeti-*' -o -path './tools/*' -o \
708 -path './qa/*.py' | \
712 coverage: $(BUILT_SOURCES) $(python_tests)
714 mkdir -p doc/coverage; \
715 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
716 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
717 HTML_COVERAGE=$(CURDIR)/doc/coverage \
718 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
721 commit-check: distcheck lint apidoc
723 -include ./Makefile.local