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 ACLOCAL_AMFLAGS = -I autotools
13 DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
14 BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
15 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
16 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
17 CHECK_MAN = $(top_srcdir)/autotools/check-man
18 REPLACE_VARS_SED = autotools/replace_vars.sed
20 hypervisordir = $(pkgpythondir)/hypervisor
21 httpdir = $(pkgpythondir)/http
22 masterddir = $(pkgpythondir)/masterd
23 confddir = $(pkgpythondir)/confd
24 rapidir = $(pkgpythondir)/rapi
25 impexpddir = $(pkgpythondir)/impexpd
26 toolsdir = $(pkglibdir)/tools
27 docdir = $(datadir)/doc/$(PACKAGE)
29 # Delete output file if an error occurred while building it
39 doc/examples/gnt-debug \
62 ganeti-[0-9]*.[0-9]*.[0-9]* \
65 MAINTAINERCLEANFILES = \
68 doc/install-quick.rst \
71 maintainer-clean-local:
72 rm -rf $(BUILDTIME_DIRS)
75 $(addsuffix /*.py[co],$(DIRS)) \
76 autotools/replace_vars.sed \
79 daemons/ganeti-cleaner \
81 doc/examples/bash_completion \
82 doc/examples/ganeti.initd \
83 doc/examples/ganeti.cron \
84 doc/examples/gnt-config-backup \
85 doc/examples/hooks/ipsec \
90 $(nodist_pkgpython_PYTHON)
98 nodist_pkgpython_PYTHON = \
102 lib/build/__init__.py
106 lib/asyncnotifier.py \
133 hypervisor_PYTHON = \
134 lib/hypervisor/__init__.py \
135 lib/hypervisor/hv_base.py \
136 lib/hypervisor/hv_chroot.py \
137 lib/hypervisor/hv_fake.py \
138 lib/hypervisor/hv_kvm.py \
139 lib/hypervisor/hv_xen.py
142 lib/rapi/__init__.py \
143 lib/rapi/baserlib.py \
145 lib/rapi/client_utils.py \
146 lib/rapi/connector.py \
150 lib/http/__init__.py \
156 lib/confd/__init__.py \
157 lib/confd/client.py \
158 lib/confd/querylib.py \
162 lib/masterd/__init__.py \
163 lib/masterd/instance.py
166 lib/impexpd/__init__.py
173 doc/design-cluster-merger.rst \
179 doc/install-quick.rst \
182 doc/move-instance.rst \
188 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
189 @test -n "$(SPHINX)" || \
190 { echo 'sphinx-build' not found during configure; exit 1; }
191 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
193 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
194 -D release="$(PACKAGE_VERSION)" \
195 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
196 rm -f doc/html/.buildinfo doc/html/objects.inv
199 doc/html: doc/html/.stamp
203 { echo '.. This file is automatically updated at build time from $<.'; \
204 echo '.. Do not edit.'; \
209 doc/install-quick.rst: INSTALL
211 { echo '.. This file is automatically updated at build time from $<.'; \
212 echo '.. Do not edit.'; \
219 doc/design-2.1-lock-acquire.dot \
220 doc/design-2.1-lock-release.dot
222 docpng = $(patsubst %.dot,%.png,$(docdot))
224 # Things to build but not to install (add it to EXTRA_DIST if it should be
229 doc/examples/bash_completion \
230 doc/examples/ganeti.cron \
231 doc/examples/ganeti.initd \
232 doc/examples/gnt-config-backup \
233 doc/examples/hooks/ipsec \
238 scripts/gnt-cluster \
240 scripts/gnt-instance \
245 dist_sbin_SCRIPTS = \
246 daemons/ganeti-noded \
247 daemons/ganeti-watcher \
248 daemons/ganeti-masterd \
249 daemons/ganeti-confd \
250 daemons/ganeti-rapi \
253 nodist_sbin_SCRIPTS = \
254 daemons/ganeti-cleaner
256 dist_tools_SCRIPTS = \
261 tools/cluster-merge \
263 tools/move-instance \
264 tools/sanitize-config
266 pkglib_python_scripts = \
267 daemons/import-export \
268 tools/check-cert-expired
271 daemons/daemon-util \
272 daemons/ensure-dirs \
273 $(pkglib_python_scripts)
278 autotools/build-bash-completion \
279 autotools/check-python-code \
280 autotools/check-man \
281 autotools/docbook-wrapper \
282 autotools/gen-coverage \
283 autotools/testrunner \
285 daemons/daemon-util.in \
286 daemons/ensure-dirs.in \
287 daemons/ganeti-cleaner.in \
288 $(pkglib_python_scripts) \
295 doc/examples/ganeti.initd.in \
296 doc/examples/ganeti.cron.in \
297 doc/examples/gnt-config-backup.in \
298 doc/examples/dumb-allocator \
299 doc/examples/ganeti.default \
300 doc/examples/ganeti.default-debug \
301 doc/examples/hooks/ethers \
302 doc/examples/hooks/ipsec.in \
303 doc/examples/gnt-debug/README \
304 doc/examples/gnt-debug/delay0.json \
305 doc/examples/gnt-debug/delay50.json \
329 man/ganeti-cleaner.8 \
331 man/ganeti-masterd.8 \
333 man/ganeti-os-interface.7 \
335 man/ganeti-watcher.8 \
344 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
345 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
347 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
348 $(patsubst %.html,%.html.in,$(manhtml))
351 test/data/bdev-both.txt \
352 test/data/bdev-8.3-both.txt \
353 test/data/bdev-disk.txt \
354 test/data/bdev-net.txt \
355 test/data/cert1.pem \
356 test/data/proc_drbd8.txt \
357 test/data/proc_drbd80-emptyline.txt \
358 test/data/proc_drbd83.txt \
359 test/import-export_unittest-helper
362 test/ganeti.asyncnotifier_unittest.py \
363 test/ganeti.backend_unittest.py \
364 test/ganeti.bdev_unittest.py \
365 test/ganeti.cli_unittest.py \
366 test/ganeti.daemon_unittest.py \
367 test/ganeti.cmdlib_unittest.py \
368 test/ganeti.compat_unittest.py \
369 test/ganeti.confd.client_unittest.py \
370 test/ganeti.config_unittest.py \
371 test/ganeti.constants_unittest.py \
372 test/ganeti.errors_unittest.py \
373 test/ganeti.hooks_unittest.py \
374 test/ganeti.http_unittest.py \
375 test/ganeti.impexpd_unittest.py \
376 test/ganeti.locking_unittest.py \
377 test/ganeti.luxi_unittest.py \
378 test/ganeti.masterd.instance_unittest.py \
379 test/ganeti.mcpu_unittest.py \
380 test/ganeti.objects_unittest.py \
381 test/ganeti.opcodes_unittest.py \
382 test/ganeti.rapi.client_unittest.py \
383 test/ganeti.rapi.resources_unittest.py \
384 test/ganeti.rapi.rlib2_unittest.py \
385 test/ganeti.serializer_unittest.py \
386 test/ganeti.ssh_unittest.py \
387 test/ganeti.uidpool_unittest.py \
388 test/ganeti.utils_unittest.py \
389 test/ganeti.utils_mlockall_unittest.py \
390 test/ganeti.workerpool_unittest.py \
391 test/cfgupgrade_unittest.py \
392 test/docs_unittest.py \
393 test/tempfile_fork_unittest.py
396 test/check-cert-expired_unittest.bash \
397 test/daemon-util_unittest.bash \
398 test/ganeti-cleaner_unittest.bash \
399 test/import-export_unittest.bash \
404 TESTS = $(dist_TESTS) $(nodist_TESTS)
406 # Environment for all tests
407 PLAIN_TESTS_ENVIRONMENT = \
408 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
410 # Environment for tests run by automake
411 TESTS_ENVIRONMENT = \
412 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
415 $(dist_sbin_SCRIPTS) \
416 $(dist_tools_SCRIPTS) \
417 $(pkglib_python_scripts) \
419 $(pkgpython_PYTHON) \
420 $(hypervisor_PYTHON) \
430 test/check-cert-expired_unittest.bash \
431 test/daemon-util_unittest.bash \
432 test/ganeti-cleaner_unittest.bash \
433 test/import-export_unittest.bash \
436 check_python_code = \
437 $(BUILD_BASH_COMPLETION) \
442 $(dist_sbin_SCRIPTS) \
443 $(dist_tools_SCRIPTS) \
444 $(pkglib_python_scripts) \
445 $(BUILD_BASH_COMPLETION)
447 test/daemon-util_unittest.bash: daemons/daemon-util
449 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
451 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
452 sed -f $(REPLACE_VARS_SED) < $< > $@
455 daemons/%: daemons/%.in \
457 sed -f $(REPLACE_VARS_SED) < $< > $@
460 doc/examples/%: doc/examples/%.in \
462 sed -f $(REPLACE_VARS_SED) < $< > $@
464 doc/examples/hooks/%: doc/examples/hooks/%.in \
466 sed -f $(REPLACE_VARS_SED) < $< > $@
468 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
469 lib/cli.py $(gnt_scripts) tools/burnin
470 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
473 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
474 $(DOT) -Tpng -o $@ $<
476 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
477 @test -n "$(DOCBOOK2MAN)" || \
478 { echo 'docbook2man' not found during configure; exit 1; }
479 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
482 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
483 @test -n "$(DOCBOOK2HTML)" || \
484 { echo 'docbook2html' not found during configure; exit 1; }
485 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
487 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
488 sed -f $(REPLACE_VARS_SED) < $< > $@
490 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
491 sed -f $(REPLACE_VARS_SED) < $< > $@
493 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
494 sed -f $(REPLACE_VARS_SED) < $< > $@
496 lib/_autoconf.py: Makefile stamp-directories
498 { echo '# This file is automatically generated, do not edit!'; \
501 echo '"""Build-time configuration for Ganeti.'; \
503 echo 'This file is autogenerated by the build process.'; \
504 echo 'For any changes you need to re-run ./configure (and'; \
505 echo 'not edit by hand).'; \
509 echo '# pylint: disable-msg=C0301,C0324'; \
510 echo '# because this is autogenerated, we do not want'; \
511 echo '# style warnings' ; \
513 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
514 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
515 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
516 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
517 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
518 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
519 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
520 echo "SYSCONFDIR = '$(sysconfdir)'"; \
521 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
522 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
523 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
524 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
525 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
526 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
527 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
528 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
529 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
530 echo "KVM_PATH = '$(KVM_PATH)'"; \
531 echo "SOCAT_PATH = '$(SOCAT)'"; \
532 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
533 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
534 echo "TOOLSDIR = '$(toolsdir)'"; \
535 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
536 echo "PKGLIBDIR = '$(pkglibdir)'"; \
537 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
538 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
539 echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
540 echo "MASTERD_USER = '$(MASTERD_USER)'"; \
541 echo "RAPI_USER = '$(RAPI_USER)'"; \
544 $(REPLACE_VARS_SED): Makefile
546 { echo 's#@PREFIX@#$(prefix)#g'; \
547 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
548 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
549 echo 's#@BINDIR@#$(bindir)#g'; \
550 echo 's#@SBINDIR@#$(sbindir)#g'; \
551 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
552 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
553 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
554 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
555 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
556 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
557 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
558 echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
559 echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
560 echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
561 echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
562 echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
563 echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
564 echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
565 echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
566 echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
569 # We need to create symlinks because "make distcheck" will not install Python
570 # files when building.
571 stamp-srclinks: Makefile stamp-directories
573 for i in $(srclink_files); do \
574 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
575 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
582 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
585 check-dirs: $(BUILT_SOURCES)
587 find . -type d \( \( -name . \) -o \( \
589 -name autom4te.cache \
590 \) -prune -o -print \) | { \
594 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
595 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
598 for dir in $(DIRS); do \
599 if ! test -d "$$dir"; then \
600 echo "Directory $$dir listed in DIRS does not exist" >&2; \
604 if test -n "$$error"; then exit 1; else exit 0; fi; \
607 check-local: check-dirs
608 $(CHECK_PYTHON_CODE) $(check_python_code)
611 lint: ganeti $(BUILT_SOURCES)
612 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
613 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
615 # a dist hook rule for catching revision control directories
617 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
618 echo "Found revision control files in final archive." 1>&2; \
621 if find $(top_distdir) -name '*.py[co]' | grep .; then \
622 echo "Found Python byte code in final archive." 1>&2; \
625 if find $(top_distdir) -name '*~' | grep .; then \
626 echo "Found backup files in final archive." 1>&2; \
631 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
632 "$(DESTDIR)${localstatedir}/log/ganeti" \
633 "$(DESTDIR)${localstatedir}/run/ganeti"
635 stamp-directories: Makefile
640 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
641 test -e doc/api || mkdir doc/api
642 $(RUN_IN_TEMPDIR) epydoc -v \
643 --conf $(CURDIR)/epydoc.conf \
644 --output $(CURDIR)/doc/api
647 TAGS: $(BUILT_SOURCES)
649 find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
650 -path 'daemons/ganeti-*' -o -path 'tools/*' | \
654 coverage: $(BUILT_SOURCES) $(python_tests)
656 mkdir -p doc/coverage; \
657 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
658 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
659 HTML_COVERAGE=$(CURDIR)/doc/coverage \
660 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
663 commit-check: distcheck lint apidoc
665 -include ./Makefile.local