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 DOCPP = $(top_srcdir)/autotools/docpp
28 REPLACE_VARS_SED = autotools/replace_vars.sed
29 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
31 # Note: these are automake-specific variables, and must be named after
32 # the directory + 'dir' suffix
33 clientdir = $(pkgpythondir)/client
34 hypervisordir = $(pkgpythondir)/hypervisor
35 httpdir = $(pkgpythondir)/http
36 masterddir = $(pkgpythondir)/masterd
37 confddir = $(pkgpythondir)/confd
38 rapidir = $(pkgpythondir)/rapi
39 serverdir = $(pkgpythondir)/server
40 watcherdir = $(pkgpythondir)/watcher
41 impexpddir = $(pkgpythondir)/impexpd
42 utilsdir = $(pkgpythondir)/utils
43 toolsdir = $(pkglibdir)/tools
44 iallocatorsdir = $(pkglibdir)/iallocators
45 pytoolsdir = $(pkgpythondir)/tools
46 docdir = $(datadir)/doc/$(PACKAGE)
47 myexeclibdir = $(pkglibdir)
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 \
86 BUILDTIME_DIR_AUTOCREATE = \
91 $(APIDOC_HS_DIR)/Ganeti $(APIDOC_HS_DIR)/Ganeti/HTools \
92 $(APIDOC_HS_DIR)/Ganeti/HTools/Program \
99 $(BUILDTIME_DIR_AUTOCREATE) \
104 ganeti-[0-9]*.[0-9]*.[0-9]* \
107 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
110 COVERAGE_DIR = doc/coverage
111 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
112 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
114 APIDOC_PY_DIR = $(APIDOC_DIR)/py
115 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
117 MAINTAINERCLEANFILES = \
120 doc/install-quick.rst \
125 maintainer-clean-local:
126 rm -rf $(BUILDTIME_DIRS)
129 $(addsuffix /*.py[co],$(DIRS)) \
130 $(addsuffix /*.hi,$(HTOOLS_DIRS)) \
131 $(addsuffix /*.o,$(HTOOLS_DIRS)) \
133 $(PYTHON_BOOTSTRAP) \
135 autotools/replace_vars.sed \
136 daemons/daemon-util \
137 daemons/ganeti-cleaner \
139 doc/examples/bash_completion \
140 doc/examples/ganeti.initd \
141 doc/examples/ganeti-kvm-poweroff.initd \
142 doc/examples/ganeti.cron \
143 doc/examples/gnt-config-backup \
144 doc/examples/hooks/ipsec \
149 $(nodist_pkgpython_PYTHON) \
150 $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
151 .hpc/*.mix htools/*.tix \
154 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
155 # it'll cause the target to rebuild every time.
160 $(PYTHON_BOOTSTRAP) \
161 $(BUILT_PYTHON_SOURCES)
163 BUILT_PYTHON_SOURCES = \
167 nodist_pkgpython_PYTHON = \
168 $(BUILT_PYTHON_SOURCES)
171 lib/build/__init__.py \
172 lib/build/sphinx_ext.py
176 lib/asyncnotifier.py \
208 lib/client/__init__.py \
209 lib/client/gnt_backup.py \
210 lib/client/gnt_cluster.py \
211 lib/client/gnt_debug.py \
212 lib/client/gnt_group.py \
213 lib/client/gnt_instance.py \
214 lib/client/gnt_job.py \
215 lib/client/gnt_node.py \
218 hypervisor_PYTHON = \
219 lib/hypervisor/__init__.py \
220 lib/hypervisor/hv_base.py \
221 lib/hypervisor/hv_chroot.py \
222 lib/hypervisor/hv_fake.py \
223 lib/hypervisor/hv_kvm.py \
224 lib/hypervisor/hv_lxc.py \
225 lib/hypervisor/hv_xen.py
228 lib/rapi/__init__.py \
229 lib/rapi/baserlib.py \
231 lib/rapi/client_utils.py \
232 lib/rapi/connector.py \
236 lib/http/__init__.py \
242 lib/confd/__init__.py \
243 lib/confd/client.py \
244 lib/confd/querylib.py \
248 lib/masterd/__init__.py \
249 lib/masterd/instance.py
252 lib/impexpd/__init__.py
255 lib/watcher/__init__.py \
256 lib/watcher/nodemaint.py \
260 lib/server/__init__.py \
261 lib/server/confd.py \
262 lib/server/masterd.py \
263 lib/server/noded.py \
267 lib/tools/__init__.py \
268 lib/tools/ensure_dirs.py
271 lib/utils/__init__.py \
273 lib/utils/filelock.py \
278 lib/utils/nodesetup.py \
279 lib/utils/process.py \
282 lib/utils/wrapper.py \
291 doc/design-htools-2.3.rst \
294 doc/design-draft.rst \
296 doc/design-cpu-pinning.rst \
297 doc/design-query2.rst \
298 doc/design-x509-ca.rst \
299 doc/design-http-server.rst \
300 doc/design-impexp2.rst \
301 doc/design-lu-generated-jobs.rst \
302 doc/design-multi-reloc.rst \
303 doc/design-network.rst \
304 doc/design-chained-jobs.rst \
305 doc/design-ovf-support.rst \
306 doc/cluster-merge.rst \
307 doc/design-shared-storage.rst \
313 doc/install-quick.rst \
316 doc/move-instance.rst \
323 HS_PROGS = htools/htools
324 HS_BIN_ROLES = hbal hscan hspace
326 HS_ALL_PROGS = $(HS_PROGS) htools/test
327 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
328 # we don't add -Werror by default
329 HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
330 # extra flags that can be overriden on the command line
332 # exclude options for coverage reports
333 HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC \
334 --exclude Ganeti.Constants \
335 --exclude Ganeti.HTools.Version
338 htools/Ganeti/HTools/CLI.hs \
339 htools/Ganeti/HTools/Cluster.hs \
340 htools/Ganeti/HTools/Compat.hs \
341 htools/Ganeti/HTools/Container.hs \
342 htools/Ganeti/HTools/ExtLoader.hs \
343 htools/Ganeti/HTools/Group.hs \
344 htools/Ganeti/HTools/IAlloc.hs \
345 htools/Ganeti/HTools/Instance.hs \
346 htools/Ganeti/HTools/Loader.hs \
347 htools/Ganeti/HTools/Luxi.hs \
348 htools/Ganeti/HTools/Node.hs \
349 htools/Ganeti/HTools/PeerMap.hs \
350 htools/Ganeti/HTools/QC.hs \
351 htools/Ganeti/HTools/Rapi.hs \
352 htools/Ganeti/HTools/Simu.hs \
353 htools/Ganeti/HTools/Text.hs \
354 htools/Ganeti/HTools/Types.hs \
355 htools/Ganeti/HTools/Utils.hs \
356 htools/Ganeti/HTools/Program/Hail.hs \
357 htools/Ganeti/HTools/Program/Hbal.hs \
358 htools/Ganeti/HTools/Program/Hscan.hs \
359 htools/Ganeti/HTools/Program/Hspace.hs \
360 htools/Ganeti/Jobs.hs \
361 htools/Ganeti/Luxi.hs \
362 htools/Ganeti/OpCodes.hs
364 HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
365 HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
367 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
369 # Note: we use here an order-only prerequisite, as the contents of
370 # _autoconf.py are not actually influencing the html build output: it
371 # has to exist in order for the sphinx module to be loaded
372 # successfully, but we certainly don't want the docs to be rebuilt if
374 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
375 $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
376 | $(BUILT_PYTHON_SOURCES)
377 @test -n "$(SPHINX)" || \
378 { echo 'sphinx-build' not found during configure; exit 1; }
380 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
382 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
383 -D release="$(PACKAGE_VERSION)" \
384 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
385 rm -f doc/html/.buildinfo doc/html/objects.inv
388 doc/html: doc/html/index.html
390 doc/install-quick.rst: INSTALL
392 doc/upgrade.rst: UPGRADE
394 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
396 { echo '.. This file is automatically updated at build time from $<.'; \
397 echo '.. Do not edit.'; \
404 doc/design-2.1-lock-acquire.dot \
405 doc/design-2.1-lock-release.dot
407 docpng = $(patsubst %.dot,%.png,$(docdot))
409 # Things to build but not to install (add it to EXTRA_DIST if it should be
414 doc/examples/bash_completion \
415 doc/examples/ganeti.cron \
416 doc/examples/ganeti.initd \
417 doc/examples/ganeti-kvm-poweroff.initd \
418 doc/examples/gnt-config-backup \
419 doc/examples/hooks/ipsec \
424 scripts/gnt-cluster \
427 scripts/gnt-instance \
432 PYTHON_BOOTSTRAP_SBIN = \
433 daemons/ganeti-confd \
434 daemons/ganeti-masterd \
435 daemons/ganeti-noded \
436 daemons/ganeti-watcher \
437 daemons/ganeti-rapi \
439 scripts/gnt-cluster \
442 scripts/gnt-instance \
448 $(PYTHON_BOOTSTRAP_SBIN) \
468 bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
470 @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
471 # FIXME: this is a hardcoded logic, instead of auto-resolving
472 $(LN_S) -f ../../../bin/htools \
473 $(DESTDIR)$(iallocatorsdir)/hail
474 for role in $(HS_BIN_ROLES); do \
476 $(DESTDIR)$(bindir)/$$role ; \
480 $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
481 @if [ -z "$(HTOOLS)" ]; then \
482 echo "Error: htools compilation disabled at configure time" 1>&2 ;\
485 @BINARY=$(@:htools/%=%); \
486 if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
487 echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
490 BINARY=$(@:htools/%=%); $(GHC) --make \
491 $(HFLAGS) $(HEXTRA) \
492 $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
493 -osuf $$BINARY.o -hisuf $$BINARY.hi $@
495 # for the htools/test binary, we need to enable profiling/coverage
496 htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
497 -fno-warn-monomorphism-restriction -fno-warn-orphans \
498 -fno-warn-missing-methods -fno-warn-unused-imports
500 dist_sbin_SCRIPTS = \
501 tools/ganeti-listrunner
503 nodist_sbin_SCRIPTS = \
504 $(PYTHON_BOOTSTRAP_SBIN) \
505 daemons/ganeti-cleaner
512 tools/cluster-merge \
514 tools/move-instance \
516 tools/sanitize-config
518 dist_tools_SCRIPTS = \
520 tools/kvm-console-wrapper \
521 tools/xm-console-wrapper
523 pkglib_python_scripts = \
524 daemons/import-export \
525 tools/check-cert-expired
527 nodist_pkglib_python_scripts = \
530 myexeclib_SCRIPTS = \
531 daemons/daemon-util \
533 $(pkglib_python_scripts)
535 nodist_myexeclib_SCRIPTS = \
536 $(nodist_pkglib_python_scripts)
543 autotools/build-bash-completion \
544 autotools/check-python-code \
545 autotools/check-man \
546 autotools/check-news \
547 autotools/check-tar \
548 autotools/check-version \
549 autotools/convert-constants \
551 autotools/gen-coverage \
552 autotools/testrunner \
554 daemons/daemon-util.in \
555 daemons/ganeti-cleaner.in \
556 $(pkglib_python_scripts) \
564 doc/examples/ganeti.initd.in \
565 doc/examples/ganeti-kvm-poweroff.initd.in \
566 doc/examples/ganeti.cron.in \
567 doc/examples/gnt-config-backup.in \
568 doc/examples/ganeti.default \
569 doc/examples/ganeti.default-debug \
570 doc/examples/hooks/ethers \
571 doc/examples/hooks/ipsec.in \
572 doc/examples/gnt-debug/README \
573 doc/examples/gnt-debug/delay0.json \
574 doc/examples/gnt-debug/delay50.json \
584 $(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
589 man/ganeti-cleaner.8 \
591 man/ganeti-listrunner.8 \
592 man/ganeti-masterd.8 \
594 man/ganeti-os-interface.7 \
596 man/ganeti-watcher.8 \
611 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
612 manhtml = $(patsubst %.rst,%.html,$(manrst))
613 mangen = $(patsubst %.rst,%.gen,$(manrst))
615 $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
616 $(patsubst %.html,%.html.in,$(manhtml)) \
617 man/footer.man man/footer.html $(mangen)
620 test/data/bdev-drbd-8.0.txt \
621 test/data/bdev-drbd-8.3.txt \
622 test/data/bdev-drbd-disk.txt \
623 test/data/bdev-drbd-net-ip4.txt \
624 test/data/bdev-drbd-net-ip6.txt \
625 test/data/cert1.pem \
626 test/data/ip-addr-show-dummy0.txt \
627 test/data/ip-addr-show-lo-ipv4.txt \
628 test/data/ip-addr-show-lo-ipv6.txt \
629 test/data/ip-addr-show-lo-oneline-ipv4.txt \
630 test/data/ip-addr-show-lo-oneline-ipv6.txt \
631 test/data/ip-addr-show-lo-oneline.txt \
632 test/data/ip-addr-show-lo.txt \
633 test/data/proc_drbd8.txt \
634 test/data/proc_drbd80-emptyline.txt \
635 test/data/proc_drbd83.txt \
636 test/data/proc_drbd83_sync.txt \
637 test/data/proc_drbd83_sync_krnl2.6.39.txt \
638 test/data/kvm_1.0_help.txt \
639 test/data/kvm_0.15.90_help.txt \
640 test/data/kvm_0.12.5_help.txt \
641 test/data/kvm_0.9.1_help.txt \
642 test/data/sys_drbd_usermode_helper.txt \
643 test/import-export_unittest-helper
646 test/ganeti.asyncnotifier_unittest.py \
647 test/ganeti.backend_unittest.py \
648 test/ganeti.bdev_unittest.py \
649 test/ganeti.cli_unittest.py \
650 test/ganeti.client.gnt_cluster_unittest.py \
651 test/ganeti.client.gnt_instance_unittest.py \
652 test/ganeti.daemon_unittest.py \
653 test/ganeti.cmdlib_unittest.py \
654 test/ganeti.compat_unittest.py \
655 test/ganeti.confd.client_unittest.py \
656 test/ganeti.config_unittest.py \
657 test/ganeti.constants_unittest.py \
658 test/ganeti.errors_unittest.py \
659 test/ganeti.hooks_unittest.py \
660 test/ganeti.ht_unittest.py \
661 test/ganeti.http_unittest.py \
662 test/ganeti.hypervisor_unittest.py \
663 test/ganeti.hypervisor.hv_chroot_unittest.py \
664 test/ganeti.hypervisor.hv_fake_unittest.py \
665 test/ganeti.hypervisor.hv_kvm_unittest.py \
666 test/ganeti.hypervisor.hv_lxc_unittest.py \
667 test/ganeti.hypervisor.hv_xen_unittest.py \
668 test/ganeti.impexpd_unittest.py \
669 test/ganeti.jqueue_unittest.py \
670 test/ganeti.locking_unittest.py \
671 test/ganeti.luxi_unittest.py \
672 test/ganeti.masterd.instance_unittest.py \
673 test/ganeti.mcpu_unittest.py \
674 test/ganeti.netutils_unittest.py \
675 test/ganeti.objects_unittest.py \
676 test/ganeti.opcodes_unittest.py \
677 test/ganeti.qlang_unittest.py \
678 test/ganeti.query_unittest.py \
679 test/ganeti.rapi.baserlib_unittest.py \
680 test/ganeti.rapi.client_unittest.py \
681 test/ganeti.rapi.resources_unittest.py \
682 test/ganeti.rapi.rlib2_unittest.py \
683 test/ganeti.rpc_unittest.py \
684 test/ganeti.runtime_unittest.py \
685 test/ganeti.serializer_unittest.py \
686 test/ganeti.ssh_unittest.py \
687 test/ganeti.storage_unittest.py \
688 test/ganeti.tools.ensure_dirs_unittest.py \
689 test/ganeti.uidpool_unittest.py \
690 test/ganeti.utils.algo_unittest.py \
691 test/ganeti.utils.filelock_unittest.py \
692 test/ganeti.utils.hash_unittest.py \
693 test/ganeti.utils.io_unittest.py \
694 test/ganeti.utils.log_unittest.py \
695 test/ganeti.utils.mlock_unittest.py \
696 test/ganeti.utils.nodesetup_unittest.py \
697 test/ganeti.utils.process_unittest.py \
698 test/ganeti.utils.retry_unittest.py \
699 test/ganeti.utils.text_unittest.py \
700 test/ganeti.utils.wrapper_unittest.py \
701 test/ganeti.utils.x509_unittest.py \
702 test/ganeti.utils_unittest.py \
703 test/ganeti.workerpool_unittest.py \
704 test/cfgupgrade_unittest.py \
705 test/docs_unittest.py \
706 test/tempfile_fork_unittest.py
708 haskell_tests = htools/test
711 test/check-cert-expired_unittest.bash \
712 test/daemon-util_unittest.bash \
713 test/ganeti-cleaner_unittest.bash \
714 test/import-export_unittest.bash \
719 nodist_TESTS += $(haskell_tests)
722 TESTS = $(dist_TESTS) $(nodist_TESTS)
724 # Environment for all tests
725 PLAIN_TESTS_ENVIRONMENT = \
726 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
728 # Environment for tests run by automake
729 TESTS_ENVIRONMENT = \
730 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
733 $(dist_sbin_SCRIPTS) \
735 $(pkglib_python_scripts) \
736 $(nodist_pkglib_python_scripts) \
738 $(pkgpython_PYTHON) \
740 $(hypervisor_PYTHON) \
755 test/check-cert-expired_unittest.bash \
756 test/daemon-util_unittest.bash \
757 test/ganeti-cleaner_unittest.bash \
758 test/import-export_unittest.bash \
760 $(HS_LIB_SRCS) $(HS_PROG_SRCS)
762 check_python_code = \
763 $(BUILD_BASH_COMPLETION) \
769 ganeti/http/server.py \
770 $(dist_sbin_SCRIPTS) \
772 $(pkglib_python_scripts) \
773 $(BUILD_BASH_COMPLETION) \
779 ganeti/http/server.py \
780 $(dist_sbin_SCRIPTS) \
782 $(pkglib_python_scripts) \
783 $(BUILD_BASH_COMPLETION) \
785 $(PYTHON_BOOTSTRAP) \
788 test/daemon-util_unittest.bash: daemons/daemon-util
790 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
792 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
793 sed -f $(REPLACE_VARS_SED) < $< > $@
796 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
797 sed -f $(REPLACE_VARS_SED) < $< > $@
800 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
801 sed -f $(REPLACE_VARS_SED) < $< > $@
804 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
805 sed -f $(REPLACE_VARS_SED) < $< > $@
807 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
808 sed -f $(REPLACE_VARS_SED) < $< > $@
810 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
811 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
812 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
815 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
816 $(DOT) -Tpng -o $@ $<
818 man/footer.man: man/footer.rst
819 @test -n "$(PANDOC)" || \
820 { echo 'pandoc' not found during configure; exit 1; }
821 $(PANDOC) -f rst -t man -o $@ $<
823 man/footer.html: man/footer.rst
824 @test -n "$(PANDOC)" || \
825 { echo 'pandoc' not found during configure; exit 1; }
826 $(PANDOC) -f rst -t html -o $@ $<
828 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
829 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
831 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
832 @test -n "$(PANDOC)" || \
833 { echo 'pandoc' not found during configure; exit 1; }
835 $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
836 sed -e 's/\\@/@/g' > $@
837 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
839 man/%.html.in: man/%.gen man/footer.html
840 @test -n "$(PANDOC)" || \
841 { echo 'pandoc' not found during configure; exit 1; }
843 $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
844 sed -e 's/\\@/@/g' > $@
846 man/%.1: man/%.1.in $(REPLACE_VARS_SED)
847 sed -f $(REPLACE_VARS_SED) < $< > $@
849 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
850 sed -f $(REPLACE_VARS_SED) < $< > $@
852 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
853 sed -f $(REPLACE_VARS_SED) < $< > $@
855 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
856 sed -f $(REPLACE_VARS_SED) < $< > $@
858 epydoc.conf: epydoc.conf.in Makefile
859 sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
862 if test -d .git; then \
864 elif test ! -f $@ ; then \
865 echo "Cannot auto-generate $@ file"; exit 1; \
868 .PHONY: regen-vcs-version
872 if test -d .git; then \
874 $(MAKE) vcs-version; \
877 htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
879 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
880 sed -e "s/%ver%/$$VCSVER/" < $< > $@
882 htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
883 lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS)
885 { cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
887 lib/_autoconf.py: Makefile | lib/.dir
889 { echo '# This file is automatically generated, do not edit!'; \
892 echo '"""Build-time configuration for Ganeti.'; \
894 echo 'This file is autogenerated by the build process.'; \
895 echo 'For any changes you need to re-run ./configure (and'; \
896 echo 'not edit by hand).'; \
900 echo '# pylint: disable-msg=C0301,C0324'; \
901 echo '# because this is autogenerated, we do not want'; \
902 echo '# style warnings' ; \
904 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
905 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
906 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
907 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
908 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
909 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
910 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
911 echo "SYSCONFDIR = '$(sysconfdir)'"; \
912 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
913 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
914 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
915 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
916 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
917 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
918 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
919 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
920 echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
921 echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
922 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
923 echo "KVM_PATH = '$(KVM_PATH)'"; \
924 echo "IP_PATH = '$(IP_PATH)'"; \
925 echo "SOCAT_PATH = '$(SOCAT)'"; \
926 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
927 echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
928 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
929 echo "TOOLSDIR = '$(toolsdir)'"; \
930 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
931 echo "PKGLIBDIR = '$(pkglibdir)'"; \
932 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
933 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
934 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
935 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
936 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
937 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
938 echo "RAPI_USER = '$(RAPI_USER)'"; \
939 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
940 echo "CONFD_USER = '$(CONFD_USER)'"; \
941 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
942 echo "NODED_USER = '$(NODED_USER)'"; \
943 echo "NODED_GROUP = '$(NODED_GROUP)'"; \
944 echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
945 if [ "$(HTOOLS)" ]; then \
946 echo "HTOOLS = True"; \
948 echo "HTOOLS = False"; \
952 lib/_vcsversion.py: Makefile vcs-version | lib/.dir
954 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
955 { echo '# This file is automatically generated, do not edit!'; \
958 echo '"""Build-time VCS version number for Ganeti.'; \
960 echo 'This file is autogenerated by the build process.'; \
961 echo 'For any changes you need to re-run ./configure (and'; \
962 echo 'not edit by hand).'; \
966 echo '# pylint: disable-msg=C0301,C0324'; \
967 echo '# because this is autogenerated, we do not want'; \
968 echo '# style warnings' ; \
970 echo "VCS_VERSION = '$$VCSVER'"; \
973 $(REPLACE_VARS_SED): Makefile
975 { echo 's#@PREFIX@#$(prefix)#g'; \
976 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
977 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
978 echo 's#@BINDIR@#$(bindir)#g'; \
979 echo 's#@SBINDIR@#$(sbindir)#g'; \
980 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
981 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
982 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
983 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
984 echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
985 echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
986 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
987 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
988 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
989 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
990 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
991 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
992 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
993 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
994 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
995 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
996 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
997 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
1000 # Using deferred evaluation
1001 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
1002 daemons/ganeti-watcher: MODULE = ganeti.watcher
1003 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
1004 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
1006 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
1007 test -n "$(MODULE)" || { echo Missing module; exit 1; }
1009 { echo '#!/usr/bin/python'; \
1010 echo '# This file is automatically generated, do not edit!'; \
1011 echo "# Edit $(MODULE) instead."; \
1013 echo '"""Bootstrap script for L{$(MODULE)}"""'; \
1015 echo '# pylint: disable-msg=C0103'; \
1016 echo '# C0103: Invalid name'; \
1018 echo 'import sys'; \
1019 echo 'import $(MODULE) as main'; \
1021 echo '# Temporarily alias commands until bash completion'; \
1022 echo '# generator is changed'; \
1023 echo 'if hasattr(main, "commands"):'; \
1024 echo ' commands = main.commands # pylint: disable-msg=E1101'; \
1025 echo 'if hasattr(main, "aliases"):'; \
1026 echo ' aliases = main.aliases # pylint: disable-msg=E1101'; \
1028 echo 'if __name__ == "__main__":'; \
1029 echo ' sys.exit(main.Main())'; \
1033 # We need to create symlinks because "make distcheck" will not install Python
1034 # files when building.
1035 stamp-srclinks: Makefile | $(all_dirfiles)
1037 for i in $(srclink_files); do \
1038 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
1039 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
1046 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
1049 check-dirs: $(BUILT_SOURCES)
1051 find . -type d \( \( -name . \) -o \( \
1053 -name autom4te.cache \
1054 \) -prune -o -print \) | { \
1056 while read dir; do \
1058 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
1059 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
1062 for dir in $(DIRS); do \
1063 if ! test -d "$$dir"; then \
1064 echo "Directory $$dir listed in DIRS does not exist" >&2; \
1068 if test -n "$$error"; then exit 1; else exit 0; fi; \
1071 check-local: check-dirs
1072 $(CHECK_PYTHON_CODE) $(check_python_code)
1073 $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1074 $(CHECK_NEWS) < $(top_srcdir)/NEWS
1075 expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1076 if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1077 echo "Incorrect version in README, expected $$expver"; \
1080 for file in doc/iallocator.rst doc/hooks.rst; do \
1081 if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
1082 "Documents Ganeti version $$expver"; then \
1083 echo "Incorrect version in $$file, expected $$expver"; \
1089 hs-check: htools/test
1093 # E111: indentation is not a multiple of four
1094 # E261: at least two spaces before inline comment
1095 # E501: line too long (80 characters)
1096 PEP8_IGNORE = E111,E261,E501
1098 # For excluding pep8 expects filenames only, not whole paths
1099 PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
1102 lint: $(BUILT_SOURCES)
1103 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1104 if test -z "$(PEP8)"; then \
1105 echo '"pep8" not found during configure' >&2; \
1107 $(PEP8) --repeat --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
1108 $(pep8_python_code); \
1110 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
1111 cd $(top_srcdir)/qa && \
1112 PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1113 --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1116 hlint: $(HS_BUILT_SRCS)
1117 if tty -s; then C="-c"; else C=""; fi; \
1118 hlint --report=doc/hs-lint.html $$C htools
1120 # a dist hook rule for updating the vcs-version file; this is
1121 # hardcoded due to where it needs to build the file...
1123 $(MAKE) regen-vcs-version && \
1124 rm -f $(top_distdir)/vcs-version && \
1125 cp -p $(srcdir)/vcs-version $(top_distdir)
1127 # a distcheck hook rule for catching revision control directories
1129 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1130 echo "Found revision control files in final archive." 1>&2; \
1133 if find $(top_distdir) -name '*.py[co]' | grep .; then \
1134 echo "Found Python byte code in final archive." 1>&2; \
1137 if find $(top_distdir) -name '*~' | grep .; then \
1138 echo "Found backup files in final archive." 1>&2; \
1141 # Empty files or directories should not be distributed. They can cause
1142 # unnecessary warnings for packagers. Directories used by automake during
1143 # distcheck must be excluded.
1144 if find $(top_distdir) -empty -and -not \( \
1145 -path $(top_distdir)/_build -or \
1146 -path $(top_distdir)/_inst \) | grep .; then \
1147 echo "Found empty files or directories in final archive." 1>&2; \
1150 if test -n "$(BUILD_RELEASE)" && \
1151 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1152 echo "Found unreleased version in NEWS." >&2; \
1156 # When building a release, stricter checks should be used
1157 distcheck-release dist-release: export BUILD_RELEASE = 1
1158 distcheck-release: distcheck
1162 for i in $(DIST_ARCHIVES); do \
1163 echo -n "Checking $$i ... "; \
1164 autotools/check-tar < $$i; \
1169 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1170 "$(DESTDIR)${localstatedir}/log/ganeti" \
1171 "$(DESTDIR)${localstatedir}/run/ganeti"
1173 # To avoid conflicts between directory names and other targets, a file inside
1174 # the directory is used to ensure its existence.
1176 @mkdir_p@ $* && touch $@
1179 if WANT_HTOOLSAPIDOC
1180 apidoc: py-apidoc hs-apidoc
1186 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1187 $(RUN_IN_TEMPDIR) epydoc -v \
1188 --conf $(CURDIR)/epydoc.conf \
1189 --output $(CURDIR)/$(APIDOC_PY_DIR)
1192 hs-apidoc: $(HS_BUILT_SRCS)
1193 @test -n "$(HSCOLOUR)" || \
1194 { echo 'HsColour' not found during configure; exit 1; }
1195 @test -n "$(HADDOCK)" || \
1196 { echo 'haddock' not found during configure; exit 1; }
1197 rm -rf $(APIDOC_HS_DIR)/*
1198 @mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools/Program
1199 $(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1200 $(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1203 if [ "$(HTOOLS_NOCURL)" ]; \
1204 then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1207 if [ "$(HTOOLS_PARALLEL3)" ]; \
1208 then OPTGHC="$$OPTGHC --optghc=$(HTOOLS_PARALLEL3)"; \
1210 RELSRCS="$(HS_LIB_SRCS:htools/%=%) $(HS_BUILT_SRCS:htools/%=%)"; \
1211 for file in $$RELSRCS; do \
1212 hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1213 $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1215 $(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1216 -t ganeti-htools -p haddock-prologue \
1217 --source-module="%{MODULE/.//}.html" \
1218 --source-entity="%{MODULE/.//}.html#%{NAME}" \
1220 $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1223 TAGS: $(BUILT_SOURCES)
1225 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1226 -path './daemons/ganeti-*' -o -path './tools/*' -o \
1227 -path './qa/*.py' | \
1232 coverage: py-coverage hs-coverage
1234 coverage: py-coverage
1238 py-coverage: $(BUILT_SOURCES) $(python_tests)
1240 COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1241 TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1242 HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1243 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1247 hs-coverage: $(haskell_tests)
1248 cd htools && rm -f *.tix *.mix && ./test
1249 @mkdir_p@ $(COVERAGE_HS_DIR)
1250 hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1251 hpc report htools/test $(HPCEXCL)
1252 $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
1254 # Special "kind-of-QA" target for htools, needs special setup (all
1255 # tools compiled with -fhpc)
1260 rm -f .hpc; $(LN_S) ../.hpc .hpc; \
1261 rm -f *.tix *.mix; \
1263 hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1264 --output=live-test.tix ; \
1265 @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1266 hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1267 --srcdir=.. $(HPCEXCL) ; \
1268 hpc report --srcdir=.. live-test $(HPCEXCL)
1270 commit-check: distcheck lint apidoc
1272 -include ./Makefile.local