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 # Use bash in order to be able to use pipefail
15 ACLOCAL_AMFLAGS = -I autotools
16 BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
17 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
18 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
19 CHECK_MAN = $(top_srcdir)/autotools/check-man
20 CHECK_VERSION = $(top_srcdir)/autotools/check-version
21 CHECK_NEWS = $(top_srcdir)/autotools/check-news
22 DOCPP = $(top_srcdir)/autotools/docpp
23 REPLACE_VARS_SED = autotools/replace_vars.sed
24 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
26 # Note: these are automake-specific variables, and must be named after
27 # the directory + 'dir' suffix
28 clientdir = $(pkgpythondir)/client
29 hypervisordir = $(pkgpythondir)/hypervisor
30 httpdir = $(pkgpythondir)/http
31 masterddir = $(pkgpythondir)/masterd
32 confddir = $(pkgpythondir)/confd
33 rapidir = $(pkgpythondir)/rapi
34 serverdir = $(pkgpythondir)/server
35 watcherdir = $(pkgpythondir)/watcher
36 impexpddir = $(pkgpythondir)/impexpd
37 utilsdir = $(pkgpythondir)/utils
38 toolsdir = $(pkglibdir)/tools
39 iallocatorsdir = $(pkglibdir)/iallocators
40 pytoolsdir = $(pkgpythondir)/tools
41 docdir = $(datadir)/doc/$(PACKAGE)
43 # Delete output file if an error occurred while building it
58 doc/examples/gnt-debug \
79 BUILDTIME_DIR_AUTOCREATE = \
84 $(APIDOC_HS_DIR)/Ganeti $(APIDOC_HS_DIR)/Ganeti/HTools \
91 $(BUILDTIME_DIR_AUTOCREATE) \
96 ganeti-[0-9]*.[0-9]*.[0-9]* \
99 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
102 COVERAGE_DIR = doc/coverage
103 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
104 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
106 APIDOC_PY_DIR = $(APIDOC_DIR)/py
107 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
109 MAINTAINERCLEANFILES = \
112 doc/install-quick.rst \
117 maintainer-clean-local:
118 rm -rf $(BUILDTIME_DIRS)
121 $(addsuffix /*.py[co],$(DIRS)) \
122 $(addsuffix /*.hi,$(HTOOLS_DIRS)) \
123 $(addsuffix /*.o,$(HTOOLS_DIRS)) \
125 $(PYTHON_BOOTSTRAP) \
127 autotools/replace_vars.sed \
128 daemons/daemon-util \
129 daemons/ganeti-cleaner \
131 doc/examples/bash_completion \
132 doc/examples/ganeti.initd \
133 doc/examples/ganeti-kvm-poweroff.initd \
134 doc/examples/ganeti.cron \
135 doc/examples/gnt-config-backup \
136 doc/examples/hooks/ipsec \
141 $(nodist_pkgpython_PYTHON) \
142 $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
143 .hpc/*.mix htools/*.tix \
146 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
147 # it'll cause the target to rebuild every time.
155 nodist_pkgpython_PYTHON = \
159 lib/build/__init__.py \
160 lib/build/sphinx_ext.py
164 lib/asyncnotifier.py \
196 lib/client/__init__.py \
197 lib/client/gnt_backup.py \
198 lib/client/gnt_cluster.py \
199 lib/client/gnt_debug.py \
200 lib/client/gnt_group.py \
201 lib/client/gnt_instance.py \
202 lib/client/gnt_job.py \
203 lib/client/gnt_node.py \
206 hypervisor_PYTHON = \
207 lib/hypervisor/__init__.py \
208 lib/hypervisor/hv_base.py \
209 lib/hypervisor/hv_chroot.py \
210 lib/hypervisor/hv_fake.py \
211 lib/hypervisor/hv_kvm.py \
212 lib/hypervisor/hv_lxc.py \
213 lib/hypervisor/hv_xen.py
216 lib/rapi/__init__.py \
217 lib/rapi/baserlib.py \
219 lib/rapi/client_utils.py \
220 lib/rapi/connector.py \
224 lib/http/__init__.py \
230 lib/confd/__init__.py \
231 lib/confd/client.py \
232 lib/confd/querylib.py \
236 lib/masterd/__init__.py \
237 lib/masterd/instance.py
240 lib/impexpd/__init__.py
243 lib/watcher/__init__.py
246 lib/server/__init__.py \
247 lib/server/confd.py \
248 lib/server/masterd.py \
249 lib/server/noded.py \
253 lib/tools/__init__.py \
254 lib/tools/ensure_dirs.py
257 lib/utils/__init__.py \
259 lib/utils/filelock.py \
264 lib/utils/nodesetup.py \
265 lib/utils/process.py \
268 lib/utils/wrapper.py \
277 doc/design-htools-2.3.rst \
279 doc/design-draft.rst \
281 doc/design-cpu-pinning.rst \
282 doc/design-query2.rst \
283 doc/design-x509-ca.rst \
284 doc/design-http-server.rst \
285 doc/design-impexp2.rst \
286 doc/design-lu-generated-jobs.rst \
287 doc/design-multi-reloc.rst \
288 doc/design-network.rst \
289 doc/design-chained-jobs.rst \
290 doc/cluster-merge.rst \
291 doc/design-shared-storage.rst \
297 doc/install-quick.rst \
300 doc/move-instance.rst \
313 HS_ALL_PROGS = $(HS_PROGS) htools/test
314 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
315 # we don't add -Werror by default
316 HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
317 # extra flags that can be overriden on the command line
319 # exclude options for coverage reports
320 HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC \
321 --exclude Ganeti.Constants \
322 --exclude Ganeti.HTools.Version
325 htools/Ganeti/HTools/CLI.hs \
326 htools/Ganeti/HTools/Cluster.hs \
327 htools/Ganeti/HTools/Container.hs \
328 htools/Ganeti/HTools/ExtLoader.hs \
329 htools/Ganeti/HTools/Group.hs \
330 htools/Ganeti/HTools/IAlloc.hs \
331 htools/Ganeti/HTools/Instance.hs \
332 htools/Ganeti/HTools/Loader.hs \
333 htools/Ganeti/HTools/Luxi.hs \
334 htools/Ganeti/HTools/Node.hs \
335 htools/Ganeti/HTools/PeerMap.hs \
336 htools/Ganeti/HTools/QC.hs \
337 htools/Ganeti/HTools/Rapi.hs \
338 htools/Ganeti/HTools/Simu.hs \
339 htools/Ganeti/HTools/Text.hs \
340 htools/Ganeti/HTools/Types.hs \
341 htools/Ganeti/HTools/Utils.hs \
342 htools/Ganeti/Jobs.hs \
343 htools/Ganeti/Luxi.hs \
344 htools/Ganeti/OpCodes.hs
346 HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
347 HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
349 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
351 # Note: we use here an order-only prerequisite, as the contents of
352 # _autoconf.py are not actually influencing the html build output: it
353 # has to exist in order for the sphinx module to be loaded
354 # successfully, but we certainly don't want the docs to be rebuilt if
356 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
357 $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
359 @test -n "$(SPHINX)" || \
360 { echo 'sphinx-build' not found during configure; exit 1; }
362 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
364 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
365 -D release="$(PACKAGE_VERSION)" \
366 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
367 rm -f doc/html/.buildinfo doc/html/objects.inv
370 doc/html: doc/html/index.html
372 doc/install-quick.rst: INSTALL
374 doc/upgrade.rst: UPGRADE
376 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
378 { echo '.. This file is automatically updated at build time from $<.'; \
379 echo '.. Do not edit.'; \
386 doc/design-2.1-lock-acquire.dot \
387 doc/design-2.1-lock-release.dot
389 docpng = $(patsubst %.dot,%.png,$(docdot))
391 # Things to build but not to install (add it to EXTRA_DIST if it should be
396 doc/examples/bash_completion \
397 doc/examples/ganeti.cron \
398 doc/examples/ganeti.initd \
399 doc/examples/ganeti-kvm-poweroff.initd \
400 doc/examples/gnt-config-backup \
401 doc/examples/hooks/ipsec \
406 scripts/gnt-cluster \
409 scripts/gnt-instance \
414 PYTHON_BOOTSTRAP_SBIN = \
415 daemons/ganeti-confd \
416 daemons/ganeti-masterd \
417 daemons/ganeti-noded \
418 daemons/ganeti-watcher \
419 daemons/ganeti-rapi \
421 scripts/gnt-cluster \
424 scripts/gnt-instance \
430 $(PYTHON_BOOTSTRAP_SBIN) \
448 iallocators_SCRIPTS =
450 bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
451 iallocators_SCRIPTS += $(filter htools/hail,$(HS_PROGS))
454 $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
455 @if [ -z "$(HTOOLS)" ]; then \
456 echo "Error: htools compilation disabled at configure time" 1>&2 ;\
459 @BINARY=$(@:htools/%=%); \
460 if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
461 echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
464 BINARY=$(@:htools/%=%); $(GHC) --make \
465 $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
466 -osuf $$BINARY.o -hisuf $$BINARY.hi $@
468 # for the htools/test binary, we need to enable profiling/coverage
469 htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
470 -fno-warn-monomorphism-restriction -fno-warn-orphans \
471 -fno-warn-missing-methods -fno-warn-unused-imports
473 dist_sbin_SCRIPTS = \
474 tools/ganeti-listrunner
476 nodist_sbin_SCRIPTS = \
477 $(PYTHON_BOOTSTRAP_SBIN) \
478 daemons/ganeti-cleaner
480 dist_tools_PYTHON = \
485 tools/cluster-merge \
487 tools/move-instance \
489 tools/sanitize-config
491 dist_tools_SCRIPTS = \
492 $(dist_tools_PYTHON) \
493 tools/kvm-console-wrapper \
494 tools/xm-console-wrapper
496 pkglib_python_scripts = \
497 daemons/import-export \
498 tools/check-cert-expired
500 nodist_pkglib_python_scripts = \
504 daemons/daemon-util \
506 $(pkglib_python_scripts)
508 nodist_pkglib_SCRIPTS = \
509 $(nodist_pkglib_python_scripts)
516 autotools/build-bash-completion \
517 autotools/check-python-code \
518 autotools/check-man \
519 autotools/check-news \
520 autotools/check-tar \
521 autotools/check-version \
522 autotools/convert-constants \
524 autotools/gen-coverage \
525 autotools/testrunner \
527 daemons/daemon-util.in \
528 daemons/ganeti-cleaner.in \
529 $(pkglib_python_scripts) \
537 doc/examples/ganeti.initd.in \
538 doc/examples/ganeti-kvm-poweroff.initd.in \
539 doc/examples/ganeti.cron.in \
540 doc/examples/gnt-config-backup.in \
541 doc/examples/ganeti.default \
542 doc/examples/ganeti.default-debug \
543 doc/examples/hooks/ethers \
544 doc/examples/hooks/ipsec.in \
545 doc/examples/gnt-debug/README \
546 doc/examples/gnt-debug/delay0.json \
547 doc/examples/gnt-debug/delay50.json \
557 $(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
562 man/ganeti-cleaner.8 \
564 man/ganeti-listrunner.8 \
565 man/ganeti-masterd.8 \
567 man/ganeti-os-interface.7 \
569 man/ganeti-watcher.8 \
583 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
584 manhtml = $(patsubst %.rst,%.html,$(manrst))
585 mangen = $(patsubst %.rst,%.gen,$(manrst))
587 $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
588 $(patsubst %.html,%.html.in,$(manhtml)) \
589 man/footer.man man/footer.html $(mangen)
592 test/data/bdev-drbd-8.0.txt \
593 test/data/bdev-drbd-8.3.txt \
594 test/data/bdev-drbd-disk.txt \
595 test/data/bdev-drbd-net-ip4.txt \
596 test/data/bdev-drbd-net-ip6.txt \
597 test/data/cert1.pem \
598 test/data/proc_drbd8.txt \
599 test/data/proc_drbd80-emptyline.txt \
600 test/data/proc_drbd83.txt \
601 test/data/sys_drbd_usermode_helper.txt \
602 test/import-export_unittest-helper
605 test/ganeti.asyncnotifier_unittest.py \
606 test/ganeti.backend_unittest.py \
607 test/ganeti.bdev_unittest.py \
608 test/ganeti.cli_unittest.py \
609 test/ganeti.client.gnt_cluster_unittest.py \
610 test/ganeti.client.gnt_instance_unittest.py \
611 test/ganeti.daemon_unittest.py \
612 test/ganeti.cmdlib_unittest.py \
613 test/ganeti.compat_unittest.py \
614 test/ganeti.confd.client_unittest.py \
615 test/ganeti.config_unittest.py \
616 test/ganeti.constants_unittest.py \
617 test/ganeti.errors_unittest.py \
618 test/ganeti.hooks_unittest.py \
619 test/ganeti.ht_unittest.py \
620 test/ganeti.http_unittest.py \
621 test/ganeti.hypervisor_unittest.py \
622 test/ganeti.hypervisor.hv_chroot_unittest.py \
623 test/ganeti.hypervisor.hv_fake_unittest.py \
624 test/ganeti.hypervisor.hv_kvm_unittest.py \
625 test/ganeti.hypervisor.hv_lxc_unittest.py \
626 test/ganeti.hypervisor.hv_xen_unittest.py \
627 test/ganeti.impexpd_unittest.py \
628 test/ganeti.jqueue_unittest.py \
629 test/ganeti.locking_unittest.py \
630 test/ganeti.luxi_unittest.py \
631 test/ganeti.masterd.instance_unittest.py \
632 test/ganeti.mcpu_unittest.py \
633 test/ganeti.netutils_unittest.py \
634 test/ganeti.objects_unittest.py \
635 test/ganeti.opcodes_unittest.py \
636 test/ganeti.qlang_unittest.py \
637 test/ganeti.query_unittest.py \
638 test/ganeti.rapi.baserlib_unittest.py \
639 test/ganeti.rapi.client_unittest.py \
640 test/ganeti.rapi.resources_unittest.py \
641 test/ganeti.rapi.rlib2_unittest.py \
642 test/ganeti.rpc_unittest.py \
643 test/ganeti.runtime_unittest.py \
644 test/ganeti.serializer_unittest.py \
645 test/ganeti.ssh_unittest.py \
646 test/ganeti.tools.ensure_dirs_unittest.py \
647 test/ganeti.uidpool_unittest.py \
648 test/ganeti.utils.algo_unittest.py \
649 test/ganeti.utils.filelock_unittest.py \
650 test/ganeti.utils.hash_unittest.py \
651 test/ganeti.utils.io_unittest.py \
652 test/ganeti.utils.log_unittest.py \
653 test/ganeti.utils.mlock_unittest.py \
654 test/ganeti.utils.nodesetup_unittest.py \
655 test/ganeti.utils.process_unittest.py \
656 test/ganeti.utils.retry_unittest.py \
657 test/ganeti.utils.text_unittest.py \
658 test/ganeti.utils.wrapper_unittest.py \
659 test/ganeti.utils.x509_unittest.py \
660 test/ganeti.utils_unittest.py \
661 test/ganeti.workerpool_unittest.py \
662 test/cfgupgrade_unittest.py \
663 test/docs_unittest.py \
664 test/tempfile_fork_unittest.py
666 haskell_tests = htools/test
669 test/check-cert-expired_unittest.bash \
670 test/daemon-util_unittest.bash \
671 test/ganeti-cleaner_unittest.bash \
672 test/import-export_unittest.bash \
677 nodist_TESTS += $(haskell_tests)
680 TESTS = $(dist_TESTS) $(nodist_TESTS)
682 # Environment for all tests
683 PLAIN_TESTS_ENVIRONMENT = \
684 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
686 # Environment for tests run by automake
687 TESTS_ENVIRONMENT = \
688 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
691 $(dist_sbin_SCRIPTS) \
692 $(dist_tools_PYTHON) \
693 $(pkglib_python_scripts) \
694 $(nodist_pkglib_python_scripts) \
696 $(pkgpython_PYTHON) \
698 $(hypervisor_PYTHON) \
713 test/check-cert-expired_unittest.bash \
714 test/daemon-util_unittest.bash \
715 test/ganeti-cleaner_unittest.bash \
716 test/import-export_unittest.bash \
718 $(HS_LIB_SRCS) $(HS_PROG_SRCS)
720 check_python_code = \
721 $(BUILD_BASH_COMPLETION) \
727 ganeti/http/server.py \
728 $(dist_sbin_SCRIPTS) \
729 $(dist_tools_PYTHON) \
730 $(pkglib_python_scripts) \
731 $(BUILD_BASH_COMPLETION) \
735 test/daemon-util_unittest.bash: daemons/daemon-util
737 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
739 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
740 sed -f $(REPLACE_VARS_SED) < $< > $@
743 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
744 sed -f $(REPLACE_VARS_SED) < $< > $@
747 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
748 sed -f $(REPLACE_VARS_SED) < $< > $@
751 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
752 sed -f $(REPLACE_VARS_SED) < $< > $@
754 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
755 sed -f $(REPLACE_VARS_SED) < $< > $@
757 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
758 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
759 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
762 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
763 $(DOT) -Tpng -o $@ $<
765 man/footer.man: man/footer.rst
766 @test -n "$(PANDOC)" || \
767 { echo 'pandoc' not found during configure; exit 1; }
768 $(PANDOC) -f rst -t man -o $@ $<
770 man/footer.html: man/footer.rst
771 @test -n "$(PANDOC)" || \
772 { echo 'pandoc' not found during configure; exit 1; }
773 $(PANDOC) -f rst -t html -o $@ $<
775 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
776 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
778 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
779 @test -n "$(PANDOC)" || \
780 { echo 'pandoc' not found during configure; exit 1; }
782 $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
783 sed -e 's/\\@/@/g' > $@
784 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
786 man/%.html.in: man/%.gen man/footer.html
787 @test -n "$(PANDOC)" || \
788 { echo 'pandoc' not found during configure; exit 1; }
790 $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
791 sed -e 's/\\@/@/g' > $@
793 man/%.1: man/%.1.in $(REPLACE_VARS_SED)
794 sed -f $(REPLACE_VARS_SED) < $< > $@
796 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
797 sed -f $(REPLACE_VARS_SED) < $< > $@
799 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
800 sed -f $(REPLACE_VARS_SED) < $< > $@
802 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
803 sed -f $(REPLACE_VARS_SED) < $< > $@
805 epydoc.conf: epydoc.conf.in Makefile
806 sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
809 if test -d .git; then \
811 elif test ! -f $@ ; then \
812 echo "Cannot auto-generate $@ file"; exit 1; \
815 .PHONY: regen-vcs-version
819 if test -d .git; then \
821 $(MAKE) vcs-version; \
824 htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
826 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
827 sed -e "s/%ver%/$$VCSVER/" < $< > $@
829 htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
830 lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS)
832 { cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
834 lib/_autoconf.py: Makefile vcs-version | lib/.dir
836 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
837 { echo '# This file is automatically generated, do not edit!'; \
840 echo '"""Build-time configuration for Ganeti.'; \
842 echo 'This file is autogenerated by the build process.'; \
843 echo 'For any changes you need to re-run ./configure (and'; \
844 echo 'not edit by hand).'; \
848 echo '# pylint: disable-msg=C0301,C0324'; \
849 echo '# because this is autogenerated, we do not want'; \
850 echo '# style warnings' ; \
852 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
853 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
854 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
855 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
856 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
857 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
858 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
859 echo "SYSCONFDIR = '$(sysconfdir)'"; \
860 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
861 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
862 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
863 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
864 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
865 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
866 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
867 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
868 echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
869 echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
870 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
871 echo "KVM_PATH = '$(KVM_PATH)'"; \
872 echo "SOCAT_PATH = '$(SOCAT)'"; \
873 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
874 echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
875 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
876 echo "TOOLSDIR = '$(toolsdir)'"; \
877 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
878 echo "PKGLIBDIR = '$(pkglibdir)'"; \
879 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
880 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
881 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
882 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
883 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
884 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
885 echo "RAPI_USER = '$(RAPI_USER)'"; \
886 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
887 echo "CONFD_USER = '$(CONFD_USER)'"; \
888 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
889 echo "NODED_USER = '$(NODED_USER)'"; \
890 echo "NODED_GROUP = '$(NODED_GROUP)'"; \
891 echo "VCS_VERSION = '$$VCSVER'"; \
892 echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
893 if [ "$(HTOOLS)" ]; then \
894 echo "HTOOLS = True"; \
896 echo "HTOOLS = False"; \
900 $(REPLACE_VARS_SED): Makefile
902 { echo 's#@PREFIX@#$(prefix)#g'; \
903 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
904 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
905 echo 's#@BINDIR@#$(bindir)#g'; \
906 echo 's#@SBINDIR@#$(sbindir)#g'; \
907 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
908 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
909 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
910 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
911 echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
912 echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
913 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
914 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
915 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
916 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
917 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
918 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
919 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
920 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
921 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
922 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
923 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
924 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
927 # Using deferred evaluation
928 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
929 daemons/ganeti-watcher: MODULE = ganeti.watcher
930 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
931 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
933 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
934 test -n "$(MODULE)" || { echo Missing module; exit 1; }
936 { echo '#!/usr/bin/python'; \
937 echo '# This file is automatically generated, do not edit!'; \
938 echo "# Edit $(MODULE) instead."; \
940 echo '"""Bootstrap script for L{$(MODULE)}"""'; \
942 echo '# pylint: disable-msg=C0103'; \
943 echo '# C0103: Invalid name'; \
946 echo 'import $(MODULE) as main'; \
948 echo '# Temporarily alias commands until bash completion'; \
949 echo '# generator is changed'; \
950 echo 'if hasattr(main, "commands"):'; \
951 echo ' commands = main.commands # pylint: disable-msg=E1101'; \
953 echo 'if __name__ == "__main__":'; \
954 echo ' sys.exit(main.Main())'; \
958 # We need to create symlinks because "make distcheck" will not install Python
959 # files when building.
960 stamp-srclinks: Makefile | $(all_dirfiles)
962 for i in $(srclink_files); do \
963 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
964 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
971 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
974 check-dirs: $(BUILT_SOURCES)
976 find . -type d \( \( -name . \) -o \( \
978 -name autom4te.cache \
979 \) -prune -o -print \) | { \
983 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
984 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
987 for dir in $(DIRS); do \
988 if ! test -d "$$dir"; then \
989 echo "Directory $$dir listed in DIRS does not exist" >&2; \
993 if test -n "$$error"; then exit 1; else exit 0; fi; \
996 check-local: check-dirs
997 $(CHECK_PYTHON_CODE) $(check_python_code)
998 $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
999 $(CHECK_NEWS) < $(top_srcdir)/NEWS
1000 expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1001 if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1002 echo "Incorrect version in README, expected $$expver"; \
1005 if test "`sed -ne '4 p' $(top_srcdir)/doc/iallocator.rst`" != \
1006 "Documents Ganeti version $$expver"; then \
1007 echo "Incorrect version in iallocator.rst, expected $$expver"; \
1012 hs-check: htools/test
1017 lint: $(BUILT_SOURCES)
1018 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1019 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
1020 cd $(top_srcdir)/qa && \
1021 PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1022 --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1025 hlint: $(HS_BUILT_SRCS)
1026 if tty -s; then C="-c"; else C=""; fi; \
1027 hlint --report=doc/hs-lint.html $$C htools
1029 # a dist hook rule for updating the vcs-version file; this is
1030 # hardcoded due to where it needs to build the file...
1032 $(MAKE) regen-vcs-version && \
1033 rm -f $(top_distdir)/vcs-version && \
1034 cp -p $(srcdir)/vcs-version $(top_distdir)
1036 # a distcheck hook rule for catching revision control directories
1038 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1039 echo "Found revision control files in final archive." 1>&2; \
1042 if find $(top_distdir) -name '*.py[co]' | grep .; then \
1043 echo "Found Python byte code in final archive." 1>&2; \
1046 if find $(top_distdir) -name '*~' | grep .; then \
1047 echo "Found backup files in final archive." 1>&2; \
1050 # Empty files or directories should not be distributed. They can cause
1051 # unnecessary warnings for packagers. Directories used by automake during
1052 # distcheck must be excluded.
1053 if find $(top_distdir) -empty -and -not \( \
1054 -path $(top_distdir)/_build -or \
1055 -path $(top_distdir)/_inst \) | grep .; then \
1056 echo "Found empty files or directories in final archive." 1>&2; \
1059 if test -n "$(BUILD_RELEASE)" && \
1060 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1061 echo "Found unreleased version in NEWS." >&2; \
1065 # When building a release, stricter checks should be used
1066 distcheck-release dist-release: export BUILD_RELEASE = 1
1067 distcheck-release: distcheck
1071 for i in $(DIST_ARCHIVES); do \
1072 echo -n "Checking $$i ... "; \
1073 autotools/check-tar < $$i; \
1078 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1079 "$(DESTDIR)${localstatedir}/log/ganeti" \
1080 "$(DESTDIR)${localstatedir}/run/ganeti"
1082 # To avoid conflicts between directory names and other targets, a file inside
1083 # the directory is used to ensure its existence.
1085 @mkdir_p@ $* && touch $@
1088 if WANT_HTOOLSAPIDOC
1089 apidoc: py-apidoc hs-apidoc
1095 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1096 $(RUN_IN_TEMPDIR) epydoc -v \
1097 --conf $(CURDIR)/epydoc.conf \
1098 --output $(CURDIR)/$(APIDOC_PY_DIR)
1101 hs-apidoc: $(HS_BUILT_SRCS)
1102 @test -n "$(HSCOLOUR)" || \
1103 { echo 'HsColour' not found during configure; exit 1; }
1104 @test -n "$(HADDOCK)" || \
1105 { echo 'haddock' not found during configure; exit 1; }
1106 rm -rf $(APIDOC_HS_DIR)/*
1107 @mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools
1108 $(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1109 ln -s ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1112 if [ "$(HTOOLS_NOCURL)" ]; \
1113 then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1116 RELSRCS="$(HS_LIB_SRCS:htools/%=%) $(HS_BUILT_SRCS:htools/%=%)"; \
1117 for file in $$RELSRCS; do \
1118 hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1119 $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1121 $(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1122 -t ganeti-htools -p haddock-prologue \
1123 --source-module="%{MODULE/.//}.html" \
1124 --source-entity="%{MODULE/.//}.html#%{NAME}" \
1126 $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1129 TAGS: $(BUILT_SOURCES)
1131 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1132 -path './daemons/ganeti-*' -o -path './tools/*' -o \
1133 -path './qa/*.py' | \
1138 coverage: py-coverage hs-coverage
1140 coverage: py-coverage
1144 py-coverage: $(BUILT_SOURCES) $(python_tests)
1146 COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1147 TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1148 HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1149 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1153 hs-coverage: $(haskell_tests)
1154 cd htools && rm -f *.tix *.mix && ./test
1155 @mkdir_p@ $(COVERAGE_HS_DIR)
1156 hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1157 hpc report htools/test $(HPCEXCL)
1158 ln -sf hpc_index.html $(COVERAGE_HS_DIR)/index.html
1160 # Special "kind-of-QA" target for htools, needs special setup (all
1161 # tools compiled with -fhpc)
1166 rm -f .hpc; ln -s ../.hpc .hpc; \
1167 rm -f *.tix *.mix; \
1169 hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1170 --output=live-test.tix ; \
1171 @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1172 hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1173 --srcdir=.. $(HPCEXCL) ; \
1174 hpc report --srcdir=.. live-test $(HPCEXCL)
1176 commit-check: distcheck lint apidoc
1178 -include ./Makefile.local