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