2 # - Indent with tabs only.
3 # - Keep files sorted; one line per file.
4 # - Directories in lib/ must have their own *dir variable (see hypervisor).
5 # - All directories must be listed DIRS.
6 # - Use autogen.sh to generate Makefile.in and configure script.
8 # Automake doesn't export these variables before version 1.10.
9 abs_top_builddir = @abs_top_builddir@
10 abs_top_srcdir = @abs_top_srcdir@
12 # Use bash in order to be able to use pipefail
15 ACLOCAL_AMFLAGS = -I autotools
16 BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
17 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
18 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
19 CHECK_MAN = $(top_srcdir)/autotools/check-man
20 CHECK_VERSION = $(top_srcdir)/autotools/check-version
21 CHECK_NEWS = $(top_srcdir)/autotools/check-news
22 DOCPP = $(top_srcdir)/autotools/docpp
23 REPLACE_VARS_SED = autotools/replace_vars.sed
24 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
26 # Note: these are automake-specific variables, and must be named after
27 # the directory + 'dir' suffix
28 clientdir = $(pkgpythondir)/client
29 hypervisordir = $(pkgpythondir)/hypervisor
30 httpdir = $(pkgpythondir)/http
31 masterddir = $(pkgpythondir)/masterd
32 confddir = $(pkgpythondir)/confd
33 rapidir = $(pkgpythondir)/rapi
34 serverdir = $(pkgpythondir)/server
35 watcherdir = $(pkgpythondir)/watcher
36 impexpddir = $(pkgpythondir)/impexpd
37 utilsdir = $(pkgpythondir)/utils
38 toolsdir = $(pkglibdir)/tools
39 iallocatorsdir = $(pkglibdir)/iallocators
40 pytoolsdir = $(pkgpythondir)/tools
41 docdir = $(datadir)/doc/$(PACKAGE)
43 # Delete output file if an error occurred while building it
49 htools/Ganeti/HTools \
50 htools/Ganeti/HTools/Program
59 doc/examples/gnt-debug \
80 BUILDTIME_DIR_AUTOCREATE = \
85 $(APIDOC_HS_DIR)/Ganeti $(APIDOC_HS_DIR)/Ganeti/HTools \
86 $(APIDOC_HS_DIR)/Ganeti/HTools/Program \
93 $(BUILDTIME_DIR_AUTOCREATE) \
98 ganeti-[0-9]*.[0-9]*.[0-9]* \
101 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
104 COVERAGE_DIR = doc/coverage
105 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
106 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
108 APIDOC_PY_DIR = $(APIDOC_DIR)/py
109 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
111 MAINTAINERCLEANFILES = \
114 doc/install-quick.rst \
119 maintainer-clean-local:
120 rm -rf $(BUILDTIME_DIRS)
123 $(addsuffix /*.py[co],$(DIRS)) \
124 $(addsuffix /*.hi,$(HTOOLS_DIRS)) \
125 $(addsuffix /*.o,$(HTOOLS_DIRS)) \
127 $(PYTHON_BOOTSTRAP) \
129 autotools/replace_vars.sed \
130 daemons/daemon-util \
131 daemons/ganeti-cleaner \
133 doc/examples/bash_completion \
134 doc/examples/ganeti.initd \
135 doc/examples/ganeti-kvm-poweroff.initd \
136 doc/examples/ganeti.cron \
137 doc/examples/gnt-config-backup \
138 doc/examples/hooks/ipsec \
143 $(nodist_pkgpython_PYTHON) \
144 $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
145 .hpc/*.mix htools/*.tix \
148 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
149 # it'll cause the target to rebuild every time.
158 nodist_pkgpython_PYTHON = \
163 lib/build/__init__.py \
164 lib/build/sphinx_ext.py
168 lib/asyncnotifier.py \
200 lib/client/__init__.py \
201 lib/client/gnt_backup.py \
202 lib/client/gnt_cluster.py \
203 lib/client/gnt_debug.py \
204 lib/client/gnt_group.py \
205 lib/client/gnt_instance.py \
206 lib/client/gnt_job.py \
207 lib/client/gnt_node.py \
210 hypervisor_PYTHON = \
211 lib/hypervisor/__init__.py \
212 lib/hypervisor/hv_base.py \
213 lib/hypervisor/hv_chroot.py \
214 lib/hypervisor/hv_fake.py \
215 lib/hypervisor/hv_kvm.py \
216 lib/hypervisor/hv_lxc.py \
217 lib/hypervisor/hv_xen.py
220 lib/rapi/__init__.py \
221 lib/rapi/baserlib.py \
223 lib/rapi/client_utils.py \
224 lib/rapi/connector.py \
228 lib/http/__init__.py \
234 lib/confd/__init__.py \
235 lib/confd/client.py \
236 lib/confd/querylib.py \
240 lib/masterd/__init__.py \
241 lib/masterd/instance.py
244 lib/impexpd/__init__.py
247 lib/watcher/__init__.py \
248 lib/watcher/nodemaint.py \
252 lib/server/__init__.py \
253 lib/server/confd.py \
254 lib/server/masterd.py \
255 lib/server/noded.py \
259 lib/tools/__init__.py \
260 lib/tools/ensure_dirs.py
263 lib/utils/__init__.py \
265 lib/utils/filelock.py \
270 lib/utils/nodesetup.py \
271 lib/utils/process.py \
274 lib/utils/wrapper.py \
283 doc/design-htools-2.3.rst \
285 doc/design-draft.rst \
287 doc/design-cpu-pinning.rst \
288 doc/design-query2.rst \
289 doc/design-x509-ca.rst \
290 doc/design-http-server.rst \
291 doc/design-impexp2.rst \
292 doc/design-lu-generated-jobs.rst \
293 doc/design-multi-reloc.rst \
294 doc/design-network.rst \
295 doc/design-chained-jobs.rst \
296 doc/cluster-merge.rst \
297 doc/design-shared-storage.rst \
303 doc/install-quick.rst \
306 doc/move-instance.rst \
313 HS_PROGS = htools/htools
314 HS_BIN_ROLES = hbal hscan hspace
316 HS_ALL_PROGS = $(HS_PROGS) htools/test
317 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
318 # we don't add -Werror by default
319 HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
320 # extra flags that can be overriden on the command line
322 # exclude options for coverage reports
323 HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC \
324 --exclude Ganeti.Constants \
325 --exclude Ganeti.HTools.Version
328 htools/Ganeti/HTools/CLI.hs \
329 htools/Ganeti/HTools/Cluster.hs \
330 htools/Ganeti/HTools/Compat.hs \
331 htools/Ganeti/HTools/Container.hs \
332 htools/Ganeti/HTools/ExtLoader.hs \
333 htools/Ganeti/HTools/Group.hs \
334 htools/Ganeti/HTools/IAlloc.hs \
335 htools/Ganeti/HTools/Instance.hs \
336 htools/Ganeti/HTools/Loader.hs \
337 htools/Ganeti/HTools/Luxi.hs \
338 htools/Ganeti/HTools/Node.hs \
339 htools/Ganeti/HTools/PeerMap.hs \
340 htools/Ganeti/HTools/QC.hs \
341 htools/Ganeti/HTools/Rapi.hs \
342 htools/Ganeti/HTools/Simu.hs \
343 htools/Ganeti/HTools/Text.hs \
344 htools/Ganeti/HTools/Types.hs \
345 htools/Ganeti/HTools/Utils.hs \
346 htools/Ganeti/HTools/Program/Hail.hs \
347 htools/Ganeti/HTools/Program/Hbal.hs \
348 htools/Ganeti/HTools/Program/Hscan.hs \
349 htools/Ganeti/HTools/Program/Hspace.hs \
350 htools/Ganeti/Jobs.hs \
351 htools/Ganeti/Luxi.hs \
352 htools/Ganeti/OpCodes.hs
354 HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
355 HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
357 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
359 # Note: we use here an order-only prerequisite, as the contents of
360 # _autoconf.py are not actually influencing the html build output: it
361 # has to exist in order for the sphinx module to be loaded
362 # successfully, but we certainly don't want the docs to be rebuilt if
364 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
365 $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
366 | lib/_autoconf.py lib/_vcsversion.py
367 @test -n "$(SPHINX)" || \
368 { echo 'sphinx-build' not found during configure; exit 1; }
370 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
372 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
373 -D release="$(PACKAGE_VERSION)" \
374 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
375 rm -f doc/html/.buildinfo doc/html/objects.inv
378 doc/html: doc/html/index.html
380 doc/install-quick.rst: INSTALL
382 doc/upgrade.rst: UPGRADE
384 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
386 { echo '.. This file is automatically updated at build time from $<.'; \
387 echo '.. Do not edit.'; \
394 doc/design-2.1-lock-acquire.dot \
395 doc/design-2.1-lock-release.dot
397 docpng = $(patsubst %.dot,%.png,$(docdot))
399 # Things to build but not to install (add it to EXTRA_DIST if it should be
404 doc/examples/bash_completion \
405 doc/examples/ganeti.cron \
406 doc/examples/ganeti.initd \
407 doc/examples/ganeti-kvm-poweroff.initd \
408 doc/examples/gnt-config-backup \
409 doc/examples/hooks/ipsec \
414 scripts/gnt-cluster \
417 scripts/gnt-instance \
422 PYTHON_BOOTSTRAP_SBIN = \
423 daemons/ganeti-confd \
424 daemons/ganeti-masterd \
425 daemons/ganeti-noded \
426 daemons/ganeti-watcher \
427 daemons/ganeti-rapi \
429 scripts/gnt-cluster \
432 scripts/gnt-instance \
438 $(PYTHON_BOOTSTRAP_SBIN) \
457 bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
459 @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
460 # FIXME: this is a hardcoded logic, instead of auto-resolving
461 $(LN_S) -f ../../../bin/htools \
462 $(DESTDIR)$(iallocatorsdir)/hail
463 for role in $(HS_BIN_ROLES); do \
465 $(DESTDIR)$(bindir)/$$role ; \
469 $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
470 @if [ -z "$(HTOOLS)" ]; then \
471 echo "Error: htools compilation disabled at configure time" 1>&2 ;\
474 @BINARY=$(@:htools/%=%); \
475 if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
476 echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
479 BINARY=$(@:htools/%=%); $(GHC) --make \
480 $(HFLAGS) $(HEXTRA) \
481 $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
482 -osuf $$BINARY.o -hisuf $$BINARY.hi $@
484 # for the htools/test binary, we need to enable profiling/coverage
485 htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
486 -fno-warn-monomorphism-restriction -fno-warn-orphans \
487 -fno-warn-missing-methods -fno-warn-unused-imports
489 dist_sbin_SCRIPTS = \
490 tools/ganeti-listrunner
492 nodist_sbin_SCRIPTS = \
493 $(PYTHON_BOOTSTRAP_SBIN) \
494 daemons/ganeti-cleaner
496 dist_tools_PYTHON = \
501 tools/cluster-merge \
503 tools/move-instance \
505 tools/sanitize-config
507 dist_tools_SCRIPTS = \
508 $(dist_tools_PYTHON) \
509 tools/kvm-console-wrapper \
510 tools/xm-console-wrapper
512 pkglib_python_scripts = \
513 daemons/import-export \
514 tools/check-cert-expired
516 nodist_pkglib_python_scripts = \
520 daemons/daemon-util \
522 $(pkglib_python_scripts)
524 nodist_pkglib_SCRIPTS = \
525 $(nodist_pkglib_python_scripts)
532 autotools/build-bash-completion \
533 autotools/check-python-code \
534 autotools/check-man \
535 autotools/check-news \
536 autotools/check-tar \
537 autotools/check-version \
538 autotools/convert-constants \
540 autotools/gen-coverage \
541 autotools/testrunner \
543 daemons/daemon-util.in \
544 daemons/ganeti-cleaner.in \
545 $(pkglib_python_scripts) \
553 doc/examples/ganeti.initd.in \
554 doc/examples/ganeti-kvm-poweroff.initd.in \
555 doc/examples/ganeti.cron.in \
556 doc/examples/gnt-config-backup.in \
557 doc/examples/ganeti.default \
558 doc/examples/ganeti.default-debug \
559 doc/examples/hooks/ethers \
560 doc/examples/hooks/ipsec.in \
561 doc/examples/gnt-debug/README \
562 doc/examples/gnt-debug/delay0.json \
563 doc/examples/gnt-debug/delay50.json \
573 $(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
578 man/ganeti-cleaner.8 \
580 man/ganeti-listrunner.8 \
581 man/ganeti-masterd.8 \
583 man/ganeti-os-interface.7 \
585 man/ganeti-watcher.8 \
600 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
601 manhtml = $(patsubst %.rst,%.html,$(manrst))
602 mangen = $(patsubst %.rst,%.gen,$(manrst))
604 $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
605 $(patsubst %.html,%.html.in,$(manhtml)) \
606 man/footer.man man/footer.html $(mangen)
609 test/data/bdev-drbd-8.0.txt \
610 test/data/bdev-drbd-8.3.txt \
611 test/data/bdev-drbd-disk.txt \
612 test/data/bdev-drbd-net-ip4.txt \
613 test/data/bdev-drbd-net-ip6.txt \
614 test/data/cert1.pem \
615 test/data/proc_drbd8.txt \
616 test/data/proc_drbd80-emptyline.txt \
617 test/data/proc_drbd83.txt \
618 test/data/sys_drbd_usermode_helper.txt \
619 test/import-export_unittest-helper
622 test/ganeti.asyncnotifier_unittest.py \
623 test/ganeti.backend_unittest.py \
624 test/ganeti.bdev_unittest.py \
625 test/ganeti.cli_unittest.py \
626 test/ganeti.client.gnt_cluster_unittest.py \
627 test/ganeti.client.gnt_instance_unittest.py \
628 test/ganeti.daemon_unittest.py \
629 test/ganeti.cmdlib_unittest.py \
630 test/ganeti.compat_unittest.py \
631 test/ganeti.confd.client_unittest.py \
632 test/ganeti.config_unittest.py \
633 test/ganeti.constants_unittest.py \
634 test/ganeti.errors_unittest.py \
635 test/ganeti.hooks_unittest.py \
636 test/ganeti.ht_unittest.py \
637 test/ganeti.http_unittest.py \
638 test/ganeti.hypervisor_unittest.py \
639 test/ganeti.hypervisor.hv_chroot_unittest.py \
640 test/ganeti.hypervisor.hv_fake_unittest.py \
641 test/ganeti.hypervisor.hv_kvm_unittest.py \
642 test/ganeti.hypervisor.hv_lxc_unittest.py \
643 test/ganeti.hypervisor.hv_xen_unittest.py \
644 test/ganeti.impexpd_unittest.py \
645 test/ganeti.jqueue_unittest.py \
646 test/ganeti.locking_unittest.py \
647 test/ganeti.luxi_unittest.py \
648 test/ganeti.masterd.instance_unittest.py \
649 test/ganeti.mcpu_unittest.py \
650 test/ganeti.netutils_unittest.py \
651 test/ganeti.objects_unittest.py \
652 test/ganeti.opcodes_unittest.py \
653 test/ganeti.qlang_unittest.py \
654 test/ganeti.query_unittest.py \
655 test/ganeti.rapi.baserlib_unittest.py \
656 test/ganeti.rapi.client_unittest.py \
657 test/ganeti.rapi.resources_unittest.py \
658 test/ganeti.rapi.rlib2_unittest.py \
659 test/ganeti.rpc_unittest.py \
660 test/ganeti.runtime_unittest.py \
661 test/ganeti.serializer_unittest.py \
662 test/ganeti.ssh_unittest.py \
663 test/ganeti.tools.ensure_dirs_unittest.py \
664 test/ganeti.uidpool_unittest.py \
665 test/ganeti.utils.algo_unittest.py \
666 test/ganeti.utils.filelock_unittest.py \
667 test/ganeti.utils.hash_unittest.py \
668 test/ganeti.utils.io_unittest.py \
669 test/ganeti.utils.log_unittest.py \
670 test/ganeti.utils.mlock_unittest.py \
671 test/ganeti.utils.nodesetup_unittest.py \
672 test/ganeti.utils.process_unittest.py \
673 test/ganeti.utils.retry_unittest.py \
674 test/ganeti.utils.text_unittest.py \
675 test/ganeti.utils.wrapper_unittest.py \
676 test/ganeti.utils.x509_unittest.py \
677 test/ganeti.utils_unittest.py \
678 test/ganeti.workerpool_unittest.py \
679 test/cfgupgrade_unittest.py \
680 test/docs_unittest.py \
681 test/tempfile_fork_unittest.py
683 haskell_tests = htools/test
686 test/check-cert-expired_unittest.bash \
687 test/daemon-util_unittest.bash \
688 test/ganeti-cleaner_unittest.bash \
689 test/import-export_unittest.bash \
694 nodist_TESTS += $(haskell_tests)
697 TESTS = $(dist_TESTS) $(nodist_TESTS)
699 # Environment for all tests
700 PLAIN_TESTS_ENVIRONMENT = \
701 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
703 # Environment for tests run by automake
704 TESTS_ENVIRONMENT = \
705 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
708 $(dist_sbin_SCRIPTS) \
709 $(dist_tools_PYTHON) \
710 $(pkglib_python_scripts) \
711 $(nodist_pkglib_python_scripts) \
713 $(pkgpython_PYTHON) \
715 $(hypervisor_PYTHON) \
730 test/check-cert-expired_unittest.bash \
731 test/daemon-util_unittest.bash \
732 test/ganeti-cleaner_unittest.bash \
733 test/import-export_unittest.bash \
735 $(HS_LIB_SRCS) $(HS_PROG_SRCS)
737 check_python_code = \
738 $(BUILD_BASH_COMPLETION) \
744 ganeti/http/server.py \
745 $(dist_sbin_SCRIPTS) \
746 $(dist_tools_PYTHON) \
747 $(pkglib_python_scripts) \
748 $(BUILD_BASH_COMPLETION) \
752 test/daemon-util_unittest.bash: daemons/daemon-util
754 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
756 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
757 sed -f $(REPLACE_VARS_SED) < $< > $@
760 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
761 sed -f $(REPLACE_VARS_SED) < $< > $@
764 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
765 sed -f $(REPLACE_VARS_SED) < $< > $@
768 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
769 sed -f $(REPLACE_VARS_SED) < $< > $@
771 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
772 sed -f $(REPLACE_VARS_SED) < $< > $@
774 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
775 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
776 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
779 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
780 $(DOT) -Tpng -o $@ $<
782 man/footer.man: man/footer.rst
783 @test -n "$(PANDOC)" || \
784 { echo 'pandoc' not found during configure; exit 1; }
785 $(PANDOC) -f rst -t man -o $@ $<
787 man/footer.html: man/footer.rst
788 @test -n "$(PANDOC)" || \
789 { echo 'pandoc' not found during configure; exit 1; }
790 $(PANDOC) -f rst -t html -o $@ $<
792 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
793 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
795 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
796 @test -n "$(PANDOC)" || \
797 { echo 'pandoc' not found during configure; exit 1; }
799 $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
800 sed -e 's/\\@/@/g' > $@
801 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
803 man/%.html.in: man/%.gen man/footer.html
804 @test -n "$(PANDOC)" || \
805 { echo 'pandoc' not found during configure; exit 1; }
807 $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
808 sed -e 's/\\@/@/g' > $@
810 man/%.1: man/%.1.in $(REPLACE_VARS_SED)
811 sed -f $(REPLACE_VARS_SED) < $< > $@
813 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
814 sed -f $(REPLACE_VARS_SED) < $< > $@
816 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
817 sed -f $(REPLACE_VARS_SED) < $< > $@
819 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
820 sed -f $(REPLACE_VARS_SED) < $< > $@
822 epydoc.conf: epydoc.conf.in Makefile
823 sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
826 if test -d .git; then \
828 elif test ! -f $@ ; then \
829 echo "Cannot auto-generate $@ file"; exit 1; \
832 .PHONY: regen-vcs-version
836 if test -d .git; then \
838 $(MAKE) vcs-version; \
841 htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
843 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
844 sed -e "s/%ver%/$$VCSVER/" < $< > $@
846 htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
847 lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS)
849 { cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
851 lib/_autoconf.py: Makefile | lib/.dir
853 { echo '# This file is automatically generated, do not edit!'; \
856 echo '"""Build-time configuration for Ganeti.'; \
858 echo 'This file is autogenerated by the build process.'; \
859 echo 'For any changes you need to re-run ./configure (and'; \
860 echo 'not edit by hand).'; \
864 echo '# pylint: disable-msg=C0301,C0324'; \
865 echo '# because this is autogenerated, we do not want'; \
866 echo '# style warnings' ; \
868 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
869 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
870 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
871 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
872 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
873 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
874 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
875 echo "SYSCONFDIR = '$(sysconfdir)'"; \
876 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
877 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
878 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
879 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
880 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
881 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
882 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
883 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
884 echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
885 echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
886 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
887 echo "KVM_PATH = '$(KVM_PATH)'"; \
888 echo "SOCAT_PATH = '$(SOCAT)'"; \
889 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
890 echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
891 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
892 echo "TOOLSDIR = '$(toolsdir)'"; \
893 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
894 echo "PKGLIBDIR = '$(pkglibdir)'"; \
895 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
896 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
897 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
898 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
899 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
900 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
901 echo "RAPI_USER = '$(RAPI_USER)'"; \
902 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
903 echo "CONFD_USER = '$(CONFD_USER)'"; \
904 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
905 echo "NODED_USER = '$(NODED_USER)'"; \
906 echo "NODED_GROUP = '$(NODED_GROUP)'"; \
907 echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
908 if [ "$(HTOOLS)" ]; then \
909 echo "HTOOLS = True"; \
911 echo "HTOOLS = False"; \
915 lib/_vcsversion.py: Makefile vcs-version | lib/.dir
917 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
918 { echo '# This file is automatically generated, do not edit!'; \
921 echo '"""Build-time VCS version number for Ganeti.'; \
923 echo 'This file is autogenerated by the build process.'; \
924 echo 'For any changes you need to re-run ./configure (and'; \
925 echo 'not edit by hand).'; \
929 echo '# pylint: disable-msg=C0301,C0324'; \
930 echo '# because this is autogenerated, we do not want'; \
931 echo '# style warnings' ; \
933 echo "VCS_VERSION = '$$VCSVER'"; \
936 $(REPLACE_VARS_SED): Makefile
938 { echo 's#@PREFIX@#$(prefix)#g'; \
939 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
940 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
941 echo 's#@BINDIR@#$(bindir)#g'; \
942 echo 's#@SBINDIR@#$(sbindir)#g'; \
943 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
944 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
945 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
946 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
947 echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
948 echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
949 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
950 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
951 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
952 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
953 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
954 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
955 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
956 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
957 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
958 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
959 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
960 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
963 # Using deferred evaluation
964 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
965 daemons/ganeti-watcher: MODULE = ganeti.watcher
966 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
967 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
969 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
970 test -n "$(MODULE)" || { echo Missing module; exit 1; }
972 { echo '#!/usr/bin/python'; \
973 echo '# This file is automatically generated, do not edit!'; \
974 echo "# Edit $(MODULE) instead."; \
976 echo '"""Bootstrap script for L{$(MODULE)}"""'; \
978 echo '# pylint: disable-msg=C0103'; \
979 echo '# C0103: Invalid name'; \
982 echo 'import $(MODULE) as main'; \
984 echo '# Temporarily alias commands until bash completion'; \
985 echo '# generator is changed'; \
986 echo 'if hasattr(main, "commands"):'; \
987 echo ' commands = main.commands # pylint: disable-msg=E1101'; \
988 echo 'if hasattr(main, "aliases"):'; \
989 echo ' aliases = main.aliases # pylint: disable-msg=E1101'; \
991 echo 'if __name__ == "__main__":'; \
992 echo ' sys.exit(main.Main())'; \
996 # We need to create symlinks because "make distcheck" will not install Python
997 # files when building.
998 stamp-srclinks: Makefile | $(all_dirfiles)
1000 for i in $(srclink_files); do \
1001 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
1002 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
1009 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
1012 check-dirs: $(BUILT_SOURCES)
1014 find . -type d \( \( -name . \) -o \( \
1016 -name autom4te.cache \
1017 \) -prune -o -print \) | { \
1019 while read dir; do \
1021 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
1022 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
1025 for dir in $(DIRS); do \
1026 if ! test -d "$$dir"; then \
1027 echo "Directory $$dir listed in DIRS does not exist" >&2; \
1031 if test -n "$$error"; then exit 1; else exit 0; fi; \
1034 check-local: check-dirs
1035 $(CHECK_PYTHON_CODE) $(check_python_code)
1036 $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1037 $(CHECK_NEWS) < $(top_srcdir)/NEWS
1038 expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1039 if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1040 echo "Incorrect version in README, expected $$expver"; \
1043 if test "`sed -ne '4 p' $(top_srcdir)/doc/iallocator.rst`" != \
1044 "Documents Ganeti version $$expver"; then \
1045 echo "Incorrect version in iallocator.rst, expected $$expver"; \
1050 hs-check: htools/test
1055 lint: $(BUILT_SOURCES)
1056 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1057 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
1058 cd $(top_srcdir)/qa && \
1059 PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1060 --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1063 hlint: $(HS_BUILT_SRCS)
1064 if tty -s; then C="-c"; else C=""; fi; \
1065 hlint --report=doc/hs-lint.html $$C htools
1067 # a dist hook rule for updating the vcs-version file; this is
1068 # hardcoded due to where it needs to build the file...
1070 $(MAKE) regen-vcs-version && \
1071 rm -f $(top_distdir)/vcs-version && \
1072 cp -p $(srcdir)/vcs-version $(top_distdir)
1074 # a distcheck hook rule for catching revision control directories
1076 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1077 echo "Found revision control files in final archive." 1>&2; \
1080 if find $(top_distdir) -name '*.py[co]' | grep .; then \
1081 echo "Found Python byte code in final archive." 1>&2; \
1084 if find $(top_distdir) -name '*~' | grep .; then \
1085 echo "Found backup files in final archive." 1>&2; \
1088 # Empty files or directories should not be distributed. They can cause
1089 # unnecessary warnings for packagers. Directories used by automake during
1090 # distcheck must be excluded.
1091 if find $(top_distdir) -empty -and -not \( \
1092 -path $(top_distdir)/_build -or \
1093 -path $(top_distdir)/_inst \) | grep .; then \
1094 echo "Found empty files or directories in final archive." 1>&2; \
1097 if test -n "$(BUILD_RELEASE)" && \
1098 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1099 echo "Found unreleased version in NEWS." >&2; \
1103 # When building a release, stricter checks should be used
1104 distcheck-release dist-release: export BUILD_RELEASE = 1
1105 distcheck-release: distcheck
1109 for i in $(DIST_ARCHIVES); do \
1110 echo -n "Checking $$i ... "; \
1111 autotools/check-tar < $$i; \
1116 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1117 "$(DESTDIR)${localstatedir}/log/ganeti" \
1118 "$(DESTDIR)${localstatedir}/run/ganeti"
1120 # To avoid conflicts between directory names and other targets, a file inside
1121 # the directory is used to ensure its existence.
1123 @mkdir_p@ $* && touch $@
1126 if WANT_HTOOLSAPIDOC
1127 apidoc: py-apidoc hs-apidoc
1133 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1134 $(RUN_IN_TEMPDIR) epydoc -v \
1135 --conf $(CURDIR)/epydoc.conf \
1136 --output $(CURDIR)/$(APIDOC_PY_DIR)
1139 hs-apidoc: $(HS_BUILT_SRCS)
1140 @test -n "$(HSCOLOUR)" || \
1141 { echo 'HsColour' not found during configure; exit 1; }
1142 @test -n "$(HADDOCK)" || \
1143 { echo 'haddock' not found during configure; exit 1; }
1144 rm -rf $(APIDOC_HS_DIR)/*
1145 @mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools/Program
1146 $(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1147 ln -s ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1150 if [ "$(HTOOLS_NOCURL)" ]; \
1151 then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1154 if [ "$(HTOOLS_PARALLEL3)" ]; \
1155 then OPTGHC="$$OPTGHC --optghc=$(HTOOLS_PARALLEL3)"; \
1157 RELSRCS="$(HS_LIB_SRCS:htools/%=%) $(HS_BUILT_SRCS:htools/%=%)"; \
1158 for file in $$RELSRCS; do \
1159 hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1160 $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1162 $(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1163 -t ganeti-htools -p haddock-prologue \
1164 --source-module="%{MODULE/.//}.html" \
1165 --source-entity="%{MODULE/.//}.html#%{NAME}" \
1167 $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1170 TAGS: $(BUILT_SOURCES)
1172 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1173 -path './daemons/ganeti-*' -o -path './tools/*' -o \
1174 -path './qa/*.py' | \
1179 coverage: py-coverage hs-coverage
1181 coverage: py-coverage
1185 py-coverage: $(BUILT_SOURCES) $(python_tests)
1187 COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1188 TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1189 HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1190 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1194 hs-coverage: $(haskell_tests)
1195 cd htools && rm -f *.tix *.mix && ./test
1196 @mkdir_p@ $(COVERAGE_HS_DIR)
1197 hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1198 hpc report htools/test $(HPCEXCL)
1199 ln -sf hpc_index.html $(COVERAGE_HS_DIR)/index.html
1201 # Special "kind-of-QA" target for htools, needs special setup (all
1202 # tools compiled with -fhpc)
1207 rm -f .hpc; ln -s ../.hpc .hpc; \
1208 rm -f *.tix *.mix; \
1210 hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1211 --output=live-test.tix ; \
1212 @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1213 hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1214 --srcdir=.. $(HPCEXCL) ; \
1215 hpc report --srcdir=.. live-test $(HPCEXCL)
1217 commit-check: distcheck lint apidoc
1219 -include ./Makefile.local