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_HEADER = $(top_srcdir)/autotools/check-header
25 CHECK_MAN = $(top_srcdir)/autotools/check-man
26 CHECK_VERSION = $(top_srcdir)/autotools/check-version
27 CHECK_NEWS = $(top_srcdir)/autotools/check-news
28 CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
29 DOCPP = $(top_srcdir)/autotools/docpp
30 REPLACE_VARS_SED = autotools/replace_vars.sed
31 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
32 BUILD_RPC = $(top_srcdir)/autotools/build-rpc
34 # Note: these are automake-specific variables, and must be named after
35 # the directory + 'dir' suffix
36 clientdir = $(pkgpythondir)/client
37 hypervisordir = $(pkgpythondir)/hypervisor
38 httpdir = $(pkgpythondir)/http
39 masterddir = $(pkgpythondir)/masterd
40 confddir = $(pkgpythondir)/confd
41 rapidir = $(pkgpythondir)/rapi
42 serverdir = $(pkgpythondir)/server
43 watcherdir = $(pkgpythondir)/watcher
44 impexpddir = $(pkgpythondir)/impexpd
45 utilsdir = $(pkgpythondir)/utils
46 toolsdir = $(pkglibdir)/tools
47 iallocatorsdir = $(pkglibdir)/iallocators
48 pytoolsdir = $(pkgpythondir)/tools
49 docdir = $(datadir)/doc/$(PACKAGE)
51 # Delete output file if an error occurred while building it
57 htools/Ganeti/HTools \
58 htools/Ganeti/HTools/Program
67 doc/examples/gnt-debug \
87 test/data/ovfdata/other \
90 BUILDTIME_DIR_AUTOCREATE = \
95 $(APIDOC_HS_DIR)/Ganeti $(APIDOC_HS_DIR)/Ganeti/HTools \
96 $(APIDOC_HS_DIR)/Ganeti/HTools/Program \
103 $(BUILDTIME_DIR_AUTOCREATE) \
108 ganeti-[0-9]*.[0-9]*.[0-9]* \
111 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
114 COVERAGE_DIR = doc/coverage
115 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
116 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
118 APIDOC_PY_DIR = $(APIDOC_DIR)/py
119 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
121 MAINTAINERCLEANFILES = \
124 doc/install-quick.rst \
129 maintainer-clean-local:
130 rm -rf $(BUILDTIME_DIRS)
133 $(addsuffix /*.py[co],$(DIRS)) \
134 $(addsuffix /*.hi,$(HTOOLS_DIRS)) \
135 $(addsuffix /*.o,$(HTOOLS_DIRS)) \
137 $(PYTHON_BOOTSTRAP) \
139 autotools/replace_vars.sed \
140 daemons/daemon-util \
141 daemons/ganeti-cleaner \
144 doc/examples/bash_completion \
145 lib/_generated_rpc.py \
150 $(nodist_pkgpython_PYTHON) \
151 $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
152 .hpc/*.mix htools/*.tix \
155 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
156 # it'll cause the target to rebuild every time.
158 $(built_base_sources) \
159 $(BUILT_PYTHON_SOURCES) \
162 built_base_sources = \
167 built_python_base_sources = \
171 BUILT_PYTHON_SOURCES = \
172 $(built_python_base_sources) \
173 lib/_generated_rpc.py
175 # Generating the RPC wrappers depends on many things, so make sure it's built at
176 # the end of the built sources
177 lib/_generated_rpc.py: | $(built_base_sources) $(built_python_base_sources)
179 # these are all built from the underlying %.in sources
181 doc/examples/ganeti-kvm-poweroff.initd \
182 doc/examples/ganeti.cron \
183 doc/examples/ganeti.initd \
184 doc/examples/gnt-config-backup \
185 doc/examples/hooks/ipsec
187 nodist_pkgpython_PYTHON = \
188 $(BUILT_PYTHON_SOURCES)
191 lib/build/__init__.py \
192 lib/build/sphinx_ext.py
196 lib/asyncnotifier.py \
230 lib/client/__init__.py \
231 lib/client/gnt_backup.py \
232 lib/client/gnt_cluster.py \
233 lib/client/gnt_debug.py \
234 lib/client/gnt_group.py \
235 lib/client/gnt_instance.py \
236 lib/client/gnt_job.py \
237 lib/client/gnt_node.py \
240 hypervisor_PYTHON = \
241 lib/hypervisor/__init__.py \
242 lib/hypervisor/hv_base.py \
243 lib/hypervisor/hv_chroot.py \
244 lib/hypervisor/hv_fake.py \
245 lib/hypervisor/hv_kvm.py \
246 lib/hypervisor/hv_lxc.py \
247 lib/hypervisor/hv_xen.py
250 lib/rapi/__init__.py \
251 lib/rapi/baserlib.py \
253 lib/rapi/client_utils.py \
254 lib/rapi/connector.py \
256 lib/rapi/testutils.py
259 lib/http/__init__.py \
265 lib/confd/__init__.py \
266 lib/confd/client.py \
267 lib/confd/querylib.py \
271 lib/masterd/__init__.py \
272 lib/masterd/instance.py
275 lib/impexpd/__init__.py
278 lib/watcher/__init__.py \
279 lib/watcher/nodemaint.py \
283 lib/server/__init__.py \
284 lib/server/confd.py \
285 lib/server/masterd.py \
286 lib/server/noded.py \
290 lib/tools/__init__.py \
291 lib/tools/ensure_dirs.py
294 lib/utils/__init__.py \
296 lib/utils/filelock.py \
301 lib/utils/nodesetup.py \
302 lib/utils/process.py \
305 lib/utils/wrapper.py \
314 doc/design-htools-2.3.rst \
317 doc/design-draft.rst \
319 doc/design-cpu-pinning.rst \
320 doc/design-query2.rst \
321 doc/design-x509-ca.rst \
322 doc/design-http-server.rst \
323 doc/design-impexp2.rst \
324 doc/design-lu-generated-jobs.rst \
325 doc/design-multi-reloc.rst \
326 doc/design-network.rst \
327 doc/design-chained-jobs.rst \
328 doc/design-ovf-support.rst \
329 doc/design-resource-model.rst \
330 doc/cluster-merge.rst \
331 doc/design-shared-storage.rst \
332 doc/design-node-state-cache.rst \
333 doc/design-virtual-clusters.rst \
339 doc/install-quick.rst \
342 doc/move-instance.rst \
349 HS_PROGS = htools/htools
350 HS_BIN_ROLES = hbal hscan hspace hinfo
352 HS_ALL_PROGS = $(HS_PROGS) htools/test
353 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
354 # we don't add -Werror by default
355 HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
356 # extra flags that can be overriden on the command line
358 # internal extra flags (used for htools/test mainly)
360 # exclude options for coverage reports
361 HPCEXCL = --exclude Main \
362 --exclude Ganeti.Constants \
363 --exclude Ganeti.THH \
364 --exclude Ganeti.HTools.QC \
365 --exclude Ganeti.HTools.QCHelper \
366 --exclude Ganeti.HTools.Version
369 htools/Ganeti/HTools/CLI.hs \
370 htools/Ganeti/HTools/Cluster.hs \
371 htools/Ganeti/HTools/Compat.hs \
372 htools/Ganeti/HTools/Container.hs \
373 htools/Ganeti/HTools/ExtLoader.hs \
374 htools/Ganeti/HTools/Group.hs \
375 htools/Ganeti/HTools/IAlloc.hs \
376 htools/Ganeti/HTools/Instance.hs \
377 htools/Ganeti/HTools/JSON.hs \
378 htools/Ganeti/HTools/Loader.hs \
379 htools/Ganeti/HTools/Luxi.hs \
380 htools/Ganeti/HTools/Node.hs \
381 htools/Ganeti/HTools/PeerMap.hs \
382 htools/Ganeti/HTools/QC.hs \
383 htools/Ganeti/HTools/QCHelper.hs \
384 htools/Ganeti/HTools/Rapi.hs \
385 htools/Ganeti/HTools/Simu.hs \
386 htools/Ganeti/HTools/Text.hs \
387 htools/Ganeti/HTools/Types.hs \
388 htools/Ganeti/HTools/Utils.hs \
389 htools/Ganeti/HTools/Program.hs \
390 htools/Ganeti/HTools/Program/Hail.hs \
391 htools/Ganeti/HTools/Program/Hbal.hs \
392 htools/Ganeti/HTools/Program/Hinfo.hs \
393 htools/Ganeti/HTools/Program/Hscan.hs \
394 htools/Ganeti/HTools/Program/Hspace.hs \
395 htools/Ganeti/BasicTypes.hs \
396 htools/Ganeti/Jobs.hs \
397 htools/Ganeti/Luxi.hs \
398 htools/Ganeti/OpCodes.hs \
401 HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
402 HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
404 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
406 # Note: we use here an order-only prerequisite, as the contents of
407 # _autoconf.py are not actually influencing the html build output: it
408 # has to exist in order for the sphinx module to be loaded
409 # successfully, but we certainly don't want the docs to be rebuilt if
411 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
412 $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
413 | $(BUILT_PYTHON_SOURCES)
414 @test -n "$(SPHINX)" || \
415 { echo 'sphinx-build' not found during configure; exit 1; }
417 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
419 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
420 -D release="$(PACKAGE_VERSION)" \
421 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
422 rm -f doc/html/.buildinfo doc/html/objects.inv
425 doc/html: doc/html/index.html
427 doc/install-quick.rst: INSTALL
429 doc/upgrade.rst: UPGRADE
431 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
433 { echo '.. This file is automatically updated at build time from $<.'; \
434 echo '.. Do not edit.'; \
441 doc/design-2.1-lock-acquire.dot \
442 doc/design-2.1-lock-release.dot
444 docpng = $(patsubst %.dot,%.png,$(docdot))
446 # Things to build but not to install (add it to EXTRA_DIST if it should be
452 doc/examples/bash_completion \
457 scripts/gnt-cluster \
460 scripts/gnt-instance \
465 PYTHON_BOOTSTRAP_SBIN = \
466 daemons/ganeti-confd \
467 daemons/ganeti-masterd \
468 daemons/ganeti-noded \
469 daemons/ganeti-watcher \
470 daemons/ganeti-rapi \
474 $(PYTHON_BOOTSTRAP_SBIN) \
494 bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
496 @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
497 # FIXME: this is a hardcoded logic, instead of auto-resolving
498 $(LN_S) -f ../../../bin/htools \
499 $(DESTDIR)$(iallocatorsdir)/hail
500 for role in $(HS_BIN_ROLES); do \
502 $(DESTDIR)$(bindir)/$$role ; \
506 $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
507 @if [ -z "$(HTOOLS)" ]; then \
508 echo "Error: htools compilation disabled at configure time" 1>&2 ;\
511 @BINARY=$(@:htools/%=%); \
512 if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
513 echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
516 BINARY=$(@:htools/%=%); $(GHC) --make \
518 $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
519 -osuf $$BINARY.o -hisuf $$BINARY.hi \
520 $(HEXTRA) $(HEXTRA_INT) $@
522 # for the htools/test binary, we need to enable profiling/coverage
523 htools/test: HEXTRA_INT=-fhpc -Wwarn -fno-warn-missing-signatures \
524 -fno-warn-monomorphism-restriction -fno-warn-orphans \
525 -fno-warn-missing-methods -fno-warn-unused-imports
527 # rules for building profiling-enabled versions of the haskell
528 # programs: hs-prof does the full two-step build, whereas
529 # hs-prof-quick does only the final rebuild (hs-prof must have been
531 .PHONY: hs-prof hs-prof-quick
534 $(MAKE) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
535 rm -f $(HS_ALL_PROGS)
536 $(MAKE) hs-prof-quick
539 $(MAKE) $(HS_ALL_PROGS) HEXTRA="-osuf .prof_o -prof -auto-all"
541 dist_sbin_SCRIPTS = \
542 tools/ganeti-listrunner
544 nodist_sbin_SCRIPTS = \
545 $(PYTHON_BOOTSTRAP_SBIN) \
546 daemons/ganeti-cleaner
553 tools/cluster-merge \
557 tools/move-instance \
560 tools/sanitize-config
562 dist_tools_SCRIPTS = \
564 tools/kvm-console-wrapper \
565 tools/xm-console-wrapper \
566 tools/master-ip-setup
568 pkglib_python_scripts = \
569 daemons/import-export \
570 tools/check-cert-expired
572 nodist_pkglib_python_scripts = \
576 daemons/daemon-util \
578 $(pkglib_python_scripts)
580 nodist_pkglib_SCRIPTS = \
581 $(nodist_pkglib_python_scripts)
588 autotools/build-bash-completion \
589 autotools/build-rpc \
590 autotools/check-header \
591 autotools/check-python-code \
592 autotools/check-imports \
593 autotools/check-man \
594 autotools/check-news \
595 autotools/check-tar \
596 autotools/check-version \
597 autotools/convert-constants \
599 autotools/gen-coverage \
600 autotools/testrunner \
602 daemons/daemon-util.in \
603 daemons/ganeti-cleaner.in \
604 $(pkglib_python_scripts) \
612 $(BUILT_EXAMPLES:%=%.in) \
613 doc/examples/ganeti.default \
614 doc/examples/ganeti.default-debug \
615 doc/examples/hooks/ethers \
616 doc/examples/gnt-debug/README \
617 doc/examples/gnt-debug/delay0.json \
618 doc/examples/gnt-debug/delay50.json \
629 $(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
635 man/ganeti-cleaner.8 \
637 man/ganeti-listrunner.8 \
638 man/ganeti-masterd.8 \
640 man/ganeti-os-interface.7 \
642 man/ganeti-watcher.8 \
657 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
658 manhtml = $(patsubst %.rst,%.html,$(manrst))
659 mangen = $(patsubst %.rst,%.gen,$(manrst))
661 $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
662 $(patsubst %.html,%.html.in,$(manhtml)) \
663 man/footer.man man/footer.html $(mangen)
666 test/data/bdev-drbd-8.0.txt \
667 test/data/bdev-drbd-8.3.txt \
668 test/data/bdev-drbd-disk.txt \
669 test/data/bdev-drbd-net-ip4.txt \
670 test/data/bdev-drbd-net-ip6.txt \
671 test/data/cert1.pem \
672 test/data/ip-addr-show-dummy0.txt \
673 test/data/ip-addr-show-lo-ipv4.txt \
674 test/data/ip-addr-show-lo-ipv6.txt \
675 test/data/ip-addr-show-lo-oneline-ipv4.txt \
676 test/data/ip-addr-show-lo-oneline-ipv6.txt \
677 test/data/ip-addr-show-lo-oneline.txt \
678 test/data/ip-addr-show-lo.txt \
679 test/data/proc_drbd8.txt \
680 test/data/proc_drbd80-emptyline.txt \
681 test/data/proc_drbd83.txt \
682 test/data/proc_drbd83_sync.txt \
683 test/data/proc_drbd83_sync_krnl2.6.39.txt \
684 test/data/kvm_1.0_help.txt \
685 test/data/kvm_0.15.90_help.txt \
686 test/data/kvm_0.12.5_help.txt \
687 test/data/kvm_0.9.1_help.txt \
688 test/data/sys_drbd_usermode_helper.txt \
689 test/data/ovfdata/compr_disk.vmdk.gz \
690 test/data/ovfdata/config.ini \
691 test/data/ovfdata/corrupted_resources.ovf \
692 test/data/ovfdata/empty.ini \
693 test/data/ovfdata/empty.ovf \
694 test/data/ovfdata/ganeti.mf \
695 test/data/ovfdata/ganeti.ovf \
696 test/data/ovfdata/gzip_disk.ovf \
697 test/data/ovfdata/new_disk.vmdk \
698 test/data/ovfdata/no_disk.ini \
699 test/data/ovfdata/no_disk_in_ref.ovf \
700 test/data/ovfdata/no_os.ini \
701 test/data/ovfdata/no_ovf.ova \
702 test/data/ovfdata/ova.ova \
703 test/data/ovfdata/second_disk.vmdk \
704 test/data/ovfdata/rawdisk.raw \
705 test/data/ovfdata/unsafe_path.ini \
706 test/data/ovfdata/virtualbox.ovf \
707 test/data/ovfdata/wrong_extension.ovd \
708 test/data/ovfdata/wrong_config.ini \
709 test/data/ovfdata/wrong_manifest.mf \
710 test/data/ovfdata/wrong_manifest.ovf \
711 test/data/ovfdata/wrong_ova.ova \
712 test/data/ovfdata/wrong_xml.ovf \
713 test/data/ovfdata/other/rawdisk.raw \
714 test/import-export_unittest-helper
717 test/ganeti.asyncnotifier_unittest.py \
718 test/ganeti.backend_unittest.py \
719 test/ganeti.bdev_unittest.py \
720 test/ganeti.cli_unittest.py \
721 test/ganeti.client.gnt_cluster_unittest.py \
722 test/ganeti.client.gnt_instance_unittest.py \
723 test/ganeti.daemon_unittest.py \
724 test/ganeti.cmdlib_unittest.py \
725 test/ganeti.compat_unittest.py \
726 test/ganeti.confd.client_unittest.py \
727 test/ganeti.config_unittest.py \
728 test/ganeti.constants_unittest.py \
729 test/ganeti.errors_unittest.py \
730 test/ganeti.hooks_unittest.py \
731 test/ganeti.ht_unittest.py \
732 test/ganeti.http_unittest.py \
733 test/ganeti.hypervisor_unittest.py \
734 test/ganeti.hypervisor.hv_chroot_unittest.py \
735 test/ganeti.hypervisor.hv_fake_unittest.py \
736 test/ganeti.hypervisor.hv_kvm_unittest.py \
737 test/ganeti.hypervisor.hv_lxc_unittest.py \
738 test/ganeti.hypervisor.hv_xen_unittest.py \
739 test/ganeti.impexpd_unittest.py \
740 test/ganeti.jqueue_unittest.py \
741 test/ganeti.locking_unittest.py \
742 test/ganeti.luxi_unittest.py \
743 test/ganeti.masterd.instance_unittest.py \
744 test/ganeti.mcpu_unittest.py \
745 test/ganeti.netutils_unittest.py \
746 test/ganeti.objects_unittest.py \
747 test/ganeti.opcodes_unittest.py \
748 test/ganeti.ovf_unittest.py \
749 test/ganeti.qlang_unittest.py \
750 test/ganeti.query_unittest.py \
751 test/ganeti.rapi.baserlib_unittest.py \
752 test/ganeti.rapi.client_unittest.py \
753 test/ganeti.rapi.resources_unittest.py \
754 test/ganeti.rapi.rlib2_unittest.py \
755 test/ganeti.rapi.testutils_unittest.py \
756 test/ganeti.rpc_unittest.py \
757 test/ganeti.runtime_unittest.py \
758 test/ganeti.serializer_unittest.py \
759 test/ganeti.ssh_unittest.py \
760 test/ganeti.tools.ensure_dirs_unittest.py \
761 test/ganeti.uidpool_unittest.py \
762 test/ganeti.utils.algo_unittest.py \
763 test/ganeti.utils.filelock_unittest.py \
764 test/ganeti.utils.hash_unittest.py \
765 test/ganeti.utils.io_unittest.py \
766 test/ganeti.utils.log_unittest.py \
767 test/ganeti.utils.mlock_unittest.py \
768 test/ganeti.utils.nodesetup_unittest.py \
769 test/ganeti.utils.process_unittest.py \
770 test/ganeti.utils.retry_unittest.py \
771 test/ganeti.utils.text_unittest.py \
772 test/ganeti.utils.wrapper_unittest.py \
773 test/ganeti.utils.x509_unittest.py \
774 test/ganeti.utils_unittest.py \
775 test/ganeti.workerpool_unittest.py \
776 test/cfgupgrade_unittest.py \
777 test/docs_unittest.py \
778 test/pycurl_reset_unittest.py \
779 test/tempfile_fork_unittest.py
781 python_tests += test/ganeti.utils.io_unittest-runasroot.py
784 haskell_tests = htools/test
787 test/check-cert-expired_unittest.bash \
788 test/daemon-util_unittest.bash \
789 test/ganeti-cleaner_unittest.bash \
790 test/import-export_unittest.bash \
795 nodist_TESTS += $(haskell_tests)
798 TESTS = $(dist_TESTS) $(nodist_TESTS)
800 # Environment for all tests
801 PLAIN_TESTS_ENVIRONMENT = \
802 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) \
803 FAKEROOT=$(FAKEROOT_PATH) $(RUN_IN_TEMPDIR)
805 # Environment for tests run by automake
806 TESTS_ENVIRONMENT = \
807 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
810 $(dist_sbin_SCRIPTS) \
812 $(pkglib_python_scripts) \
813 $(nodist_pkglib_python_scripts) \
815 $(pkgpython_PYTHON) \
817 $(hypervisor_PYTHON) \
832 test/check-cert-expired_unittest.bash \
833 test/daemon-util_unittest.bash \
834 test/ganeti-cleaner_unittest.bash \
835 test/import-export_unittest.bash \
837 $(HS_LIB_SRCS) $(HS_PROG_SRCS)
839 check_python_code = \
840 $(BUILD_BASH_COMPLETION) \
848 ganeti/http/server.py \
849 $(dist_sbin_SCRIPTS) \
851 $(pkglib_python_scripts) \
852 $(BUILD_BASH_COMPLETION) \
858 standalone_python_modules = \
860 tools/ganeti-listrunner
864 ganeti/http/server.py \
865 $(dist_sbin_SCRIPTS) \
867 $(pkglib_python_scripts) \
868 $(BUILD_BASH_COMPLETION) \
871 $(PYTHON_BOOTSTRAP) \
874 test/daemon-util_unittest.bash: daemons/daemon-util
876 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
878 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
879 sed -f $(REPLACE_VARS_SED) < $< > $@
882 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
883 sed -f $(REPLACE_VARS_SED) < $< > $@
886 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
887 sed -f $(REPLACE_VARS_SED) < $< > $@
890 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
891 sed -f $(REPLACE_VARS_SED) < $< > $@
893 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
894 sed -f $(REPLACE_VARS_SED) < $< > $@
896 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
897 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
898 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
901 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
902 $(DOT) -Tpng -o $@ $<
904 man/footer.man: man/footer.rst
905 @test -n "$(PANDOC)" || \
906 { echo 'pandoc' not found during configure; exit 1; }
907 $(PANDOC) -f rst -t man -o $@ $<
909 man/footer.html: man/footer.rst
910 @test -n "$(PANDOC)" || \
911 { echo 'pandoc' not found during configure; exit 1; }
912 $(PANDOC) -f rst -t html -o $@ $<
914 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
915 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
917 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
918 @test -n "$(PANDOC)" || \
919 { echo 'pandoc' not found during configure; exit 1; }
921 $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
922 sed -e 's/\\@/@/g' > $@
923 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
925 man/%.html.in: man/%.gen man/footer.html
926 @test -n "$(PANDOC)" || \
927 { echo 'pandoc' not found during configure; exit 1; }
929 $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
930 sed -e 's/\\@/@/g' > $@
932 man/%.1: man/%.1.in $(REPLACE_VARS_SED)
933 sed -f $(REPLACE_VARS_SED) < $< > $@
935 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
936 sed -f $(REPLACE_VARS_SED) < $< > $@
938 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
939 sed -f $(REPLACE_VARS_SED) < $< > $@
941 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
942 sed -f $(REPLACE_VARS_SED) < $< > $@
944 epydoc.conf: epydoc.conf.in Makefile
945 sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
948 if test -d .git; then \
950 elif test ! -f $@ ; then \
951 echo "Cannot auto-generate $@ file"; exit 1; \
954 .PHONY: regen-vcs-version
958 if test -d .git; then \
960 $(MAKE) vcs-version; \
963 htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
965 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
966 sed -e "s/%ver%/$$VCSVER/" < $< > $@
968 htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
969 lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS) \
972 { cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
974 lib/_autoconf.py: Makefile | lib/.dir
976 { echo '# This file is automatically generated, do not edit!'; \
979 echo '"""Build-time configuration for Ganeti.'; \
981 echo 'This file is autogenerated by the build process.'; \
982 echo 'For any changes you need to re-run ./configure (and'; \
983 echo 'not edit by hand).'; \
987 echo '# pylint: disable=C0301,C0324'; \
988 echo '# because this is autogenerated, we do not want'; \
989 echo '# style warnings' ; \
991 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
992 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
993 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
994 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
995 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
996 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
997 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
998 echo "SYSCONFDIR = '$(sysconfdir)'"; \
999 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
1000 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
1001 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
1002 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
1003 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
1004 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
1005 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
1006 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
1007 echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
1008 echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
1009 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
1010 echo "KVM_PATH = '$(KVM_PATH)'"; \
1011 echo "IP_PATH = '$(IP_PATH)'"; \
1012 echo "SOCAT_PATH = '$(SOCAT)'"; \
1013 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
1014 echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
1015 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
1016 echo "TOOLSDIR = '$(toolsdir)'"; \
1017 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
1018 echo "PKGLIBDIR = '$(pkglibdir)'"; \
1019 echo "DRBD_BARRIERS = '$(DRBD_BARRIERS)'"; \
1020 echo "DRBD_NO_META_FLUSH = $(DRBD_NO_META_FLUSH)"; \
1021 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
1022 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
1023 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
1024 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
1025 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
1026 echo "RAPI_USER = '$(RAPI_USER)'"; \
1027 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
1028 echo "CONFD_USER = '$(CONFD_USER)'"; \
1029 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
1030 echo "NODED_USER = '$(NODED_USER)'"; \
1031 echo "NODED_GROUP = '$(NODED_GROUP)'"; \
1032 echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
1033 echo "QEMUIMG_PATH = '$(QEMUIMG_PATH)'"; \
1034 if [ "$(HTOOLS)" ]; then \
1035 echo "HTOOLS = True"; \
1037 echo "HTOOLS = False"; \
1039 echo "ENABLE_CONFD = $(ENABLE_CONFD)"; \
1042 lib/_vcsversion.py: Makefile vcs-version | lib/.dir
1044 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1045 { echo '# This file is automatically generated, do not edit!'; \
1048 echo '"""Build-time VCS version number for Ganeti.'; \
1050 echo 'This file is autogenerated by the build process.'; \
1051 echo 'For any changes you need to re-run ./configure (and'; \
1052 echo 'not edit by hand).'; \
1056 echo '# pylint: disable=C0301,C0324'; \
1057 echo '# because this is autogenerated, we do not want'; \
1058 echo '# style warnings' ; \
1060 echo "VCS_VERSION = '$$VCSVER'"; \
1063 lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1064 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1066 $(REPLACE_VARS_SED): Makefile
1068 { echo 's#@PREFIX@#$(prefix)#g'; \
1069 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
1070 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
1071 echo 's#@BINDIR@#$(bindir)#g'; \
1072 echo 's#@SBINDIR@#$(sbindir)#g'; \
1073 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
1074 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
1075 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
1076 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
1077 echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
1078 echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
1079 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
1080 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
1081 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
1082 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
1083 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
1084 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
1085 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
1086 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
1087 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
1088 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
1089 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
1090 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
1091 echo 's#@CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
1094 # Using deferred evaluation
1095 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
1096 daemons/ganeti-watcher: MODULE = ganeti.watcher
1097 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
1098 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
1100 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
1101 test -n "$(MODULE)" || { echo Missing module; exit 1; }
1103 { echo '#!/usr/bin/python'; \
1104 echo '# This file is automatically generated, do not edit!'; \
1105 echo "# Edit $(MODULE) instead."; \
1107 echo '"""Bootstrap script for L{$(MODULE)}"""'; \
1109 echo '# pylint: disable=C0103'; \
1110 echo '# C0103: Invalid name'; \
1112 echo 'import sys'; \
1113 echo 'import $(MODULE) as main'; \
1115 echo '# Temporarily alias commands until bash completion'; \
1116 echo '# generator is changed'; \
1117 echo 'if hasattr(main, "commands"):'; \
1118 echo ' commands = main.commands # pylint: disable=E1101'; \
1119 echo 'if hasattr(main, "aliases"):'; \
1120 echo ' aliases = main.aliases # pylint: disable=E1101'; \
1122 echo 'if __name__ == "__main__":'; \
1123 echo ' sys.exit(main.Main())'; \
1127 # We need to create symlinks because "make distcheck" will not install Python
1128 # files when building.
1129 stamp-srclinks: Makefile | $(all_dirfiles)
1131 for i in $(srclink_files); do \
1132 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
1133 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
1140 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
1143 check-dirs: $(BUILT_SOURCES)
1145 find . -type d \( \( -name . \) -o \( \
1147 -name autom4te.cache \
1148 \) -prune -o -print \) | { \
1150 while read dir; do \
1152 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
1153 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
1156 for dir in $(DIRS); do \
1157 if ! test -d "$$dir"; then \
1158 echo "Directory $$dir listed in DIRS does not exist" >&2; \
1162 if test -n "$$error"; then exit 1; else exit 0; fi; \
1166 check-local: check-dirs $(BUILT_SOURCES)
1167 $(CHECK_PYTHON_CODE) $(check_python_code)
1168 PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
1169 $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1170 $(CHECK_NEWS) < $(top_srcdir)/NEWS
1171 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
1172 expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1173 if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1174 echo "Incorrect version in README, expected $$expver"; \
1177 for file in doc/iallocator.rst doc/hooks.rst; do \
1178 if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
1179 "Documents Ganeti version $$expver"; then \
1180 echo "Incorrect version in $$file, expected $$expver"; \
1186 hs-check: htools/test
1190 # E111: indentation is not a multiple of four
1191 # E261: at least two spaces before inline comment
1192 # E501: line too long (80 characters)
1193 PEP8_IGNORE = E111,E261,E501
1195 # For excluding pep8 expects filenames only, not whole paths
1196 PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
1199 lint: $(BUILT_SOURCES)
1200 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1201 if test -z "$(PEP8)"; then \
1202 echo '"pep8" not found during configure' >&2; \
1204 $(PEP8) --repeat --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
1205 $(pep8_python_code); \
1207 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
1208 cd $(top_srcdir)/qa && \
1209 PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1210 --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1213 hlint: $(HS_BUILT_SRCS) htools/lint-hints.hs
1214 if tty -s; then C="-c"; else C=""; fi; \
1215 hlint --report=doc/hs-lint.html --cross $$C \
1216 --ignore "Use first" \
1217 --ignore "Use comparing" \
1219 --ignore "Use Control.Exception.catch" \
1220 --ignore "Reduce duplication" \
1221 --hint htools/lint-hints \
1222 $(filter-out htools/Ganeti/THH.hs,$(HS_LIB_SRCS))
1224 # a dist hook rule for updating the vcs-version file; this is
1225 # hardcoded due to where it needs to build the file...
1227 $(MAKE) regen-vcs-version && \
1228 rm -f $(top_distdir)/vcs-version && \
1229 cp -p $(srcdir)/vcs-version $(top_distdir)
1231 # a distcheck hook rule for catching revision control directories
1233 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1234 echo "Found revision control files in final archive." 1>&2; \
1237 if find $(top_distdir) -name '*.py[co]' | grep .; then \
1238 echo "Found Python byte code in final archive." 1>&2; \
1241 if find $(top_distdir) -name '*~' | grep .; then \
1242 echo "Found backup files in final archive." 1>&2; \
1245 # Empty files or directories should not be distributed. They can cause
1246 # unnecessary warnings for packagers. Directories used by automake during
1247 # distcheck must be excluded.
1248 if find $(top_distdir) -empty -and -not \( \
1249 -path $(top_distdir)/_build -or \
1250 -path $(top_distdir)/_inst \) | grep .; then \
1251 echo "Found empty files or directories in final archive." 1>&2; \
1254 if test -n "$(BUILD_RELEASE)" && \
1255 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1256 echo "Found unreleased version in NEWS." >&2; \
1260 # When building a release, stricter checks should be used
1261 distcheck-release dist-release: export BUILD_RELEASE = 1
1262 distcheck-release: distcheck
1266 for i in $(DIST_ARCHIVES); do \
1267 echo -n "Checking $$i ... "; \
1268 autotools/check-tar < $$i; \
1273 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1274 "$(DESTDIR)${localstatedir}/log/ganeti" \
1275 "$(DESTDIR)${localstatedir}/run/ganeti"
1277 # To avoid conflicts between directory names and other targets, a file inside
1278 # the directory is used to ensure its existence.
1280 @mkdir_p@ $* && touch $@
1283 if WANT_HTOOLSAPIDOC
1284 apidoc: py-apidoc hs-apidoc
1290 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1291 $(RUN_IN_TEMPDIR) epydoc -v \
1292 --conf $(CURDIR)/epydoc.conf \
1293 --output $(CURDIR)/$(APIDOC_PY_DIR)
1296 hs-apidoc: $(HS_BUILT_SRCS)
1297 @test -n "$(HSCOLOUR)" || \
1298 { echo 'HsColour' not found during configure; exit 1; }
1299 @test -n "$(HADDOCK)" || \
1300 { echo 'haddock' not found during configure; exit 1; }
1301 rm -rf $(APIDOC_HS_DIR)/*
1302 @mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools/Program
1303 $(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1304 $(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1307 if [ "$(HTOOLS_NOCURL)" ]; \
1308 then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1311 if [ "$(HTOOLS_PARALLEL3)" ]; \
1312 then OPTGHC="$$OPTGHC --optghc=$(HTOOLS_PARALLEL3)"; \
1314 RELSRCS="$(HS_LIB_SRCS:htools/%=%) $(HS_BUILT_SRCS:htools/%=%)"; \
1315 for file in $$RELSRCS; do \
1316 hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1317 $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1319 $(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1320 -t ganeti-htools -p haddock-prologue \
1321 --source-module="%{MODULE/.//}.html" \
1322 --source-entity="%{MODULE/.//}.html#%{NAME}" \
1324 $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1327 TAGS: $(BUILT_SOURCES)
1329 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1330 -path './daemons/ganeti-*' -o -path './tools/*' -o \
1331 -path './qa/*.py' | \
1336 coverage: py-coverage hs-coverage
1338 coverage: py-coverage
1342 py-coverage: $(BUILT_SOURCES) $(python_tests)
1344 COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1345 TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1346 HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1347 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1351 hs-coverage: $(haskell_tests)
1352 cd htools && rm -f *.tix *.mix && ./test
1353 @mkdir_p@ $(COVERAGE_HS_DIR)
1354 hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1355 hpc report htools/test $(HPCEXCL)
1356 $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
1358 # Special "kind-of-QA" target for htools, needs special setup (all
1359 # tools compiled with -fhpc)
1364 rm -f .hpc; $(LN_S) ../.hpc .hpc; \
1365 rm -f *.tix *.mix; \
1367 hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1368 --output=live-test.tix ; \
1369 @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1370 hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1371 --srcdir=.. $(HPCEXCL) ; \
1372 hpc report --srcdir=.. live-test $(HPCEXCL)
1374 commit-check: distcheck lint apidoc
1376 -include ./Makefile.local