Make family argument in FormatAddress optional
[ganeti-local] / Makefile.am
1 # Ganeti makefile
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.
7
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@
11
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
19
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)
28
29 # Delete output file if an error occurred while building it
30 .DELETE_ON_ERROR:
31
32 DIRS = \
33         autotools \
34         daemons \
35         devel \
36         doc \
37         doc/examples \
38         doc/examples/hooks \
39         doc/examples/gnt-debug \
40         lib \
41         lib/build \
42         lib/confd \
43         lib/http \
44         lib/hypervisor \
45         lib/impexpd \
46         lib/masterd \
47         lib/rapi \
48         man \
49         qa \
50         scripts \
51         test \
52         test/data \
53         tools
54
55 BUILDTIME_DIRS = \
56         doc/api \
57         doc/coverage \
58         doc/html
59
60 DIRCHECK_EXCLUDE = \
61         $(BUILDTIME_DIRS) \
62         ganeti-[0-9]*.[0-9]*.[0-9]* \
63         doc/html/_*
64
65 MAINTAINERCLEANFILES = \
66         $(docpng) \
67         $(maninput) \
68         doc/install-quick.rst \
69         doc/news.rst \
70         vcs-version
71
72 maintainer-clean-local:
73         rm -rf $(BUILDTIME_DIRS)
74
75 CLEANFILES = \
76         $(addsuffix /*.py[co],$(DIRS)) \
77         autotools/replace_vars.sed \
78         daemons/daemon-util \
79         daemons/ensure-dirs \
80         daemons/ganeti-cleaner \
81         devel/upload \
82         doc/examples/bash_completion \
83         doc/examples/ganeti.initd \
84         doc/examples/ganeti.cron \
85         doc/examples/gnt-config-backup \
86         doc/examples/hooks/ipsec \
87         $(man_MANS) \
88         $(manhtml) \
89         stamp-directories \
90         stamp-srclinks \
91         $(nodist_pkgpython_PYTHON)
92
93 BUILT_SOURCES = \
94         ganeti \
95         stamp-srclinks \
96         stamp-directories \
97         lib/_autoconf.py
98
99 nodist_pkgpython_PYTHON = \
100         lib/_autoconf.py
101
102 noinst_PYTHON = \
103         lib/build/__init__.py
104
105 pkgpython_PYTHON = \
106         lib/__init__.py \
107         lib/asyncnotifier.py \
108         lib/backend.py \
109         lib/bdev.py \
110         lib/bootstrap.py \
111         lib/cli.py \
112         lib/cmdlib.py \
113         lib/compat.py \
114         lib/config.py \
115         lib/constants.py \
116         lib/daemon.py \
117         lib/errors.py \
118         lib/jqueue.py \
119         lib/jstore.py \
120         lib/locking.py \
121         lib/luxi.py \
122         lib/mcpu.py \
123         lib/netutils.py \
124         lib/objects.py \
125         lib/opcodes.py \
126         lib/rpc.py \
127         lib/serializer.py \
128         lib/ssconf.py \
129         lib/ssh.py \
130         lib/storage.py \
131         lib/utils.py \
132         lib/uidpool.py \
133         lib/workerpool.py
134
135 hypervisor_PYTHON = \
136         lib/hypervisor/__init__.py \
137         lib/hypervisor/hv_base.py \
138         lib/hypervisor/hv_chroot.py \
139         lib/hypervisor/hv_fake.py \
140         lib/hypervisor/hv_kvm.py \
141         lib/hypervisor/hv_lxc.py \
142         lib/hypervisor/hv_xen.py
143
144 rapi_PYTHON = \
145         lib/rapi/__init__.py \
146         lib/rapi/baserlib.py \
147         lib/rapi/client.py \
148         lib/rapi/client_utils.py \
149         lib/rapi/connector.py \
150         lib/rapi/rlib2.py
151
152 http_PYTHON = \
153         lib/http/__init__.py \
154         lib/http/auth.py \
155         lib/http/client.py \
156         lib/http/server.py
157
158 confd_PYTHON = \
159         lib/confd/__init__.py \
160         lib/confd/client.py \
161         lib/confd/querylib.py \
162         lib/confd/server.py
163
164 masterd_PYTHON = \
165         lib/masterd/__init__.py \
166         lib/masterd/instance.py
167
168 impexpd_PYTHON = \
169         lib/impexpd/__init__.py
170
171 docrst = \
172         doc/admin.rst \
173         doc/design-2.0.rst \
174         doc/design-2.1.rst \
175         doc/design-2.2.rst \
176         doc/design-2.3.rst \
177         doc/cluster-merge.rst \
178         doc/devnotes.rst \
179         doc/glossary.rst \
180         doc/hooks.rst \
181         doc/iallocator.rst \
182         doc/index.rst \
183         doc/install-quick.rst \
184         doc/install.rst \
185         doc/locking.rst \
186         doc/move-instance.rst \
187         doc/news.rst \
188         doc/rapi.rst \
189         doc/security.rst \
190         doc/walkthrough.rst
191
192 doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
193         @test -n "$(SPHINX)" || \
194             { echo 'sphinx-build' not found during configure; exit 1; }
195         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
196             -d . \
197             -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
198             -D release="$(PACKAGE_VERSION)" \
199             $(abs_top_srcdir)/doc $(CURDIR)/doc/html
200         rm -f doc/html/.buildinfo doc/html/objects.inv
201         touch $@
202
203 doc/html: doc/html/.stamp
204
205 doc/news.rst: NEWS
206         set -e; \
207         { echo '.. This file is automatically updated at build time from $<.'; \
208           echo '.. Do not edit.'; \
209           echo; \
210           cat $<; \
211         } > $@
212
213 doc/install-quick.rst: INSTALL
214         set -e; \
215         { echo '.. This file is automatically updated at build time from $<.'; \
216           echo '.. Do not edit.'; \
217           echo; \
218           cat $<; \
219         } > $@
220
221 docdot = \
222         doc/arch-2.0.dot \
223         doc/design-2.1-lock-acquire.dot \
224         doc/design-2.1-lock-release.dot
225
226 docpng = $(patsubst %.dot,%.png,$(docdot))
227
228 # Things to build but not to install (add it to EXTRA_DIST if it should be
229 # distributed)
230 noinst_DATA = \
231         devel/upload \
232         doc/html \
233         doc/examples/bash_completion \
234         doc/examples/ganeti.cron \
235         doc/examples/ganeti.initd \
236         doc/examples/gnt-config-backup \
237         doc/examples/hooks/ipsec \
238         $(manhtml)
239
240 gnt_scripts = \
241         scripts/gnt-backup \
242         scripts/gnt-cluster \
243         scripts/gnt-debug \
244         scripts/gnt-instance \
245         scripts/gnt-job \
246         scripts/gnt-node \
247         scripts/gnt-os
248
249 dist_sbin_SCRIPTS = \
250         daemons/ganeti-noded \
251         daemons/ganeti-watcher \
252         daemons/ganeti-masterd \
253         daemons/ganeti-confd \
254         daemons/ganeti-rapi \
255         $(gnt_scripts)
256
257 nodist_sbin_SCRIPTS = \
258         daemons/ganeti-cleaner
259
260 dist_tools_SCRIPTS = \
261         tools/burnin \
262         tools/cfgshell \
263         tools/cfgupgrade \
264         tools/cfgupgrade12 \
265         tools/cluster-merge \
266         tools/lvmstrap \
267         tools/move-instance \
268         tools/setup-ssh \
269         tools/sanitize-config
270
271 pkglib_python_scripts = \
272         daemons/import-export \
273         tools/check-cert-expired
274
275 pkglib_SCRIPTS = \
276         daemons/daemon-util \
277         daemons/ensure-dirs \
278         $(pkglib_python_scripts)
279
280 EXTRA_DIST = \
281         NEWS \
282         pylintrc \
283         autotools/build-bash-completion \
284         autotools/check-python-code \
285         autotools/check-man \
286         autotools/docbook-wrapper \
287         autotools/gen-coverage \
288         autotools/testrunner \
289         $(RUN_IN_TEMPDIR) \
290         daemons/daemon-util.in \
291         daemons/ensure-dirs.in \
292         daemons/ganeti-cleaner.in \
293         $(pkglib_python_scripts) \
294         devel/upload.in \
295         $(docdot) \
296         $(docpng) \
297         $(docrst) \
298         doc/conf.py \
299         doc/html \
300         doc/examples/ganeti.initd.in \
301         doc/examples/ganeti.cron.in \
302         doc/examples/gnt-config-backup.in \
303         doc/examples/dumb-allocator \
304         doc/examples/ganeti.default \
305         doc/examples/ganeti.default-debug \
306         doc/examples/hooks/ethers \
307         doc/examples/hooks/ipsec.in \
308         doc/examples/gnt-debug/README \
309         doc/examples/gnt-debug/delay0.json \
310         doc/examples/gnt-debug/delay50.json \
311         test/testutils.py \
312         test/mocks.py \
313         $(dist_TESTS) \
314         $(TEST_FILES) \
315         man/footer.sgml \
316         $(mansgml) \
317         $(maninput) \
318         qa/ganeti-qa.py \
319         qa/qa-sample.json \
320         qa/qa_cluster.py \
321         qa/qa_config.py \
322         qa/qa_daemon.py \
323         qa/qa_env.py \
324         qa/qa_error.py \
325         qa/qa_instance.py \
326         qa/qa_node.py \
327         qa/qa_os.py \
328         qa/qa_rapi.py \
329         qa/qa_tags.py \
330         qa/qa_utils.py
331
332 man_MANS = \
333         man/ganeti.7 \
334         man/ganeti-cleaner.8 \
335         man/ganeti-confd.8 \
336         man/ganeti-masterd.8 \
337         man/ganeti-noded.8 \
338         man/ganeti-os-interface.7 \
339         man/ganeti-rapi.8 \
340         man/ganeti-watcher.8 \
341         man/gnt-backup.8 \
342         man/gnt-cluster.8 \
343         man/gnt-debug.8 \
344         man/gnt-instance.8 \
345         man/gnt-job.8 \
346         man/gnt-node.8 \
347         man/gnt-os.8
348
349 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
350 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
351 maninput = \
352         $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
353         $(patsubst %.html,%.html.in,$(manhtml))
354
355 TEST_FILES = \
356         test/data/bdev-drbd-8.0.txt \
357         test/data/bdev-drbd-8.3.txt \
358         test/data/bdev-drbd-disk.txt \
359         test/data/bdev-drbd-net-ip4.txt \
360         test/data/bdev-drbd-net-ip6.txt \
361         test/data/cert1.pem \
362         test/data/proc_drbd8.txt \
363         test/data/proc_drbd80-emptyline.txt \
364         test/data/proc_drbd83.txt \
365         test/data/sys_drbd_usermode_helper.txt \
366         test/import-export_unittest-helper
367
368 python_tests = \
369         test/ganeti.asyncnotifier_unittest.py \
370         test/ganeti.backend_unittest.py \
371         test/ganeti.bdev_unittest.py \
372         test/ganeti.cli_unittest.py \
373         test/ganeti.daemon_unittest.py \
374         test/ganeti.cmdlib_unittest.py \
375         test/ganeti.compat_unittest.py \
376         test/ganeti.confd.client_unittest.py \
377         test/ganeti.config_unittest.py \
378         test/ganeti.constants_unittest.py \
379         test/ganeti.errors_unittest.py \
380         test/ganeti.hooks_unittest.py \
381         test/ganeti.http_unittest.py \
382         test/ganeti.hypervisor.hv_kvm_unittest.py \
383         test/ganeti.impexpd_unittest.py \
384         test/ganeti.jqueue_unittest.py \
385         test/ganeti.locking_unittest.py \
386         test/ganeti.luxi_unittest.py \
387         test/ganeti.masterd.instance_unittest.py \
388         test/ganeti.mcpu_unittest.py \
389         test/ganeti.netutils_unittest.py \
390         test/ganeti.objects_unittest.py \
391         test/ganeti.opcodes_unittest.py \
392         test/ganeti.rapi.client_unittest.py \
393         test/ganeti.rapi.resources_unittest.py \
394         test/ganeti.rapi.rlib2_unittest.py \
395         test/ganeti.rpc_unittest.py \
396         test/ganeti.serializer_unittest.py \
397         test/ganeti.ssh_unittest.py \
398         test/ganeti.uidpool_unittest.py \
399         test/ganeti.utils_unittest.py \
400         test/ganeti.utils_mlockall_unittest.py \
401         test/ganeti.workerpool_unittest.py \
402         test/cfgupgrade_unittest.py \
403         test/docs_unittest.py \
404         test/tempfile_fork_unittest.py
405
406 dist_TESTS = \
407         test/check-cert-expired_unittest.bash \
408         test/daemon-util_unittest.bash \
409         test/ganeti-cleaner_unittest.bash \
410         test/import-export_unittest.bash \
411         $(python_tests)
412
413 nodist_TESTS =
414
415 TESTS = $(dist_TESTS) $(nodist_TESTS)
416
417 # Environment for all tests
418 PLAIN_TESTS_ENVIRONMENT = \
419         PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
420
421 # Environment for tests run by automake
422 TESTS_ENVIRONMENT = \
423         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
424
425 all_python_code = \
426         $(dist_sbin_SCRIPTS) \
427         $(dist_tools_SCRIPTS) \
428         $(pkglib_python_scripts) \
429         $(python_tests) \
430         $(pkgpython_PYTHON) \
431         $(hypervisor_PYTHON) \
432         $(rapi_PYTHON) \
433         $(http_PYTHON) \
434         $(confd_PYTHON) \
435         $(masterd_PYTHON) \
436         $(impexpd_PYTHON) \
437         $(noinst_PYTHON)
438
439 srclink_files = \
440         man/footer.sgml \
441         test/check-cert-expired_unittest.bash \
442         test/daemon-util_unittest.bash \
443         test/ganeti-cleaner_unittest.bash \
444         test/import-export_unittest.bash \
445         $(all_python_code)
446
447 check_python_code = \
448         $(BUILD_BASH_COMPLETION) \
449         $(all_python_code)
450
451 lint_python_code = \
452         ganeti \
453         $(dist_sbin_SCRIPTS) \
454         $(dist_tools_SCRIPTS) \
455         $(pkglib_python_scripts) \
456         $(BUILD_BASH_COMPLETION)
457
458 test/daemon-util_unittest.bash: daemons/daemon-util
459
460 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
461
462 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
463         sed -f $(REPLACE_VARS_SED) < $< > $@
464         chmod u+x $@
465
466 daemons/%: daemons/%.in \
467                 $(REPLACE_VARS_SED)
468         sed -f $(REPLACE_VARS_SED) < $< > $@
469         chmod +x $@
470
471 doc/examples/%: doc/examples/%.in \
472                 $(REPLACE_VARS_SED)
473         sed -f $(REPLACE_VARS_SED) < $< > $@
474
475 doc/examples/hooks/%: doc/examples/hooks/%.in \
476                 $(REPLACE_VARS_SED)
477         sed -f $(REPLACE_VARS_SED) < $< > $@
478
479 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
480         lib/cli.py $(gnt_scripts) tools/burnin
481         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
482
483 doc/%.png: doc/%.dot
484         @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
485         $(DOT) -Tpng -o $@ $<
486
487 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
488         @test -n "$(DOCBOOK2MAN)" || \
489           { echo 'docbook2man' not found during configure; exit 1; }
490         $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
491         if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
492
493 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
494         @test -n "$(DOCBOOK2HTML)" || \
495           { echo 'docbook2html' not found during configure; exit 1; }
496         $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
497
498 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
499         sed -f $(REPLACE_VARS_SED) < $< > $@
500
501 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
502         sed -f $(REPLACE_VARS_SED) < $< > $@
503
504 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
505         sed -f $(REPLACE_VARS_SED) < $< > $@
506
507 vcs-version:
508         if test -d .git; then \
509           git describe > $@; \
510         elif test ! -f $@ ; then \
511           echo "Cannot auto-generate $@ file"; exit 1; \
512         fi
513
514 .PHONY: regen-vcs-version
515 regen-vcs-version:
516         set -e; \
517         cd $(srcdir); \
518         if test -d .git; then \
519           rm -f vcs-version; \
520           $(MAKE) vcs-version; \
521         fi
522
523 lib/_autoconf.py: Makefile stamp-directories vcs-version
524         set -e; \
525         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
526         { echo '# This file is automatically generated, do not edit!'; \
527           echo '#'; \
528           echo ''; \
529           echo '"""Build-time configuration for Ganeti.'; \
530           echo '';\
531           echo 'This file is autogenerated by the build process.'; \
532           echo 'For any changes you need to re-run ./configure (and'; \
533           echo 'not edit by hand).'; \
534           echo ''; \
535           echo '"""'; \
536           echo ''; \
537           echo '# pylint: disable-msg=C0301,C0324'; \
538           echo '# because this is autogenerated, we do not want'; \
539           echo '# style warnings' ; \
540           echo ''; \
541           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
542           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
543           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
544           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
545           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
546           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
547           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
548           echo "SYSCONFDIR = '$(sysconfdir)'"; \
549           echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
550           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
551           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
552           echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
553           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
554           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
555           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
556           echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
557           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
558           echo "KVM_PATH = '$(KVM_PATH)'"; \
559           echo "SOCAT_PATH = '$(SOCAT)'"; \
560           echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
561           echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
562           echo "TOOLSDIR = '$(toolsdir)'"; \
563           echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
564           echo "PKGLIBDIR = '$(pkglibdir)'"; \
565           echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
566           echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
567           echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
568           echo "MASTERD_USER = '$(MASTERD_USER)'"; \
569           echo "RAPI_USER = '$(RAPI_USER)'"; \
570           echo "VCS_VERSION = '$$VCSVER'"; \
571         } > $@
572
573 $(REPLACE_VARS_SED): Makefile
574         set -e; \
575         { echo 's#@PREFIX@#$(prefix)#g'; \
576           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
577           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
578           echo 's#@BINDIR@#$(bindir)#g'; \
579           echo 's#@SBINDIR@#$(sbindir)#g'; \
580           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
581           echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
582           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
583           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
584           echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
585           echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
586           echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
587           echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
588           echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
589           echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
590           echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
591           echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
592           echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
593           echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
594           echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
595           echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
596         } > $@
597
598 # We need to create symlinks because "make distcheck" will not install Python
599 # files when building.
600 stamp-srclinks: Makefile stamp-directories
601         set -e; \
602         for i in $(srclink_files); do \
603                 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
604                         $(LN_S) $(abs_top_srcdir)/$$i $$i; \
605                 fi; \
606         done
607         touch $@
608
609 .PHONY: ganeti
610 ganeti:
611         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
612
613 .PHONY: check-dirs
614 check-dirs: $(BUILT_SOURCES)
615         @set -e; \
616         find . -type d \( \( -name . \) -o \( \
617                 -name .git -o \
618                 -name autom4te.cache \
619                 \) -prune -o -print \) | { \
620                 error=; \
621                 while read dir; do \
622                         case "$$dir" in \
623                                 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
624                                 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
625                         esac; \
626                 done; \
627                 for dir in $(DIRS); do \
628                         if ! test -d "$$dir"; then \
629                                 echo "Directory $$dir listed in DIRS does not exist" >&2; \
630                                 error=1; \
631                         fi \
632                 done; \
633                 if test -n "$$error"; then exit 1; else exit 0; fi; \
634         }
635
636 check-local: check-dirs
637         $(CHECK_PYTHON_CODE) $(check_python_code)
638
639 .PHONY: lint
640 lint: ganeti $(BUILT_SOURCES)
641         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
642         $(PYLINT) $(LINT_OPTS) $(lint_python_code)
643
644 # a dist hook rule for updating the vcs-version file; this is
645 # hardcoded due to where it needs to build the file...
646 dist-hook:
647         $(MAKE) regen-vcs-version && \
648         rm -f $(top_distdir)/vcs-version && \
649         cp -p $(srcdir)/vcs-version $(top_distdir)
650
651 # a distcheck hook rule for catching revision control directories
652 distcheck-hook:
653         if find $(top_distdir) -name .svn -or -name .git | grep .; then \
654                 echo "Found revision control files in final archive." 1>&2; \
655                 exit 1; \
656         fi
657         if find $(top_distdir) -name '*.py[co]' | grep .; then \
658                 echo "Found Python byte code in final archive." 1>&2; \
659                 exit 1; \
660         fi
661         if find $(top_distdir) -name '*~' | grep .; then \
662                 echo "Found backup files in final archive." 1>&2; \
663                 exit 1; \
664         fi
665
666 install-exec-local:
667         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
668           "$(DESTDIR)${localstatedir}/log/ganeti" \
669           "$(DESTDIR)${localstatedir}/run/ganeti"
670
671 stamp-directories: Makefile
672         @mkdir_p@ $(DIRS)
673         touch $@
674
675 .PHONY: apidoc
676 apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
677         test -e doc/api || mkdir doc/api
678         $(RUN_IN_TEMPDIR) epydoc -v \
679                 --conf $(CURDIR)/epydoc.conf \
680                 --output $(CURDIR)/doc/api
681
682 .PHONY: TAGS
683 TAGS: $(BUILT_SOURCES)
684         rm -f TAGS
685         find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
686           -path './daemons/ganeti-*' -o -path './tools/*' -o \
687           -path './qa/*.py' | \
688           etags -
689
690 .PHONY: coverage
691 coverage: $(BUILT_SOURCES) $(python_tests)
692         set -e; \
693         mkdir -p doc/coverage; \
694         COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
695         TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
696         HTML_COVERAGE=$(CURDIR)/doc/coverage \
697         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
698         $(python_tests)
699
700 commit-check: distcheck lint apidoc
701
702 -include ./Makefile.local
703
704 # vim: set noet :