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 # Helper values for calling builtin functions
14 space := $(empty) $(empty)
17 # Use bash in order to be able to use pipefail
20 ACLOCAL_AMFLAGS = -I autotools
21 BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
22 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
23 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
24 CHECK_MAN = $(top_srcdir)/autotools/check-man
25 CHECK_VERSION = $(top_srcdir)/autotools/check-version
26 CHECK_NEWS = $(top_srcdir)/autotools/check-news
27 CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
28 DOCPP = $(top_srcdir)/autotools/docpp
29 REPLACE_VARS_SED = autotools/replace_vars.sed
30 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
32 # Note: these are automake-specific variables, and must be named after
33 # the directory + 'dir' suffix
34 clientdir = $(pkgpythondir)/client
35 hypervisordir = $(pkgpythondir)/hypervisor
36 httpdir = $(pkgpythondir)/http
37 masterddir = $(pkgpythondir)/masterd
38 confddir = $(pkgpythondir)/confd
39 rapidir = $(pkgpythondir)/rapi
40 serverdir = $(pkgpythondir)/server
41 watcherdir = $(pkgpythondir)/watcher
42 impexpddir = $(pkgpythondir)/impexpd
43 utilsdir = $(pkgpythondir)/utils
44 toolsdir = $(pkglibdir)/tools
45 iallocatorsdir = $(pkglibdir)/iallocators
46 pytoolsdir = $(pkgpythondir)/tools
47 docdir = $(datadir)/doc/$(PACKAGE)
49 # Delete output file if an error occurred while building it
55 htools/Ganeti/HTools \
56 htools/Ganeti/HTools/Program
65 doc/examples/gnt-debug \
85 test/data/ovfdata/other \
88 BUILDTIME_DIR_AUTOCREATE = \
93 $(APIDOC_HS_DIR)/Ganeti $(APIDOC_HS_DIR)/Ganeti/HTools \
94 $(APIDOC_HS_DIR)/Ganeti/HTools/Program \
101 $(BUILDTIME_DIR_AUTOCREATE) \
106 ganeti-[0-9]*.[0-9]*.[0-9]* \
109 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
112 COVERAGE_DIR = doc/coverage
113 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
114 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
116 APIDOC_PY_DIR = $(APIDOC_DIR)/py
117 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
119 MAINTAINERCLEANFILES = \
122 doc/install-quick.rst \
127 maintainer-clean-local:
128 rm -rf $(BUILDTIME_DIRS)
131 $(addsuffix /*.py[co],$(DIRS)) \
132 $(addsuffix /*.hi,$(HTOOLS_DIRS)) \
133 $(addsuffix /*.o,$(HTOOLS_DIRS)) \
135 $(PYTHON_BOOTSTRAP) \
137 autotools/replace_vars.sed \
138 daemons/daemon-util \
139 daemons/ganeti-cleaner \
141 doc/examples/bash_completion \
142 doc/examples/ganeti.initd \
143 doc/examples/ganeti-kvm-poweroff.initd \
144 doc/examples/ganeti.cron \
145 doc/examples/gnt-config-backup \
146 doc/examples/hooks/ipsec \
151 $(nodist_pkgpython_PYTHON) \
152 $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
153 .hpc/*.mix htools/*.tix \
156 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
157 # it'll cause the target to rebuild every time.
162 $(PYTHON_BOOTSTRAP) \
163 $(BUILT_PYTHON_SOURCES)
165 BUILT_PYTHON_SOURCES = \
169 nodist_pkgpython_PYTHON = \
170 $(BUILT_PYTHON_SOURCES)
173 lib/build/__init__.py \
174 lib/build/sphinx_ext.py
178 lib/asyncnotifier.py \
211 lib/client/__init__.py \
212 lib/client/gnt_backup.py \
213 lib/client/gnt_cluster.py \
214 lib/client/gnt_debug.py \
215 lib/client/gnt_group.py \
216 lib/client/gnt_instance.py \
217 lib/client/gnt_job.py \
218 lib/client/gnt_node.py \
221 hypervisor_PYTHON = \
222 lib/hypervisor/__init__.py \
223 lib/hypervisor/hv_base.py \
224 lib/hypervisor/hv_chroot.py \
225 lib/hypervisor/hv_fake.py \
226 lib/hypervisor/hv_kvm.py \
227 lib/hypervisor/hv_lxc.py \
228 lib/hypervisor/hv_xen.py
231 lib/rapi/__init__.py \
232 lib/rapi/baserlib.py \
234 lib/rapi/client_utils.py \
235 lib/rapi/connector.py \
239 lib/http/__init__.py \
245 lib/confd/__init__.py \
246 lib/confd/client.py \
247 lib/confd/querylib.py \
251 lib/masterd/__init__.py \
252 lib/masterd/instance.py
255 lib/impexpd/__init__.py
258 lib/watcher/__init__.py \
259 lib/watcher/nodemaint.py \
263 lib/server/__init__.py \
264 lib/server/confd.py \
265 lib/server/masterd.py \
266 lib/server/noded.py \
270 lib/tools/__init__.py \
271 lib/tools/ensure_dirs.py
274 lib/utils/__init__.py \
277 lib/utils/filelock.py \
281 lib/utils/nodesetup.py \
282 lib/utils/process.py \
285 lib/utils/wrapper.py \
294 doc/design-htools-2.3.rst \
297 doc/design-draft.rst \
299 doc/design-cpu-pinning.rst \
300 doc/design-query2.rst \
301 doc/design-x509-ca.rst \
302 doc/design-http-server.rst \
303 doc/design-impexp2.rst \
304 doc/design-lu-generated-jobs.rst \
305 doc/design-multi-reloc.rst \
306 doc/design-network.rst \
307 doc/design-chained-jobs.rst \
308 doc/design-ovf-support.rst \
309 doc/design-resource-model.rst \
310 doc/cluster-merge.rst \
311 doc/design-shared-storage.rst \
312 doc/design-node-state-cache.rst \
313 doc/design-virtual-clusters.rst \
319 doc/install-quick.rst \
322 doc/move-instance.rst \
329 HS_PROGS = htools/htools
330 HS_BIN_ROLES = hbal hscan hspace
332 HS_ALL_PROGS = $(HS_PROGS) htools/test
333 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
334 # we don't add -Werror by default
335 HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
336 # extra flags that can be overriden on the command line
338 # exclude options for coverage reports
339 HPCEXCL = --exclude Main \
340 --exclude Ganeti.Constants \
341 --exclude Ganeti.THH \
342 --exclude Ganeti.HTools.QC \
343 --exclude Ganeti.HTools.QCHelper \
344 --exclude Ganeti.HTools.Version
347 htools/Ganeti/HTools/CLI.hs \
348 htools/Ganeti/HTools/Cluster.hs \
349 htools/Ganeti/HTools/Compat.hs \
350 htools/Ganeti/HTools/Container.hs \
351 htools/Ganeti/HTools/ExtLoader.hs \
352 htools/Ganeti/HTools/Group.hs \
353 htools/Ganeti/HTools/IAlloc.hs \
354 htools/Ganeti/HTools/Instance.hs \
355 htools/Ganeti/HTools/JSON.hs \
356 htools/Ganeti/HTools/Loader.hs \
357 htools/Ganeti/HTools/Luxi.hs \
358 htools/Ganeti/HTools/Node.hs \
359 htools/Ganeti/HTools/PeerMap.hs \
360 htools/Ganeti/HTools/QC.hs \
361 htools/Ganeti/HTools/QCHelper.hs \
362 htools/Ganeti/HTools/Rapi.hs \
363 htools/Ganeti/HTools/Simu.hs \
364 htools/Ganeti/HTools/Text.hs \
365 htools/Ganeti/HTools/Types.hs \
366 htools/Ganeti/HTools/Utils.hs \
367 htools/Ganeti/HTools/Program/Hail.hs \
368 htools/Ganeti/HTools/Program/Hbal.hs \
369 htools/Ganeti/HTools/Program/Hscan.hs \
370 htools/Ganeti/HTools/Program/Hspace.hs \
371 htools/Ganeti/Jobs.hs \
372 htools/Ganeti/Luxi.hs \
373 htools/Ganeti/OpCodes.hs \
376 HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
377 HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
379 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
381 # Note: we use here an order-only prerequisite, as the contents of
382 # _autoconf.py are not actually influencing the html build output: it
383 # has to exist in order for the sphinx module to be loaded
384 # successfully, but we certainly don't want the docs to be rebuilt if
386 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
387 $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
388 | $(BUILT_PYTHON_SOURCES)
389 @test -n "$(SPHINX)" || \
390 { echo 'sphinx-build' not found during configure; exit 1; }
392 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
394 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
395 -D release="$(PACKAGE_VERSION)" \
396 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
397 rm -f doc/html/.buildinfo doc/html/objects.inv
400 doc/html: doc/html/index.html
402 doc/install-quick.rst: INSTALL
404 doc/upgrade.rst: UPGRADE
406 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
408 { echo '.. This file is automatically updated at build time from $<.'; \
409 echo '.. Do not edit.'; \
416 doc/design-2.1-lock-acquire.dot \
417 doc/design-2.1-lock-release.dot
419 docpng = $(patsubst %.dot,%.png,$(docdot))
421 # Things to build but not to install (add it to EXTRA_DIST if it should be
426 doc/examples/bash_completion \
427 doc/examples/ganeti.cron \
428 doc/examples/ganeti.initd \
429 doc/examples/ganeti-kvm-poweroff.initd \
430 doc/examples/gnt-config-backup \
431 doc/examples/hooks/ipsec \
436 scripts/gnt-cluster \
439 scripts/gnt-instance \
444 PYTHON_BOOTSTRAP_SBIN = \
445 daemons/ganeti-confd \
446 daemons/ganeti-masterd \
447 daemons/ganeti-noded \
448 daemons/ganeti-watcher \
449 daemons/ganeti-rapi \
451 scripts/gnt-cluster \
454 scripts/gnt-instance \
460 $(PYTHON_BOOTSTRAP_SBIN) \
480 bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
482 @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
483 # FIXME: this is a hardcoded logic, instead of auto-resolving
484 $(LN_S) -f ../../../bin/htools \
485 $(DESTDIR)$(iallocatorsdir)/hail
486 for role in $(HS_BIN_ROLES); do \
488 $(DESTDIR)$(bindir)/$$role ; \
492 $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
493 @if [ -z "$(HTOOLS)" ]; then \
494 echo "Error: htools compilation disabled at configure time" 1>&2 ;\
497 @BINARY=$(@:htools/%=%); \
498 if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
499 echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
502 BINARY=$(@:htools/%=%); $(GHC) --make \
504 $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
505 -osuf $$BINARY.o -hisuf $$BINARY.hi \
508 # for the htools/test binary, we need to enable profiling/coverage
509 htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
510 -fno-warn-monomorphism-restriction -fno-warn-orphans \
511 -fno-warn-missing-methods -fno-warn-unused-imports
513 dist_sbin_SCRIPTS = \
514 tools/ganeti-listrunner
516 nodist_sbin_SCRIPTS = \
517 $(PYTHON_BOOTSTRAP_SBIN) \
518 daemons/ganeti-cleaner
520 dist_tools_PYTHON = \
525 tools/cluster-merge \
527 tools/move-instance \
530 tools/sanitize-config
532 dist_tools_SCRIPTS = \
533 $(dist_tools_PYTHON) \
534 tools/kvm-console-wrapper \
535 tools/xm-console-wrapper
537 pkglib_python_scripts = \
538 daemons/import-export \
539 tools/check-cert-expired
541 nodist_pkglib_python_scripts = \
545 daemons/daemon-util \
547 $(pkglib_python_scripts)
549 nodist_pkglib_SCRIPTS = \
550 $(nodist_pkglib_python_scripts)
557 autotools/build-bash-completion \
558 autotools/check-python-code \
559 autotools/check-imports \
560 autotools/check-man \
561 autotools/check-news \
562 autotools/check-tar \
563 autotools/check-version \
564 autotools/convert-constants \
566 autotools/gen-coverage \
567 autotools/testrunner \
569 daemons/daemon-util.in \
570 daemons/ganeti-cleaner.in \
571 $(pkglib_python_scripts) \
579 doc/examples/ganeti.initd.in \
580 doc/examples/ganeti-kvm-poweroff.initd.in \
581 doc/examples/ganeti.cron.in \
582 doc/examples/gnt-config-backup.in \
583 doc/examples/ganeti.default \
584 doc/examples/ganeti.default-debug \
585 doc/examples/hooks/ethers \
586 doc/examples/hooks/ipsec.in \
587 doc/examples/gnt-debug/README \
588 doc/examples/gnt-debug/delay0.json \
589 doc/examples/gnt-debug/delay50.json \
599 $(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
604 man/ganeti-cleaner.8 \
606 man/ganeti-listrunner.8 \
607 man/ganeti-masterd.8 \
609 man/ganeti-os-interface.7 \
611 man/ganeti-watcher.8 \
626 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
627 manhtml = $(patsubst %.rst,%.html,$(manrst))
628 mangen = $(patsubst %.rst,%.gen,$(manrst))
630 $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
631 $(patsubst %.html,%.html.in,$(manhtml)) \
632 man/footer.man man/footer.html $(mangen)
635 test/data/bdev-drbd-8.0.txt \
636 test/data/bdev-drbd-8.3.txt \
637 test/data/bdev-drbd-disk.txt \
638 test/data/bdev-drbd-net-ip4.txt \
639 test/data/bdev-drbd-net-ip6.txt \
640 test/data/cert1.pem \
641 test/data/ip-addr-show-dummy0.txt \
642 test/data/ip-addr-show-lo-ipv4.txt \
643 test/data/ip-addr-show-lo-ipv6.txt \
644 test/data/ip-addr-show-lo-oneline-ipv4.txt \
645 test/data/ip-addr-show-lo-oneline-ipv6.txt \
646 test/data/ip-addr-show-lo-oneline.txt \
647 test/data/ip-addr-show-lo.txt \
648 test/data/proc_drbd8.txt \
649 test/data/proc_drbd80-emptyline.txt \
650 test/data/proc_drbd83.txt \
651 test/data/proc_drbd83_sync.txt \
652 test/data/proc_drbd83_sync_krnl2.6.39.txt \
653 test/data/sys_drbd_usermode_helper.txt \
654 test/data/ovfdata/compr_disk.vmdk.gz \
655 test/data/ovfdata/config.ini \
656 test/data/ovfdata/corrupted_resources.ovf \
657 test/data/ovfdata/empty.ini \
658 test/data/ovfdata/empty.ovf \
659 test/data/ovfdata/ganeti.mf \
660 test/data/ovfdata/ganeti.ovf \
661 test/data/ovfdata/gzip_disk.ovf \
662 test/data/ovfdata/new_disk.vmdk \
663 test/data/ovfdata/no_disk.ini \
664 test/data/ovfdata/no_disk_in_ref.ovf \
665 test/data/ovfdata/no_os.ini \
666 test/data/ovfdata/no_ovf.ova \
667 test/data/ovfdata/ova.ova \
668 test/data/ovfdata/second_disk.vmdk \
669 test/data/ovfdata/rawdisk.raw \
670 test/data/ovfdata/unsafe_path.ini \
671 test/data/ovfdata/virtualbox.ovf \
672 test/data/ovfdata/wrong_extension.ovd \
673 test/data/ovfdata/wrong_config.ini \
674 test/data/ovfdata/wrong_manifest.mf \
675 test/data/ovfdata/wrong_manifest.ovf \
676 test/data/ovfdata/wrong_ova.ova \
677 test/data/ovfdata/wrong_xml.ovf \
678 test/data/ovfdata/other/rawdisk.raw \
679 test/import-export_unittest-helper
682 test/ganeti.asyncnotifier_unittest.py \
683 test/ganeti.backend_unittest.py \
684 test/ganeti.bdev_unittest.py \
685 test/ganeti.cli_unittest.py \
686 test/ganeti.client.gnt_cluster_unittest.py \
687 test/ganeti.client.gnt_instance_unittest.py \
688 test/ganeti.daemon_unittest.py \
689 test/ganeti.cmdlib_unittest.py \
690 test/ganeti.compat_unittest.py \
691 test/ganeti.confd.client_unittest.py \
692 test/ganeti.config_unittest.py \
693 test/ganeti.constants_unittest.py \
694 test/ganeti.errors_unittest.py \
695 test/ganeti.hooks_unittest.py \
696 test/ganeti.ht_unittest.py \
697 test/ganeti.http_unittest.py \
698 test/ganeti.hypervisor_unittest.py \
699 test/ganeti.hypervisor.hv_chroot_unittest.py \
700 test/ganeti.hypervisor.hv_fake_unittest.py \
701 test/ganeti.hypervisor.hv_kvm_unittest.py \
702 test/ganeti.hypervisor.hv_lxc_unittest.py \
703 test/ganeti.hypervisor.hv_xen_unittest.py \
704 test/ganeti.impexpd_unittest.py \
705 test/ganeti.jqueue_unittest.py \
706 test/ganeti.locking_unittest.py \
707 test/ganeti.luxi_unittest.py \
708 test/ganeti.masterd.instance_unittest.py \
709 test/ganeti.mcpu_unittest.py \
710 test/ganeti.netutils_unittest.py \
711 test/ganeti.objects_unittest.py \
712 test/ganeti.opcodes_unittest.py \
713 test/ganeti.ovf_unittest.py \
714 test/ganeti.qlang_unittest.py \
715 test/ganeti.query_unittest.py \
716 test/ganeti.rapi.baserlib_unittest.py \
717 test/ganeti.rapi.client_unittest.py \
718 test/ganeti.rapi.resources_unittest.py \
719 test/ganeti.rapi.rlib2_unittest.py \
720 test/ganeti.rpc_unittest.py \
721 test/ganeti.runtime_unittest.py \
722 test/ganeti.serializer_unittest.py \
723 test/ganeti.ssh_unittest.py \
724 test/ganeti.tools.ensure_dirs_unittest.py \
725 test/ganeti.uidpool_unittest.py \
726 test/ganeti.utils.algo_unittest.py \
727 test/ganeti.utils.cfunc.mlockall_unittest.py \
728 test/ganeti.utils.filelock_unittest.py \
729 test/ganeti.utils.hash_unittest.py \
730 test/ganeti.utils.io_unittest.py \
731 test/ganeti.utils.log_unittest.py \
732 test/ganeti.utils.nodesetup_unittest.py \
733 test/ganeti.utils.process_unittest.py \
734 test/ganeti.utils.retry_unittest.py \
735 test/ganeti.utils.text_unittest.py \
736 test/ganeti.utils.wrapper_unittest.py \
737 test/ganeti.utils.x509_unittest.py \
738 test/ganeti.utils_unittest.py \
739 test/ganeti.workerpool_unittest.py \
740 test/cfgupgrade_unittest.py \
741 test/docs_unittest.py \
742 test/tempfile_fork_unittest.py
744 haskell_tests = htools/test
747 test/check-cert-expired_unittest.bash \
748 test/daemon-util_unittest.bash \
749 test/ganeti-cleaner_unittest.bash \
750 test/import-export_unittest.bash \
755 nodist_TESTS += $(haskell_tests)
758 TESTS = $(dist_TESTS) $(nodist_TESTS)
760 # Environment for all tests
761 PLAIN_TESTS_ENVIRONMENT = \
762 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
764 # Environment for tests run by automake
765 TESTS_ENVIRONMENT = \
766 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
769 $(dist_sbin_SCRIPTS) \
770 $(dist_tools_PYTHON) \
771 $(pkglib_python_scripts) \
772 $(nodist_pkglib_python_scripts) \
774 $(pkgpython_PYTHON) \
776 $(hypervisor_PYTHON) \
791 test/check-cert-expired_unittest.bash \
792 test/daemon-util_unittest.bash \
793 test/ganeti-cleaner_unittest.bash \
794 test/import-export_unittest.bash \
796 $(HS_LIB_SRCS) $(HS_PROG_SRCS)
798 check_python_code = \
799 $(BUILD_BASH_COMPLETION) \
806 ganeti/http/server.py \
807 $(dist_sbin_SCRIPTS) \
808 $(dist_tools_PYTHON) \
809 $(pkglib_python_scripts) \
810 $(BUILD_BASH_COMPLETION) \
815 standalone_python_modules = \
817 tools/ganeti-listrunner
821 ganeti/http/server.py \
822 $(dist_sbin_SCRIPTS) \
823 $(dist_tools_PYTHON) \
824 $(pkglib_python_scripts) \
825 $(BUILD_BASH_COMPLETION) \
827 $(PYTHON_BOOTSTRAP) \
830 test/daemon-util_unittest.bash: daemons/daemon-util
832 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
834 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
835 sed -f $(REPLACE_VARS_SED) < $< > $@
838 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
839 sed -f $(REPLACE_VARS_SED) < $< > $@
842 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
843 sed -f $(REPLACE_VARS_SED) < $< > $@
846 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
847 sed -f $(REPLACE_VARS_SED) < $< > $@
849 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
850 sed -f $(REPLACE_VARS_SED) < $< > $@
852 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
853 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
854 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
857 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
858 $(DOT) -Tpng -o $@ $<
860 man/footer.man: man/footer.rst
861 @test -n "$(PANDOC)" || \
862 { echo 'pandoc' not found during configure; exit 1; }
863 $(PANDOC) -f rst -t man -o $@ $<
865 man/footer.html: man/footer.rst
866 @test -n "$(PANDOC)" || \
867 { echo 'pandoc' not found during configure; exit 1; }
868 $(PANDOC) -f rst -t html -o $@ $<
870 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
871 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
873 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
874 @test -n "$(PANDOC)" || \
875 { echo 'pandoc' not found during configure; exit 1; }
877 $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
878 sed -e 's/\\@/@/g' > $@
879 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
881 man/%.html.in: man/%.gen man/footer.html
882 @test -n "$(PANDOC)" || \
883 { echo 'pandoc' not found during configure; exit 1; }
885 $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
886 sed -e 's/\\@/@/g' > $@
888 man/%.1: man/%.1.in $(REPLACE_VARS_SED)
889 sed -f $(REPLACE_VARS_SED) < $< > $@
891 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
892 sed -f $(REPLACE_VARS_SED) < $< > $@
894 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
895 sed -f $(REPLACE_VARS_SED) < $< > $@
897 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
898 sed -f $(REPLACE_VARS_SED) < $< > $@
900 epydoc.conf: epydoc.conf.in Makefile
901 sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
904 if test -d .git; then \
906 elif test ! -f $@ ; then \
907 echo "Cannot auto-generate $@ file"; exit 1; \
910 .PHONY: regen-vcs-version
914 if test -d .git; then \
916 $(MAKE) vcs-version; \
919 htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
921 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
922 sed -e "s/%ver%/$$VCSVER/" < $< > $@
924 htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
925 lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS) \
928 { cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
930 lib/_autoconf.py: Makefile | lib/.dir
932 { echo '# This file is automatically generated, do not edit!'; \
935 echo '"""Build-time configuration for Ganeti.'; \
937 echo 'This file is autogenerated by the build process.'; \
938 echo 'For any changes you need to re-run ./configure (and'; \
939 echo 'not edit by hand).'; \
943 echo '# pylint: disable=C0301,C0324'; \
944 echo '# because this is autogenerated, we do not want'; \
945 echo '# style warnings' ; \
947 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
948 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
949 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
950 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
951 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
952 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
953 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
954 echo "SYSCONFDIR = '$(sysconfdir)'"; \
955 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
956 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
957 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
958 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
959 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
960 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
961 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
962 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
963 echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
964 echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
965 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
966 echo "KVM_PATH = '$(KVM_PATH)'"; \
967 echo "IP_PATH = '$(IP_PATH)'"; \
968 echo "SOCAT_PATH = '$(SOCAT)'"; \
969 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
970 echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
971 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
972 echo "TOOLSDIR = '$(toolsdir)'"; \
973 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
974 echo "PKGLIBDIR = '$(pkglibdir)'"; \
975 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
976 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
977 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
978 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
979 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
980 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
981 echo "RAPI_USER = '$(RAPI_USER)'"; \
982 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
983 echo "CONFD_USER = '$(CONFD_USER)'"; \
984 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
985 echo "NODED_USER = '$(NODED_USER)'"; \
986 echo "NODED_GROUP = '$(NODED_GROUP)'"; \
987 echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
988 if [ "$(HTOOLS)" ]; then \
989 echo "HTOOLS = True"; \
991 echo "HTOOLS = False"; \
995 lib/_vcsversion.py: Makefile vcs-version | lib/.dir
997 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
998 { echo '# This file is automatically generated, do not edit!'; \
1001 echo '"""Build-time VCS version number for Ganeti.'; \
1003 echo 'This file is autogenerated by the build process.'; \
1004 echo 'For any changes you need to re-run ./configure (and'; \
1005 echo 'not edit by hand).'; \
1009 echo '# pylint: disable=C0301,C0324'; \
1010 echo '# because this is autogenerated, we do not want'; \
1011 echo '# style warnings' ; \
1013 echo "VCS_VERSION = '$$VCSVER'"; \
1016 $(REPLACE_VARS_SED): Makefile
1018 { echo 's#@PREFIX@#$(prefix)#g'; \
1019 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
1020 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
1021 echo 's#@BINDIR@#$(bindir)#g'; \
1022 echo 's#@SBINDIR@#$(sbindir)#g'; \
1023 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
1024 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
1025 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
1026 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
1027 echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
1028 echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
1029 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
1030 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
1031 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
1032 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
1033 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
1034 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
1035 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
1036 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
1037 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
1038 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
1039 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
1040 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
1043 # Using deferred evaluation
1044 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
1045 daemons/ganeti-watcher: MODULE = ganeti.watcher
1046 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
1047 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
1049 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
1050 test -n "$(MODULE)" || { echo Missing module; exit 1; }
1052 { echo '#!/usr/bin/python'; \
1053 echo '# This file is automatically generated, do not edit!'; \
1054 echo "# Edit $(MODULE) instead."; \
1056 echo '"""Bootstrap script for L{$(MODULE)}"""'; \
1058 echo '# pylint: disable=C0103'; \
1059 echo '# C0103: Invalid name'; \
1061 echo 'import sys'; \
1062 echo 'import $(MODULE) as main'; \
1064 echo '# Temporarily alias commands until bash completion'; \
1065 echo '# generator is changed'; \
1066 echo 'if hasattr(main, "commands"):'; \
1067 echo ' commands = main.commands # pylint: disable=E1101'; \
1068 echo 'if hasattr(main, "aliases"):'; \
1069 echo ' aliases = main.aliases # pylint: disable=E1101'; \
1071 echo 'if __name__ == "__main__":'; \
1072 echo ' sys.exit(main.Main())'; \
1076 # We need to create symlinks because "make distcheck" will not install Python
1077 # files when building.
1078 stamp-srclinks: Makefile | $(all_dirfiles)
1080 for i in $(srclink_files); do \
1081 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
1082 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
1089 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
1092 check-dirs: $(BUILT_SOURCES)
1094 find . -type d \( \( -name . \) -o \( \
1096 -name autom4te.cache \
1097 \) -prune -o -print \) | { \
1099 while read dir; do \
1101 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
1102 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
1105 for dir in $(DIRS); do \
1106 if ! test -d "$$dir"; then \
1107 echo "Directory $$dir listed in DIRS does not exist" >&2; \
1111 if test -n "$$error"; then exit 1; else exit 0; fi; \
1115 check-local: check-dirs $(BUILT_SOURCES)
1116 $(CHECK_PYTHON_CODE) $(check_python_code)
1117 $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1118 $(CHECK_NEWS) < $(top_srcdir)/NEWS
1119 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
1120 expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1121 if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1122 echo "Incorrect version in README, expected $$expver"; \
1125 for file in doc/iallocator.rst doc/hooks.rst; do \
1126 if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
1127 "Documents Ganeti version $$expver"; then \
1128 echo "Incorrect version in $$file, expected $$expver"; \
1134 hs-check: htools/test
1138 # E111: indentation is not a multiple of four
1139 # E261: at least two spaces before inline comment
1140 # E501: line too long (80 characters)
1141 PEP8_IGNORE = E111,E261,E501
1143 # For excluding pep8 expects filenames only, not whole paths
1144 PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
1147 lint: $(BUILT_SOURCES)
1148 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1149 if test -z "$(PEP8)"; then \
1150 echo '"pep8" not found during configure' >&2; \
1152 $(PEP8) --repeat --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
1153 $(pep8_python_code); \
1155 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
1156 cd $(top_srcdir)/qa && \
1157 PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1158 --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1161 hlint: $(HS_BUILT_SRCS)
1162 if tty -s; then C="-c"; else C=""; fi; \
1163 hlint --report=doc/hs-lint.html $$C htools
1165 # a dist hook rule for updating the vcs-version file; this is
1166 # hardcoded due to where it needs to build the file...
1168 $(MAKE) regen-vcs-version && \
1169 rm -f $(top_distdir)/vcs-version && \
1170 cp -p $(srcdir)/vcs-version $(top_distdir)
1172 # a distcheck hook rule for catching revision control directories
1174 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1175 echo "Found revision control files in final archive." 1>&2; \
1178 if find $(top_distdir) -name '*.py[co]' | grep .; then \
1179 echo "Found Python byte code in final archive." 1>&2; \
1182 if find $(top_distdir) -name '*~' | grep .; then \
1183 echo "Found backup files in final archive." 1>&2; \
1186 # Empty files or directories should not be distributed. They can cause
1187 # unnecessary warnings for packagers. Directories used by automake during
1188 # distcheck must be excluded.
1189 if find $(top_distdir) -empty -and -not \( \
1190 -path $(top_distdir)/_build -or \
1191 -path $(top_distdir)/_inst \) | grep .; then \
1192 echo "Found empty files or directories in final archive." 1>&2; \
1195 if test -n "$(BUILD_RELEASE)" && \
1196 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1197 echo "Found unreleased version in NEWS." >&2; \
1201 # When building a release, stricter checks should be used
1202 distcheck-release dist-release: export BUILD_RELEASE = 1
1203 distcheck-release: distcheck
1207 for i in $(DIST_ARCHIVES); do \
1208 echo -n "Checking $$i ... "; \
1209 autotools/check-tar < $$i; \
1214 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1215 "$(DESTDIR)${localstatedir}/log/ganeti" \
1216 "$(DESTDIR)${localstatedir}/run/ganeti"
1218 # To avoid conflicts between directory names and other targets, a file inside
1219 # the directory is used to ensure its existence.
1221 @mkdir_p@ $* && touch $@
1224 if WANT_HTOOLSAPIDOC
1225 apidoc: py-apidoc hs-apidoc
1231 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1232 $(RUN_IN_TEMPDIR) epydoc -v \
1233 --conf $(CURDIR)/epydoc.conf \
1234 --output $(CURDIR)/$(APIDOC_PY_DIR)
1237 hs-apidoc: $(HS_BUILT_SRCS)
1238 @test -n "$(HSCOLOUR)" || \
1239 { echo 'HsColour' not found during configure; exit 1; }
1240 @test -n "$(HADDOCK)" || \
1241 { echo 'haddock' not found during configure; exit 1; }
1242 rm -rf $(APIDOC_HS_DIR)/*
1243 @mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools/Program
1244 $(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1245 $(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1248 if [ "$(HTOOLS_NOCURL)" ]; \
1249 then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1252 if [ "$(HTOOLS_PARALLEL3)" ]; \
1253 then OPTGHC="$$OPTGHC --optghc=$(HTOOLS_PARALLEL3)"; \
1255 RELSRCS="$(HS_LIB_SRCS:htools/%=%) $(HS_BUILT_SRCS:htools/%=%)"; \
1256 for file in $$RELSRCS; do \
1257 hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1258 $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1260 $(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1261 -t ganeti-htools -p haddock-prologue \
1262 --source-module="%{MODULE/.//}.html" \
1263 --source-entity="%{MODULE/.//}.html#%{NAME}" \
1265 $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1268 TAGS: $(BUILT_SOURCES)
1270 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1271 -path './daemons/ganeti-*' -o -path './tools/*' -o \
1272 -path './qa/*.py' | \
1277 coverage: py-coverage hs-coverage
1279 coverage: py-coverage
1283 py-coverage: $(BUILT_SOURCES) $(python_tests)
1285 COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1286 TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1287 HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1288 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1292 hs-coverage: $(haskell_tests)
1293 cd htools && rm -f *.tix *.mix && ./test
1294 @mkdir_p@ $(COVERAGE_HS_DIR)
1295 hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1296 hpc report htools/test $(HPCEXCL)
1297 $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
1299 # Special "kind-of-QA" target for htools, needs special setup (all
1300 # tools compiled with -fhpc)
1305 rm -f .hpc; $(LN_S) ../.hpc .hpc; \
1306 rm -f *.tix *.mix; \
1308 hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1309 --output=live-test.tix ; \
1310 @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1311 hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1312 --srcdir=.. $(HPCEXCL) ; \
1313 hpc report --srcdir=.. live-test $(HPCEXCL)
1315 commit-check: distcheck lint apidoc
1317 -include ./Makefile.local