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 toolsdir = $(pkglibdir)/tools
26 docdir = $(datadir)/doc/$(PACKAGE)
28 # Delete output file if an error occurred while building it
52 MAINTAINERCLEANFILES = \
55 doc/install-quick.rst \
58 maintainer-clean-local:
59 rm -rf doc/api doc/html doc/coverage
62 $(addsuffix /*.py[co],$(DIRS)) \
63 autotools/replace_vars.sed \
65 daemons/ganeti-cleaner \
67 doc/examples/bash_completion \
68 doc/examples/ganeti.initd \
69 doc/examples/ganeti.cron \
70 doc/examples/gnt-config-backup \
71 doc/examples/hooks/ipsec \
76 $(nodist_pkgpython_PYTHON)
84 nodist_pkgpython_PYTHON = \
92 lib/asyncnotifier.py \
118 hypervisor_PYTHON = \
119 lib/hypervisor/__init__.py \
120 lib/hypervisor/hv_base.py \
121 lib/hypervisor/hv_chroot.py \
122 lib/hypervisor/hv_fake.py \
123 lib/hypervisor/hv_kvm.py \
124 lib/hypervisor/hv_xen.py
127 lib/rapi/__init__.py \
128 lib/rapi/baserlib.py \
130 lib/rapi/connector.py \
134 lib/http/__init__.py \
140 lib/confd/__init__.py \
141 lib/confd/client.py \
142 lib/confd/querylib.py \
146 lib/masterd/__init__.py
153 doc/design-cluster-merger.rst \
159 doc/install-quick.rst \
167 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
168 @test -n "$(SPHINX)" || \
169 { echo 'sphinx-build' not found during configure; exit 1; }
170 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
172 -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
173 -D release="$(PACKAGE_VERSION)" \
174 $(abs_top_srcdir)/doc $(CURDIR)/doc/html
175 rm -f doc/html/.buildinfo doc/html/objects.inv
178 doc/html: doc/html/.stamp
182 { echo '.. This file is automatically updated at build time from $<.'; \
183 echo '.. Do not edit.'; \
188 doc/install-quick.rst: INSTALL
190 { echo '.. This file is automatically updated at build time from $<.'; \
191 echo '.. Do not edit.'; \
198 doc/design-2.1-lock-acquire.dot \
199 doc/design-2.1-lock-release.dot
201 docpng = $(patsubst %.dot,%.png,$(docdot))
203 # Things to build but not to install (add it to EXTRA_DIST if it should be
208 doc/examples/bash_completion \
209 doc/examples/ganeti.cron \
210 doc/examples/ganeti.initd \
211 doc/examples/gnt-config-backup \
212 doc/examples/hooks/ipsec \
217 scripts/gnt-cluster \
219 scripts/gnt-instance \
224 dist_sbin_SCRIPTS = \
225 daemons/ganeti-noded \
226 daemons/ganeti-watcher \
227 daemons/ganeti-masterd \
228 daemons/ganeti-confd \
229 daemons/ganeti-rapi \
232 nodist_sbin_SCRIPTS = \
233 daemons/ganeti-cleaner
235 dist_tools_SCRIPTS = \
240 tools/cluster-merge \
242 tools/sanitize-config
244 pkglib_python_scripts = \
245 daemons/import-export
248 daemons/daemon-util \
249 $(pkglib_python_scripts)
254 autotools/build-bash-completion \
255 autotools/check-python-code \
256 autotools/check-man \
257 autotools/docbook-wrapper \
258 autotools/gen-coverage \
259 autotools/testrunner \
261 daemons/daemon-util.in \
262 daemons/ganeti-cleaner.in \
263 $(pkglib_python_scripts) \
270 doc/examples/ganeti.initd.in \
271 doc/examples/ganeti.cron.in \
272 doc/examples/gnt-config-backup.in \
273 doc/examples/dumb-allocator \
274 doc/examples/ganeti.default \
275 doc/examples/ganeti.default-debug \
276 doc/examples/hooks/ethers \
277 doc/examples/hooks/ipsec.in \
301 man/ganeti-cleaner.8 \
303 man/ganeti-masterd.8 \
305 man/ganeti-os-interface.7 \
307 man/ganeti-watcher.8 \
316 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
317 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
319 $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
320 $(patsubst %.html,%.html.in,$(manhtml))
323 test/data/bdev-both.txt \
324 test/data/bdev-8.3-both.txt \
325 test/data/bdev-disk.txt \
326 test/data/bdev-net.txt \
327 test/data/cert1.pem \
328 test/data/proc_drbd8.txt \
329 test/data/proc_drbd80-emptyline.txt \
330 test/data/proc_drbd83.txt \
331 test/import-export_unittest-helper
334 test/ganeti.backend_unittest.py \
335 test/ganeti.bdev_unittest.py \
336 test/ganeti.cli_unittest.py \
337 test/ganeti.cmdlib_unittest.py \
338 test/ganeti.confd.client_unittest.py \
339 test/ganeti.config_unittest.py \
340 test/ganeti.constants_unittest.py \
341 test/ganeti.errors_unittest.py \
342 test/ganeti.hooks_unittest.py \
343 test/ganeti.http_unittest.py \
344 test/ganeti.locking_unittest.py \
345 test/ganeti.luxi_unittest.py \
346 test/ganeti.mcpu_unittest.py \
347 test/ganeti.objects_unittest.py \
348 test/ganeti.opcodes_unittest.py \
349 test/ganeti.rapi.client_unittest.py \
350 test/ganeti.rapi.resources_unittest.py \
351 test/ganeti.serializer_unittest.py \
352 test/ganeti.ssh_unittest.py \
353 test/ganeti.uidpool_unittest.py \
354 test/ganeti.utils_unittest.py \
355 test/ganeti.workerpool_unittest.py \
356 test/docs_unittest.py \
357 test/tempfile_fork_unittest.py
360 test/daemon-util_unittest.bash \
361 test/import-export_unittest.bash \
366 TESTS = $(dist_TESTS) $(nodist_TESTS)
368 # Environment for all tests
369 PLAIN_TESTS_ENVIRONMENT = \
370 PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
372 # Environment for tests run by automake
373 TESTS_ENVIRONMENT = \
374 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
377 $(dist_sbin_SCRIPTS) \
378 $(dist_tools_SCRIPTS) \
379 $(pkglib_python_scripts) \
381 $(pkgpython_PYTHON) \
382 $(hypervisor_PYTHON) \
391 test/daemon-util_unittest.bash \
392 test/import-export_unittest.bash \
395 check_python_code = \
396 $(BUILD_BASH_COMPLETION) \
401 $(dist_sbin_SCRIPTS) \
402 $(dist_tools_SCRIPTS) \
403 $(pkglib_python_scripts) \
404 $(BUILD_BASH_COMPLETION)
406 test/daemon-util_unittest.bash: daemons/daemon-util
408 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
409 sed -f $(REPLACE_VARS_SED) < $< > $@
412 daemons/%: daemons/%.in \
414 sed -f $(REPLACE_VARS_SED) < $< > $@
417 doc/examples/%: doc/examples/%.in \
419 sed -f $(REPLACE_VARS_SED) < $< > $@
421 doc/examples/hooks/%: doc/examples/hooks/%.in \
423 sed -f $(REPLACE_VARS_SED) < $< > $@
425 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
426 lib/cli.py $(gnt_scripts) tools/burnin
427 PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
430 @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
431 $(DOT) -Tpng -o $@ $<
433 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
434 @test -n "$(DOCBOOK2MAN)" || \
435 { echo 'docbook2man' not found during configure; exit 1; }
436 $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
439 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
440 @test -n "$(DOCBOOK2HTML)" || \
441 { echo 'docbook2html' not found during configure; exit 1; }
442 $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
444 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
445 sed -f $(REPLACE_VARS_SED) < $< > $@
447 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
448 sed -f $(REPLACE_VARS_SED) < $< > $@
450 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
451 sed -f $(REPLACE_VARS_SED) < $< > $@
453 lib/_autoconf.py: Makefile stamp-directories
455 { echo '# This file is automatically generated, do not edit!'; \
458 echo '"""Build-time configuration for Ganeti.'; \
460 echo 'This file is autogenerated by the build process.'; \
461 echo 'For any changes you need to re-run ./configure (and'; \
462 echo 'not edit by hand).'; \
466 echo '# pylint: disable-msg=C0301,C0324'; \
467 echo '# because this is autogenerated, we do not want'; \
468 echo '# style warnings' ; \
470 echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
471 echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
472 echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
473 echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
474 echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
475 echo "VERSION_FULL = '$(VERSION_FULL)'"; \
476 echo "LOCALSTATEDIR = '$(localstatedir)'"; \
477 echo "SYSCONFDIR = '$(sysconfdir)'"; \
478 echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
479 echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
480 echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
481 echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
482 echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
483 echo "XEN_INITRD = '$(XEN_INITRD)'"; \
484 echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
485 echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
486 echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
487 echo "KVM_PATH = '$(KVM_PATH)'"; \
488 echo "SOCAT_PATH = '$(SOCAT)'"; \
489 echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
490 echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
491 echo "TOOLSDIR = '$(toolsdir)'"; \
492 echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
493 echo "PKGLIBDIR = '$(pkglibdir)'"; \
494 echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
495 echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
498 $(REPLACE_VARS_SED): Makefile
500 { echo 's#@PREFIX@#$(prefix)#g'; \
501 echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
502 echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
503 echo 's#@BINDIR@#$(bindir)#g'; \
504 echo 's#@SBINDIR@#$(sbindir)#g'; \
505 echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
506 echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
507 echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
508 echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
509 echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
510 echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
511 echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
514 # We need to create symlinks because "make distcheck" will not install Python
515 # files when building.
516 stamp-srclinks: Makefile stamp-directories
518 for i in $(srclink_files); do \
519 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
520 $(LN_S) $(abs_top_srcdir)/$$i $$i; \
527 cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
530 $(CHECK_PYTHON_CODE) $(check_python_code)
533 lint: ganeti $(BUILT_SOURCES)
534 @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
535 $(PYLINT) $(LINT_OPTS) $(lint_python_code)
537 # a dist hook rule for catching revision control directories
539 if find $(top_distdir) -name .svn -or -name .git | grep .; then \
540 echo "Found revision control files in final archive." 1>&2; \
543 if find $(top_distdir) -name '*.py[co]' | grep .; then \
544 echo "Found Python byte code in final archive." 1>&2; \
547 if find $(top_distdir) -name '*~' | grep .; then \
548 echo "Found backup files in final archive." 1>&2; \
553 @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
554 "$(DESTDIR)${localstatedir}/log/ganeti" \
555 "$(DESTDIR)${localstatedir}/run/ganeti"
557 stamp-directories: Makefile
562 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
563 test -e doc/api || mkdir doc/api
564 $(RUN_IN_TEMPDIR) epydoc -v \
565 --conf $(CURDIR)/epydoc.conf \
566 --output $(CURDIR)/doc/api
569 TAGS: $(BUILT_SOURCES)
571 find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
572 -path 'daemons/ganeti-*' -o -path 'tools/*' | \
576 coverage: $(BUILT_SOURCES) $(python_tests)
578 mkdir -p doc/coverage; \
579 COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
580 TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
581 HTML_COVERAGE=$(CURDIR)/doc/coverage \
582 $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \