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