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
25 # Note: the variable must be named after the directory + 'dir' suffix
26 clientdir = $(pkgpythondir)/client
27 hypervisordir = $(pkgpythondir)/hypervisor
28 httpdir = $(pkgpythondir)/http
29 masterddir = $(pkgpythondir)/masterd
30 confddir = $(pkgpythondir)/confd
31 rapidir = $(pkgpythondir)/rapi
32 serverdir = $(pkgpythondir)/server
33 watcherdir = $(pkgpythondir)/watcher
34 impexpddir = $(pkgpythondir)/impexpd
35 utilsdir = $(pkgpythondir)/utils
36 toolsdir = $(pkglibdir)/tools
37 iallocatorsdir = $(pkglibdir)/iallocators
38 docdir = $(datadir)/doc/$(PACKAGE)
40 # Delete output file if an error occurred while building it
50 doc/examples/gnt-debug \
53 htools/Ganeti/HTools \
72 BUILDTIME_DIR_AUTOCREATE = \
78 $(BUILDTIME_DIR_AUTOCREATE) \
83 ganeti-[0-9]*.[0-9]*.[0-9]* \
86 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
88 MAINTAINERCLEANFILES = \
91 doc/install-quick.rst \
96 maintainer-clean-local:
97 rm -rf $(BUILDTIME_DIRS)
100 $(addsuffix /*.py[co],$(DIRS)) \
102 $(PYTHON_BOOTSTRAP) \
104 autotools/replace_vars.sed \
105 daemons/daemon-util \
106 daemons/ensure-dirs \
107 daemons/ganeti-cleaner \
109 doc/examples/bash_completion \
110 doc/examples/ganeti.initd \
111 doc/examples/ganeti-kvm-poweroff.initd \
112 doc/examples/ganeti.cron \
113 doc/examples/gnt-config-backup \
114 doc/examples/hooks/ipsec \
119 $(nodist_pkgpython_PYTHON) \
120 $(HALLPROGS) $(HSRCS2) \
121 $(patsubst %.hs,%.hi,$(HSRCS) $(HSRCPROGS) $(HSRCS2)) \
122 $(patsubst %.hs,%.o,$(HSRCS) $(HSRCPROGS) $(HSRCS2))
124 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
125 # it'll cause the target to rebuild every time.
133 nodist_pkgpython_PYTHON = \
137 lib/build/__init__.py \
138 lib/build/sphinx_ext.py
142 lib/asyncnotifier.py \
174 lib/client/__init__.py \
175 lib/client/gnt_backup.py \
176 lib/client/gnt_cluster.py \
177 lib/client/gnt_debug.py \
178 lib/client/gnt_group.py \
179 lib/client/gnt_instance.py \
180 lib/client/gnt_job.py \
181 lib/client/gnt_node.py \
184 hypervisor_PYTHON = \
185 lib/hypervisor/__init__.py \
186 lib/hypervisor/hv_base.py \
187 lib/hypervisor/hv_chroot.py \
188 lib/hypervisor/hv_fake.py \
189 lib/hypervisor/hv_kvm.py \
190 lib/hypervisor/hv_lxc.py \
191 lib/hypervisor/hv_xen.py
194 lib/rapi/__init__.py \
195 lib/rapi/baserlib.py \
197 lib/rapi/client_utils.py \
198 lib/rapi/connector.py \
202 lib/http/__init__.py \
208 lib/confd/__init__.py \
209 lib/confd/client.py \
210 lib/confd/querylib.py \
214 lib/masterd/__init__.py \
215 lib/masterd/instance.py
218 lib/impexpd/__init__.py
221 lib/watcher/__init__.py
224 lib/server/__init__.py \
225 lib/server/confd.py \
226 lib/server/masterd.py \
227 lib/server/noded.py \
231 lib/utils/__init__.py \
233 lib/utils/filelock.py \
238 lib/utils/nodesetup.py \
239 lib/utils/process.py \
242 lib/utils/wrapper.py \
251 doc/design-htools-2.3.rst \
253 doc/design-draft.rst \
255 doc/design-query2.rst \
256 doc/cluster-merge.rst \
257 doc/design-shared-storage.rst \
263 doc/install-quick.rst \
266 doc/move-instance.rst \
279 HALLPROGS = $(HPROGS) htools/test
280 HSRCPROGS = $(patsubst %,%.hs,$(HALLPROGS))
281 # we don't add -Werror by default
282 HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs
286 htools/Ganeti/HTools/CLI.hs \
287 htools/Ganeti/HTools/Cluster.hs \
288 htools/Ganeti/HTools/Container.hs \
289 htools/Ganeti/HTools/ExtLoader.hs \
290 htools/Ganeti/HTools/Group.hs \
291 htools/Ganeti/HTools/IAlloc.hs \
292 htools/Ganeti/HTools/Instance.hs \
293 htools/Ganeti/HTools/Loader.hs \
294 htools/Ganeti/HTools/Luxi.hs \
295 htools/Ganeti/HTools/Node.hs \
296 htools/Ganeti/HTools/PeerMap.hs \
297 htools/Ganeti/HTools/QC.hs \
298 htools/Ganeti/HTools/Rapi.hs \
299 htools/Ganeti/HTools/Simu.hs \
300 htools/Ganeti/HTools/Text.hs \
301 htools/Ganeti/HTools/Types.hs \
302 htools/Ganeti/HTools/Utils.hs \
303 htools/Ganeti/Jobs.hs \
304 htools/Ganeti/Luxi.hs \
305 htools/Ganeti/OpCodes.hs
307 HSRCS2 = htools/Ganeti/HTools/Version.hs
308 HSRCS2IN = $(patsubst %,%.in,$(HSRCS2))
311 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
313 # Note: we use here an order-only prerequisite, as the contents of
314 # _autoconf.py are not actually influencing the html build output: it
315 # has to exist in order for the sphinx module to be loaded
316 # successfully, but we certainly don't want the docs to be rebuilt if
318 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
319 $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
321 @test -n "$(SPHINX)" || \
322 { echo 'sphinx-build' not found during configure; exit 1; }
324 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
326 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
327 -D release="$(PACKAGE_VERSION)" \
328 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
329 rm -f doc/html/.buildinfo doc/html/objects.inv
332 doc/html: doc/html/index.html
334 doc/install-quick.rst: INSTALL
336 doc/upgrade.rst: UPGRADE
338 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
340 { echo '.. This file is automatically updated at build time from $<.'; \
341 echo '.. Do not edit.'; \
348 doc/design-2.1-lock-acquire.dot \
349 doc/design-2.1-lock-release.dot
351 docpng = $(patsubst %.dot,%.png,$(docdot))
353 # Things to build but not to install (add it to EXTRA_DIST if it should be
358 doc/examples/bash_completion \
359 doc/examples/ganeti.cron \
360 doc/examples/ganeti.initd \
361 doc/examples/ganeti-kvm-poweroff.initd \
362 doc/examples/gnt-config-backup \
363 doc/examples/hooks/ipsec \
368 scripts/gnt-cluster \
371 scripts/gnt-instance \
377 daemons/ganeti-confd \
378 daemons/ganeti-masterd \
379 daemons/ganeti-noded \
380 daemons/ganeti-watcher \
381 daemons/ganeti-rapi \
383 scripts/gnt-cluster \
386 scripts/gnt-instance \
406 iallocators_SCRIPTS =
408 bin_SCRIPTS += $(filter-out htools/hail,$(HPROGS))
409 iallocators_SCRIPTS += $(filter htools/hail,$(HPROGS))
412 $(HALLPROGS): %: %.hs $(HSRCS) $(HSRCS2)
413 cd htools && $(GHC) --make $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
414 $(patsubst htools/%,%,$@)
416 dist_sbin_SCRIPTS = \
417 tools/ganeti-listrunner
419 nodist_sbin_SCRIPTS = \
420 $(PYTHON_BOOTSTRAP) \
421 daemons/ganeti-cleaner
423 dist_tools_SCRIPTS = \
428 tools/cluster-merge \
430 tools/move-instance \
432 tools/sanitize-config
434 pkglib_python_scripts = \
435 daemons/import-export \
436 tools/check-cert-expired
439 daemons/daemon-util \
440 daemons/ensure-dirs \
442 $(pkglib_python_scripts)
449 autotools/build-bash-completion \
450 autotools/check-python-code \
451 autotools/check-man \
452 autotools/check-news \
453 autotools/check-tar \
454 autotools/check-version \
456 autotools/gen-coverage \
457 autotools/testrunner \
459 daemons/daemon-util.in \
460 daemons/ensure-dirs.in \
461 daemons/ganeti-cleaner.in \
462 $(pkglib_python_scripts) \
470 doc/examples/ganeti.initd.in \
471 doc/examples/ganeti-kvm-poweroff.initd.in \
472 doc/examples/ganeti.cron.in \
473 doc/examples/gnt-config-backup.in \
474 doc/examples/ganeti.default \
475 doc/examples/ganeti.default-debug \
476 doc/examples/hooks/ethers \
477 doc/examples/hooks/ipsec.in \
478 doc/examples/gnt-debug/README \
479 doc/examples/gnt-debug/delay0.json \
480 doc/examples/gnt-debug/delay50.json \
490 $(HSRCS) $(HSRCS2IN) \
495 man/ganeti-cleaner.8 \
497 man/ganeti-listrunner.8 \
498 man/ganeti-masterd.8 \
500 man/ganeti-os-interface.7 \
502 man/ganeti-watcher.8 \
516 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
517 manhtml = $(patsubst %.rst,%.html,$(manrst))
518 mangen = $(patsubst %.rst,%.gen,$(manrst))
520 $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
521 $(patsubst %.html,%.html.in,$(manhtml)) \
522 man/footer.man man/footer.html $(mangen)
525 test/data/bdev-drbd-8.0.txt \
526 test/data/bdev-drbd-8.3.txt \
527 test/data/bdev-drbd-disk.txt \
528 test/data/bdev-drbd-net-ip4.txt \
529 test/data/bdev-drbd-net-ip6.txt \
530 test/data/cert1.pem \
531 test/data/proc_drbd8.txt \
532 test/data/proc_drbd80-emptyline.txt \
533 test/data/proc_drbd83.txt \
534 test/data/sys_drbd_usermode_helper.txt \
535 test/import-export_unittest-helper
538 test/ganeti.asyncnotifier_unittest.py \
539 test/ganeti.backend_unittest.py \
540 test/ganeti.bdev_unittest.py \
541 test/ganeti.cli_unittest.py \
542 test/ganeti.client.gnt_cluster_unittest.py \
543 test/ganeti.client.gnt_instance_unittest.py \
544 test/ganeti.daemon_unittest.py \
545 test/ganeti.cmdlib_unittest.py \
546 test/ganeti.compat_unittest.py \
547 test/ganeti.confd.client_unittest.py \
548 test/ganeti.config_unittest.py \
549 test/ganeti.constants_unittest.py \
550 test/ganeti.errors_unittest.py \
551 test/ganeti.hooks_unittest.py \
552 test/ganeti.ht_unittest.py \
553 test/ganeti.http_unittest.py \
554 test/ganeti.hypervisor_unittest.py \
555 test/ganeti.hypervisor.hv_chroot_unittest.py \
556 test/ganeti.hypervisor.hv_fake_unittest.py \
557 test/ganeti.hypervisor.hv_kvm_unittest.py \
558 test/ganeti.hypervisor.hv_lxc_unittest.py \
559 test/ganeti.hypervisor.hv_xen_unittest.py \
560 test/ganeti.impexpd_unittest.py \
561 test/ganeti.jqueue_unittest.py \
562 test/ganeti.locking_unittest.py \
563 test/ganeti.luxi_unittest.py \
564 test/ganeti.masterd.instance_unittest.py \
565 test/ganeti.mcpu_unittest.py \
566 test/ganeti.netutils_unittest.py \
567 test/ganeti.objects_unittest.py \
568 test/ganeti.opcodes_unittest.py \
569 test/ganeti.qlang_unittest.py \
570 test/ganeti.query_unittest.py \
571 test/ganeti.rapi.baserlib_unittest.py \
572 test/ganeti.rapi.client_unittest.py \
573 test/ganeti.rapi.resources_unittest.py \
574 test/ganeti.rapi.rlib2_unittest.py \
575 test/ganeti.rpc_unittest.py \
576 test/ganeti.runtime_unittest.py \
577 test/ganeti.serializer_unittest.py \
578 test/ganeti.ssh_unittest.py \
579 test/ganeti.uidpool_unittest.py \
580 test/ganeti.utils.algo_unittest.py \
581 test/ganeti.utils.filelock_unittest.py \
582 test/ganeti.utils.hash_unittest.py \
583 test/ganeti.utils.io_unittest.py \
584 test/ganeti.utils.log_unittest.py \
585 test/ganeti.utils.mlock_unittest.py \
586 test/ganeti.utils.nodesetup_unittest.py \
587 test/ganeti.utils.process_unittest.py \
588 test/ganeti.utils.retry_unittest.py \
589 test/ganeti.utils.text_unittest.py \
590 test/ganeti.utils.wrapper_unittest.py \
591 test/ganeti.utils.x509_unittest.py \
592 test/ganeti.utils_unittest.py \
593 test/ganeti.workerpool_unittest.py \
594 test/cfgupgrade_unittest.py \
595 test/docs_unittest.py \
596 test/tempfile_fork_unittest.py
599 test/check-cert-expired_unittest.bash \
600 test/daemon-util_unittest.bash \
601 test/ganeti-cleaner_unittest.bash \
602 test/import-export_unittest.bash \
607 TESTS = $(dist_TESTS) $(nodist_TESTS)
609 # Environment for all tests
610 PLAIN_TESTS_ENVIRONMENT = \
611 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
613 # Environment for tests run by automake
614 TESTS_ENVIRONMENT = \
615 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
618 $(dist_sbin_SCRIPTS) \
619 $(dist_tools_SCRIPTS) \
620 $(pkglib_python_scripts) \
622 $(pkgpython_PYTHON) \
624 $(hypervisor_PYTHON) \
638 test/check-cert-expired_unittest.bash \
639 test/daemon-util_unittest.bash \
640 test/ganeti-cleaner_unittest.bash \
641 test/import-export_unittest.bash \
643 $(HSRCS) $(HSRCPROGS)
645 check_python_code = \
646 $(BUILD_BASH_COMPLETION) \
652 ganeti/http/server.py \
653 $(dist_sbin_SCRIPTS) \
654 $(dist_tools_SCRIPTS) \
655 $(pkglib_python_scripts) \
656 $(BUILD_BASH_COMPLETION) \
660 test/daemon-util_unittest.bash: daemons/daemon-util
662 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
664 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
665 sed -f $(REPLACE_VARS_SED) < $< > $@
668 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
669 sed -f $(REPLACE_VARS_SED) < $< > $@
672 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
673 sed -f $(REPLACE_VARS_SED) < $< > $@
676 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
677 sed -f $(REPLACE_VARS_SED) < $< > $@
679 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
680 sed -f $(REPLACE_VARS_SED) < $< > $@
682 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
683 lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
684 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
687 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
688 $(DOT) -Tpng -o $@ $<
690 man/footer.man: man/footer.rst
691 @test -n "$(PANDOC)" || \
692 { echo 'pandoc' not found during configure; exit 1; }
693 $(PANDOC) -f rst -t man -o $@ $<
695 man/footer.html: man/footer.rst
696 @test -n "$(PANDOC)" || \
697 { echo 'pandoc' not found during configure; exit 1; }
698 $(PANDOC) -f rst -t html -o $@ $<
700 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
701 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
703 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
704 @test -n "$(PANDOC)" || \
705 { echo 'pandoc' not found during configure; exit 1; }
707 $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
708 sed -e 's/\\@/@/g' > $@
709 if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
711 man/%.html.in: man/%.gen man/footer.html
712 @test -n "$(PANDOC)" || \
713 { echo 'pandoc' not found during configure; exit 1; }
715 $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
716 sed -e 's/\\@/@/g' > $@
718 man/%.1: man/%.1.in $(REPLACE_VARS_SED)
719 sed -f $(REPLACE_VARS_SED) < $< > $@
721 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
722 sed -f $(REPLACE_VARS_SED) < $< > $@
724 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
725 sed -f $(REPLACE_VARS_SED) < $< > $@
727 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
728 sed -f $(REPLACE_VARS_SED) < $< > $@
730 epydoc.conf: epydoc.conf.in Makefile
731 sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
734 if test -d .git; then \
736 elif test ! -f $@ ; then \
737 echo "Cannot auto-generate $@ file"; exit 1; \
740 .PHONY: regen-vcs-version
744 if test -d .git; then \
746 $(MAKE) vcs-version; \
749 htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
751 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
752 sed -e "s/%ver%/$$VCSVER/" < $< > $@
754 lib/_autoconf.py: Makefile vcs-version | lib/.dir
756 VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
757 { echo '# This file is automatically generated, do not edit!'; \
760 echo '"""Build-time configuration for Ganeti.'; \
762 echo 'This file is autogenerated by the build process.'; \
763 echo 'For any changes you need to re-run ./configure (and'; \
764 echo 'not edit by hand).'; \
768 echo '# pylint: disable-msg=C0301,C0324'; \
769 echo '# because this is autogenerated, we do not want'; \
770 echo '# style warnings' ; \
772 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
773 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
774 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
775 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
776 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
777 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
778 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
779 echo "SYSCONFDIR = '$(sysconfdir)'"; \
780 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
781 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
782 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
783 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
784 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
785 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
786 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
787 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
788 echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
789 echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
790 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
791 echo "KVM_PATH = '$(KVM_PATH)'"; \
792 echo "SOCAT_PATH = '$(SOCAT)'"; \
793 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
794 echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
795 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
796 echo "TOOLSDIR = '$(toolsdir)'"; \
797 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
798 echo "PKGLIBDIR = '$(pkglibdir)'"; \
799 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
800 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
801 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
802 echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
803 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
804 echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
805 echo "RAPI_USER = '$(RAPI_USER)'"; \
806 echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
807 echo "CONFD_USER = '$(CONFD_USER)'"; \
808 echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
809 echo "NODED_USER = '$(NODED_USER)'"; \
810 echo "VCS_VERSION = '$$VCSVER'"; \
811 echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
814 $(REPLACE_VARS_SED): Makefile
816 { echo 's#@PREFIX@#$(prefix)#g'; \
817 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
818 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
819 echo 's#@BINDIR@#$(bindir)#g'; \
820 echo 's#@SBINDIR@#$(sbindir)#g'; \
821 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
822 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
823 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
824 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
825 echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
826 echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
827 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
828 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
829 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
830 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
831 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
832 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
833 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
834 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
835 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
836 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
837 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
838 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
841 # Using deferred evaluation
842 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
843 daemons/ganeti-watcher: MODULE = ganeti.watcher
844 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
846 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
847 test -n "$(MODULE)" || { echo Missing module; exit 1; }
849 { echo '#!/usr/bin/python'; \
850 echo '# This file is automatically generated, do not edit!'; \
851 echo "# Edit $(MODULE) instead."; \
853 echo '"""Bootstrap script for L{$(MODULE)}"""'; \
855 echo '# pylint: disable-msg=C0103'; \
856 echo '# C0103: Invalid name'; \
859 echo 'import $(MODULE) as main'; \
861 echo '# Temporarily alias commands until bash completion'; \
862 echo '# generator is changed'; \
863 echo 'if hasattr(main, "commands"):'; \
864 echo ' commands = main.commands # pylint: disable-msg=E1101'; \
866 echo 'if __name__ == "__main__":'; \
867 echo ' sys.exit(main.Main())'; \
871 # We need to create symlinks because "make distcheck" will not install Python
872 # files when building.
873 stamp-srclinks: Makefile | $(all_dirfiles)
875 for i in $(srclink_files); do \
876 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
877 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
884 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
887 check-dirs: $(BUILT_SOURCES)
889 find . -type d \( \( -name . \) -o \( \
891 -name autom4te.cache \
892 \) -prune -o -print \) | { \
896 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
897 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
900 for dir in $(DIRS); do \
901 if ! test -d "$$dir"; then \
902 echo "Directory $$dir listed in DIRS does not exist" >&2; \
906 if test -n "$$error"; then exit 1; else exit 0; fi; \
909 check-local: check-dirs
910 $(CHECK_PYTHON_CODE) $(check_python_code)
911 $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
912 $(CHECK_NEWS) < $(top_srcdir)/NEWS
915 lint: $(BUILT_SOURCES)
916 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
917 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
918 cd $(top_srcdir)/qa && \
919 PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
920 --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
922 # a dist hook rule for updating the vcs-version file; this is
923 # hardcoded due to where it needs to build the file...
925 $(MAKE) regen-vcs-version && \
926 rm -f $(top_distdir)/vcs-version && \
927 cp -p $(srcdir)/vcs-version $(top_distdir)
929 # a distcheck hook rule for catching revision control directories
931 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
932 echo "Found revision control files in final archive." 1>&2; \
935 if find $(top_distdir) -name '*.py[co]' | grep .; then \
936 echo "Found Python byte code in final archive." 1>&2; \
939 if find $(top_distdir) -name '*~' | grep .; then \
940 echo "Found backup files in final archive." 1>&2; \
943 # Empty files or directories should not be distributed. They can cause
944 # unnecessary warnings for packagers. Directories used by automake during
945 # distcheck must be excluded.
946 if find $(top_distdir) -empty -and -not \( \
947 -path $(top_distdir)/_build -or \
948 -path $(top_distdir)/_inst \) | grep .; then \
949 echo "Found empty files or directories in final archive." 1>&2; \
952 if test -n "$(BUILD_RELEASE)" && \
953 grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
954 echo "Found unreleased version in NEWS." >&2; \
958 # When building a release, stricter checks should be used
959 distcheck-release dist-release: export BUILD_RELEASE = 1
960 distcheck-release: distcheck
964 for i in $(DIST_ARCHIVES); do \
965 echo -n "Checking $$i ... "; \
966 autotools/check-tar < $$i; \
971 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
972 "$(DESTDIR)${localstatedir}/log/ganeti" \
973 "$(DESTDIR)${localstatedir}/run/ganeti"
975 # To avoid conflicts between directory names and other targets, a file inside
976 # the directory is used to ensure its existence.
978 @mkdir_p@ $* && touch $@
981 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
982 $(RUN_IN_TEMPDIR) epydoc -v \
983 --conf $(CURDIR)/epydoc.conf \
984 --output $(CURDIR)/doc/api
987 TAGS: $(BUILT_SOURCES)
989 find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
990 -path './daemons/ganeti-*' -o -path './tools/*' -o \
991 -path './qa/*.py' | \
995 coverage: $(BUILT_SOURCES) $(python_tests)
997 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
998 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
999 HTML_COVERAGE=$(CURDIR)/doc/coverage \
1000 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1003 commit-check: distcheck lint apidoc
1005 -include ./Makefile.local