Adding a wrapper around "xm console"
[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 # Use bash in order to be able to use pipefail
13 SHELL=/bin/bash
14
15 ACLOCAL_AMFLAGS = -I autotools
16 BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
17 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
18 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
19 CHECK_MAN = $(top_srcdir)/autotools/check-man
20 CHECK_VERSION = $(top_srcdir)/autotools/check-version
21 CHECK_NEWS = $(top_srcdir)/autotools/check-news
22 DOCPP = $(top_srcdir)/autotools/docpp
23 REPLACE_VARS_SED = autotools/replace_vars.sed
24 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
25
26 # Note: these are automake-specific variables, and must be named after
27 # the directory + 'dir' suffix
28 clientdir = $(pkgpythondir)/client
29 hypervisordir = $(pkgpythondir)/hypervisor
30 httpdir = $(pkgpythondir)/http
31 masterddir = $(pkgpythondir)/masterd
32 confddir = $(pkgpythondir)/confd
33 rapidir = $(pkgpythondir)/rapi
34 serverdir = $(pkgpythondir)/server
35 watcherdir = $(pkgpythondir)/watcher
36 impexpddir = $(pkgpythondir)/impexpd
37 utilsdir = $(pkgpythondir)/utils
38 toolsdir = $(pkglibdir)/tools
39 iallocatorsdir = $(pkglibdir)/iallocators
40 pytoolsdir = $(pkgpythondir)/tools
41 docdir = $(datadir)/doc/$(PACKAGE)
42
43 # Delete output file if an error occurred while building it
44 .DELETE_ON_ERROR:
45
46 HTOOLS_DIRS = \
47         htools \
48         htools/Ganeti \
49         htools/Ganeti/HTools
50
51 DIRS = \
52         autotools \
53         daemons \
54         devel \
55         doc \
56         doc/examples \
57         doc/examples/hooks \
58         doc/examples/gnt-debug \
59         $(HTOOLS_DIRS) \
60         lib \
61         lib/client \
62         lib/build \
63         lib/confd \
64         lib/http \
65         lib/hypervisor \
66         lib/impexpd \
67         lib/masterd \
68         lib/rapi \
69         lib/server \
70         lib/tools \
71         lib/utils \
72         lib/watcher \
73         man \
74         qa \
75         test \
76         test/data \
77         tools
78
79 BUILDTIME_DIR_AUTOCREATE = \
80         scripts \
81         $(APIDOC_DIR) \
82         $(APIDOC_PY_DIR) \
83         $(APIDOC_HS_DIR) \
84         $(APIDOC_HS_DIR)/Ganeti $(APIDOC_HS_DIR)/Ganeti/HTools \
85         $(COVERAGE_DIR) \
86         $(COVERAGE_PY_DIR) \
87         $(COVERAGE_HS_DIR) \
88         .hpc
89
90 BUILDTIME_DIRS = \
91         $(BUILDTIME_DIR_AUTOCREATE) \
92         doc/html
93
94 DIRCHECK_EXCLUDE = \
95         $(BUILDTIME_DIRS) \
96         ganeti-[0-9]*.[0-9]*.[0-9]* \
97         doc/html/_*
98
99 all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
100
101 # some helper vars
102 COVERAGE_DIR = doc/coverage
103 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
104 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
105 APIDOC_DIR = doc/api
106 APIDOC_PY_DIR = $(APIDOC_DIR)/py
107 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
108
109 MAINTAINERCLEANFILES = \
110         $(docpng) \
111         $(maninput) \
112         doc/install-quick.rst \
113         doc/news.rst \
114         doc/upgrade.rst \
115         vcs-version
116
117 maintainer-clean-local:
118         rm -rf $(BUILDTIME_DIRS)
119
120 CLEANFILES = \
121         $(addsuffix /*.py[co],$(DIRS)) \
122         $(addsuffix /*.hi,$(HTOOLS_DIRS)) \
123         $(addsuffix /*.o,$(HTOOLS_DIRS)) \
124         $(all_dirfiles) \
125         $(PYTHON_BOOTSTRAP) \
126         epydoc.conf \
127         autotools/replace_vars.sed \
128         daemons/daemon-util \
129         daemons/ganeti-cleaner \
130         devel/upload \
131         doc/examples/bash_completion \
132         doc/examples/ganeti.initd \
133         doc/examples/ganeti-kvm-poweroff.initd \
134         doc/examples/ganeti.cron \
135         doc/examples/gnt-config-backup \
136         doc/examples/hooks/ipsec \
137         $(man_MANS) \
138         $(manhtml) \
139         tools/kvm-ifup \
140         stamp-srclinks \
141         $(nodist_pkgpython_PYTHON) \
142         $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
143         .hpc/*.mix htools/*.tix \
144         doc/hs-lint.html
145
146 # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
147 # it'll cause the target to rebuild every time.
148 BUILT_SOURCES = \
149         ganeti \
150         stamp-srclinks \
151         lib/_autoconf.py \
152         $(all_dirfiles) \
153         $(PYTHON_BOOTSTRAP)
154
155 nodist_pkgpython_PYTHON = \
156         lib/_autoconf.py
157
158 noinst_PYTHON = \
159         lib/build/__init__.py \
160         lib/build/sphinx_ext.py
161
162 pkgpython_PYTHON = \
163         lib/__init__.py \
164         lib/asyncnotifier.py \
165         lib/backend.py \
166         lib/bdev.py \
167         lib/bootstrap.py \
168         lib/cli.py \
169         lib/cmdlib.py \
170         lib/compat.py \
171         lib/config.py \
172         lib/constants.py \
173         lib/daemon.py \
174         lib/errors.py \
175         lib/ht.py \
176         lib/jqueue.py \
177         lib/jstore.py \
178         lib/locking.py \
179         lib/luxi.py \
180         lib/mcpu.py \
181         lib/netutils.py \
182         lib/objects.py \
183         lib/opcodes.py \
184         lib/qlang.py \
185         lib/query.py \
186         lib/rpc.py \
187         lib/runtime.py \
188         lib/serializer.py \
189         lib/ssconf.py \
190         lib/ssh.py \
191         lib/storage.py \
192         lib/uidpool.py \
193         lib/workerpool.py
194
195 client_PYTHON = \
196         lib/client/__init__.py \
197         lib/client/gnt_backup.py \
198         lib/client/gnt_cluster.py \
199         lib/client/gnt_debug.py \
200         lib/client/gnt_group.py \
201         lib/client/gnt_instance.py \
202         lib/client/gnt_job.py \
203         lib/client/gnt_node.py \
204         lib/client/gnt_os.py
205
206 hypervisor_PYTHON = \
207         lib/hypervisor/__init__.py \
208         lib/hypervisor/hv_base.py \
209         lib/hypervisor/hv_chroot.py \
210         lib/hypervisor/hv_fake.py \
211         lib/hypervisor/hv_kvm.py \
212         lib/hypervisor/hv_lxc.py \
213         lib/hypervisor/hv_xen.py
214
215 rapi_PYTHON = \
216         lib/rapi/__init__.py \
217         lib/rapi/baserlib.py \
218         lib/rapi/client.py \
219         lib/rapi/client_utils.py \
220         lib/rapi/connector.py \
221         lib/rapi/rlib2.py
222
223 http_PYTHON = \
224         lib/http/__init__.py \
225         lib/http/auth.py \
226         lib/http/client.py \
227         lib/http/server.py
228
229 confd_PYTHON = \
230         lib/confd/__init__.py \
231         lib/confd/client.py \
232         lib/confd/querylib.py \
233         lib/confd/server.py
234
235 masterd_PYTHON = \
236         lib/masterd/__init__.py \
237         lib/masterd/instance.py
238
239 impexpd_PYTHON = \
240         lib/impexpd/__init__.py
241
242 watcher_PYTHON = \
243         lib/watcher/__init__.py
244
245 server_PYTHON = \
246         lib/server/__init__.py \
247         lib/server/confd.py \
248         lib/server/masterd.py \
249         lib/server/noded.py \
250         lib/server/rapi.py
251
252 pytools_PYTHON = \
253         lib/tools/__init__.py \
254         lib/tools/ensure_dirs.py
255
256 utils_PYTHON = \
257         lib/utils/__init__.py \
258         lib/utils/algo.py \
259         lib/utils/filelock.py \
260         lib/utils/hash.py \
261         lib/utils/io.py \
262         lib/utils/log.py \
263         lib/utils/mlock.py \
264         lib/utils/nodesetup.py \
265         lib/utils/process.py \
266         lib/utils/retry.py \
267         lib/utils/text.py \
268         lib/utils/wrapper.py \
269         lib/utils/x509.py
270
271 docrst = \
272         doc/admin.rst \
273         doc/design-2.0.rst \
274         doc/design-2.1.rst \
275         doc/design-2.2.rst \
276         doc/design-2.3.rst \
277         doc/design-htools-2.3.rst \
278         doc/design-2.4.rst \
279         doc/design-draft.rst \
280         doc/design-oob.rst \
281         doc/design-cpu-pinning.rst \
282         doc/design-query2.rst \
283         doc/design-x509-ca.rst \
284         doc/design-http-server.rst \
285         doc/design-impexp2.rst \
286         doc/design-lu-generated-jobs.rst \
287         doc/design-multi-reloc.rst \
288         doc/design-network.rst \
289         doc/design-chained-jobs.rst \
290         doc/cluster-merge.rst \
291         doc/design-shared-storage.rst \
292         doc/devnotes.rst \
293         doc/glossary.rst \
294         doc/hooks.rst \
295         doc/iallocator.rst \
296         doc/index.rst \
297         doc/install-quick.rst \
298         doc/install.rst \
299         doc/locking.rst \
300         doc/move-instance.rst \
301         doc/news.rst \
302         doc/rapi.rst \
303         doc/security.rst \
304         doc/upgrade.rst \
305         doc/walkthrough.rst
306
307 HS_PROGS = \
308         htools/hbal \
309         htools/hscan \
310         htools/hail \
311         htools/hspace
312
313 HS_ALL_PROGS = $(HS_PROGS) htools/test
314 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
315 # we don't add -Werror by default
316 HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
317 # extra flags that can be overriden on the command line
318 HEXTRA =
319 # exclude options for coverage reports
320 HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC \
321         --exclude Ganeti.Constants \
322         --exclude Ganeti.HTools.Version
323
324 HS_LIB_SRCS = \
325         htools/Ganeti/HTools/CLI.hs \
326         htools/Ganeti/HTools/Cluster.hs \
327         htools/Ganeti/HTools/Container.hs \
328         htools/Ganeti/HTools/ExtLoader.hs \
329         htools/Ganeti/HTools/Group.hs \
330         htools/Ganeti/HTools/IAlloc.hs \
331         htools/Ganeti/HTools/Instance.hs \
332         htools/Ganeti/HTools/Loader.hs \
333         htools/Ganeti/HTools/Luxi.hs \
334         htools/Ganeti/HTools/Node.hs \
335         htools/Ganeti/HTools/PeerMap.hs \
336         htools/Ganeti/HTools/QC.hs \
337         htools/Ganeti/HTools/Rapi.hs \
338         htools/Ganeti/HTools/Simu.hs \
339         htools/Ganeti/HTools/Text.hs \
340         htools/Ganeti/HTools/Types.hs \
341         htools/Ganeti/HTools/Utils.hs \
342         htools/Ganeti/Jobs.hs \
343         htools/Ganeti/Luxi.hs \
344         htools/Ganeti/OpCodes.hs
345
346 HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
347 HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
348
349 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
350
351 # Note: we use here an order-only prerequisite, as the contents of
352 # _autoconf.py are not actually influencing the html build output: it
353 # has to exist in order for the sphinx module to be loaded
354 # successfully, but we certainly don't want the docs to be rebuilt if
355 # it changes
356 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
357         $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
358         | lib/_autoconf.py
359         @test -n "$(SPHINX)" || \
360             { echo 'sphinx-build' not found during configure; exit 1; }
361         @mkdir_p@ $(dir $@)
362         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
363             -d . \
364             -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
365             -D release="$(PACKAGE_VERSION)" \
366             $(abs_top_srcdir)/doc $(CURDIR)/doc/html
367         rm -f doc/html/.buildinfo doc/html/objects.inv
368         touch $@
369
370 doc/html: doc/html/index.html
371
372 doc/install-quick.rst: INSTALL
373 doc/news.rst: NEWS
374 doc/upgrade.rst: UPGRADE
375
376 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
377         set -e; \
378         { echo '.. This file is automatically updated at build time from $<.'; \
379           echo '.. Do not edit.'; \
380           echo; \
381           cat $<; \
382         } > $@
383
384 docdot = \
385         doc/arch-2.0.dot \
386         doc/design-2.1-lock-acquire.dot \
387         doc/design-2.1-lock-release.dot
388
389 docpng = $(patsubst %.dot,%.png,$(docdot))
390
391 # Things to build but not to install (add it to EXTRA_DIST if it should be
392 # distributed)
393 noinst_DATA = \
394         devel/upload \
395         doc/html \
396         doc/examples/bash_completion \
397         doc/examples/ganeti.cron \
398         doc/examples/ganeti.initd \
399         doc/examples/ganeti-kvm-poweroff.initd \
400         doc/examples/gnt-config-backup \
401         doc/examples/hooks/ipsec \
402         $(manhtml)
403
404 gnt_scripts = \
405         scripts/gnt-backup \
406         scripts/gnt-cluster \
407         scripts/gnt-debug \
408         scripts/gnt-group \
409         scripts/gnt-instance \
410         scripts/gnt-job \
411         scripts/gnt-node \
412         scripts/gnt-os
413
414 PYTHON_BOOTSTRAP_SBIN = \
415         daemons/ganeti-confd \
416         daemons/ganeti-masterd \
417         daemons/ganeti-noded \
418         daemons/ganeti-watcher \
419         daemons/ganeti-rapi \
420         scripts/gnt-backup \
421         scripts/gnt-cluster \
422         scripts/gnt-debug \
423         scripts/gnt-group \
424         scripts/gnt-instance \
425         scripts/gnt-job \
426         scripts/gnt-node \
427         scripts/gnt-os
428
429 PYTHON_BOOTSTRAP = \
430         $(PYTHON_BOOTSTRAP_SBIN) \
431         tools/ensure-dirs
432
433 qa_scripts = \
434         qa/ganeti-qa.py \
435         qa/qa_cluster.py \
436         qa/qa_config.py \
437         qa/qa_daemon.py \
438         qa/qa_env.py \
439         qa/qa_error.py \
440         qa/qa_instance.py \
441         qa/qa_node.py \
442         qa/qa_os.py \
443         qa/qa_rapi.py \
444         qa/qa_tags.py \
445         qa/qa_utils.py
446
447 bin_SCRIPTS =
448 iallocators_SCRIPTS =
449 if WANT_HTOOLS
450 bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
451 iallocators_SCRIPTS += $(filter htools/hail,$(HS_PROGS))
452 endif
453
454 $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
455         @if [ -z "$(HTOOLS)" ]; then \
456           echo "Error: htools compilation disabled at configure time" 1>&2 ;\
457           exit 1; \
458         fi
459         @BINARY=$(@:htools/%=%); \
460         if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
461           echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
462           exit 1; \
463         fi
464         BINARY=$(@:htools/%=%); $(GHC) --make \
465           $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
466           -osuf $$BINARY.o -hisuf $$BINARY.hi $@
467
468 # for the htools/test binary, we need to enable profiling/coverage
469 htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
470         -fno-warn-monomorphism-restriction -fno-warn-orphans \
471         -fno-warn-missing-methods -fno-warn-unused-imports
472
473 dist_sbin_SCRIPTS = \
474         tools/ganeti-listrunner
475
476 nodist_sbin_SCRIPTS = \
477         $(PYTHON_BOOTSTRAP_SBIN) \
478         daemons/ganeti-cleaner
479
480 dist_tools_PYTHON = \
481         tools/burnin \
482         tools/cfgshell \
483         tools/cfgupgrade \
484         tools/cfgupgrade12 \
485         tools/cluster-merge \
486         tools/lvmstrap \
487         tools/move-instance \
488         tools/setup-ssh \
489         tools/sanitize-config
490
491 dist_tools_SCRIPTS = \
492         $(dist_tools_PYTHON) \
493         tools/xm-console-wrapper
494
495 pkglib_python_scripts = \
496         daemons/import-export \
497         tools/check-cert-expired
498
499 nodist_pkglib_python_scripts = \
500         tools/ensure-dirs
501
502 pkglib_SCRIPTS = \
503         daemons/daemon-util \
504         tools/kvm-ifup \
505         $(pkglib_python_scripts)
506
507 nodist_pkglib_SCRIPTS = \
508         $(nodist_pkglib_python_scripts)
509
510 EXTRA_DIST = \
511         NEWS \
512         UPGRADE \
513         epydoc.conf.in \
514         pylintrc \
515         autotools/build-bash-completion \
516         autotools/check-python-code \
517         autotools/check-man \
518         autotools/check-news \
519         autotools/check-tar \
520         autotools/check-version \
521         autotools/convert-constants \
522         autotools/docpp \
523         autotools/gen-coverage \
524         autotools/testrunner \
525         $(RUN_IN_TEMPDIR) \
526         daemons/daemon-util.in \
527         daemons/ganeti-cleaner.in \
528         $(pkglib_python_scripts) \
529         devel/upload.in \
530         tools/kvm-ifup.in \
531         $(docdot) \
532         $(docpng) \
533         $(docrst) \
534         doc/conf.py \
535         doc/html \
536         doc/examples/ganeti.initd.in \
537         doc/examples/ganeti-kvm-poweroff.initd.in \
538         doc/examples/ganeti.cron.in \
539         doc/examples/gnt-config-backup.in \
540         doc/examples/ganeti.default \
541         doc/examples/ganeti.default-debug \
542         doc/examples/hooks/ethers \
543         doc/examples/hooks/ipsec.in \
544         doc/examples/gnt-debug/README \
545         doc/examples/gnt-debug/delay0.json \
546         doc/examples/gnt-debug/delay50.json \
547         test/testutils.py \
548         test/mocks.py \
549         $(dist_TESTS) \
550         $(TEST_FILES) \
551         man/footer.rst \
552         $(manrst) \
553         $(maninput) \
554         qa/qa-sample.json \
555         $(qa_scripts) \
556         $(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
557         $(HS_PROG_SRCS)
558
559 man_MANS = \
560         man/ganeti.7 \
561         man/ganeti-cleaner.8 \
562         man/ganeti-confd.8 \
563         man/ganeti-listrunner.8 \
564         man/ganeti-masterd.8 \
565         man/ganeti-noded.8 \
566         man/ganeti-os-interface.7 \
567         man/ganeti-rapi.8 \
568         man/ganeti-watcher.8 \
569         man/gnt-backup.8 \
570         man/gnt-cluster.8 \
571         man/gnt-debug.8 \
572         man/gnt-group.8 \
573         man/gnt-instance.8 \
574         man/gnt-job.8 \
575         man/gnt-node.8 \
576         man/gnt-os.8 \
577         man/hail.1 \
578         man/hbal.1 \
579         man/hscan.1 \
580         man/hspace.1
581
582 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
583 manhtml = $(patsubst %.rst,%.html,$(manrst))
584 mangen = $(patsubst %.rst,%.gen,$(manrst))
585 maninput = \
586         $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
587         $(patsubst %.html,%.html.in,$(manhtml)) \
588         man/footer.man man/footer.html $(mangen)
589
590 TEST_FILES = \
591         test/data/bdev-drbd-8.0.txt \
592         test/data/bdev-drbd-8.3.txt \
593         test/data/bdev-drbd-disk.txt \
594         test/data/bdev-drbd-net-ip4.txt \
595         test/data/bdev-drbd-net-ip6.txt \
596         test/data/cert1.pem \
597         test/data/proc_drbd8.txt \
598         test/data/proc_drbd80-emptyline.txt \
599         test/data/proc_drbd83.txt \
600         test/data/sys_drbd_usermode_helper.txt \
601         test/import-export_unittest-helper
602
603 python_tests = \
604         test/ganeti.asyncnotifier_unittest.py \
605         test/ganeti.backend_unittest.py \
606         test/ganeti.bdev_unittest.py \
607         test/ganeti.cli_unittest.py \
608         test/ganeti.client.gnt_cluster_unittest.py \
609         test/ganeti.client.gnt_instance_unittest.py \
610         test/ganeti.daemon_unittest.py \
611         test/ganeti.cmdlib_unittest.py \
612         test/ganeti.compat_unittest.py \
613         test/ganeti.confd.client_unittest.py \
614         test/ganeti.config_unittest.py \
615         test/ganeti.constants_unittest.py \
616         test/ganeti.errors_unittest.py \
617         test/ganeti.hooks_unittest.py \
618         test/ganeti.ht_unittest.py \
619         test/ganeti.http_unittest.py \
620         test/ganeti.hypervisor_unittest.py \
621         test/ganeti.hypervisor.hv_chroot_unittest.py \
622         test/ganeti.hypervisor.hv_fake_unittest.py \
623         test/ganeti.hypervisor.hv_kvm_unittest.py \
624         test/ganeti.hypervisor.hv_lxc_unittest.py \
625         test/ganeti.hypervisor.hv_xen_unittest.py \
626         test/ganeti.impexpd_unittest.py \
627         test/ganeti.jqueue_unittest.py \
628         test/ganeti.locking_unittest.py \
629         test/ganeti.luxi_unittest.py \
630         test/ganeti.masterd.instance_unittest.py \
631         test/ganeti.mcpu_unittest.py \
632         test/ganeti.netutils_unittest.py \
633         test/ganeti.objects_unittest.py \
634         test/ganeti.opcodes_unittest.py \
635         test/ganeti.qlang_unittest.py \
636         test/ganeti.query_unittest.py \
637         test/ganeti.rapi.baserlib_unittest.py \
638         test/ganeti.rapi.client_unittest.py \
639         test/ganeti.rapi.resources_unittest.py \
640         test/ganeti.rapi.rlib2_unittest.py \
641         test/ganeti.rpc_unittest.py \
642         test/ganeti.runtime_unittest.py \
643         test/ganeti.serializer_unittest.py \
644         test/ganeti.ssh_unittest.py \
645         test/ganeti.tools.ensure_dirs_unittest.py \
646         test/ganeti.uidpool_unittest.py \
647         test/ganeti.utils.algo_unittest.py \
648         test/ganeti.utils.filelock_unittest.py \
649         test/ganeti.utils.hash_unittest.py \
650         test/ganeti.utils.io_unittest.py \
651         test/ganeti.utils.log_unittest.py \
652         test/ganeti.utils.mlock_unittest.py \
653         test/ganeti.utils.nodesetup_unittest.py \
654         test/ganeti.utils.process_unittest.py \
655         test/ganeti.utils.retry_unittest.py \
656         test/ganeti.utils.text_unittest.py \
657         test/ganeti.utils.wrapper_unittest.py \
658         test/ganeti.utils.x509_unittest.py \
659         test/ganeti.utils_unittest.py \
660         test/ganeti.workerpool_unittest.py \
661         test/cfgupgrade_unittest.py \
662         test/docs_unittest.py \
663         test/tempfile_fork_unittest.py
664
665 haskell_tests = htools/test
666
667 dist_TESTS = \
668         test/check-cert-expired_unittest.bash \
669         test/daemon-util_unittest.bash \
670         test/ganeti-cleaner_unittest.bash \
671         test/import-export_unittest.bash \
672         $(python_tests)
673
674 nodist_TESTS =
675 if WANT_HTOOLSTESTS
676 nodist_TESTS += $(haskell_tests)
677 endif
678
679 TESTS = $(dist_TESTS) $(nodist_TESTS)
680
681 # Environment for all tests
682 PLAIN_TESTS_ENVIRONMENT = \
683         PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
684
685 # Environment for tests run by automake
686 TESTS_ENVIRONMENT = \
687         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
688
689 all_python_code = \
690         $(dist_sbin_SCRIPTS) \
691         $(dist_tools_PYTHON) \
692         $(pkglib_python_scripts) \
693         $(nodist_pkglib_python_scripts) \
694         $(python_tests) \
695         $(pkgpython_PYTHON) \
696         $(client_PYTHON) \
697         $(hypervisor_PYTHON) \
698         $(rapi_PYTHON) \
699         $(server_PYTHON) \
700         $(pytools_PYTHON) \
701         $(http_PYTHON) \
702         $(confd_PYTHON) \
703         $(masterd_PYTHON) \
704         $(impexpd_PYTHON) \
705         $(utils_PYTHON) \
706         $(watcher_PYTHON) \
707         $(noinst_PYTHON) \
708         $(qa_scripts)
709
710 srclink_files = \
711         man/footer.rst \
712         test/check-cert-expired_unittest.bash \
713         test/daemon-util_unittest.bash \
714         test/ganeti-cleaner_unittest.bash \
715         test/import-export_unittest.bash \
716         $(all_python_code) \
717         $(HS_LIB_SRCS) $(HS_PROG_SRCS)
718
719 check_python_code = \
720         $(BUILD_BASH_COMPLETION) \
721         $(DOCPP) \
722         $(all_python_code)
723
724 lint_python_code = \
725         ganeti \
726         ganeti/http/server.py \
727         $(dist_sbin_SCRIPTS) \
728         $(dist_tools_PYTHON) \
729         $(pkglib_python_scripts) \
730         $(BUILD_BASH_COMPLETION) \
731         $(DOCPP) \
732         $(PYTHON_BOOTSTRAP)
733
734 test/daemon-util_unittest.bash: daemons/daemon-util
735
736 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
737
738 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
739         sed -f $(REPLACE_VARS_SED) < $< > $@
740         chmod +x $@
741
742 devel/upload: devel/upload.in $(REPLACE_VARS_SED)
743         sed -f $(REPLACE_VARS_SED) < $< > $@
744         chmod u+x $@
745
746 daemons/%: daemons/%.in $(REPLACE_VARS_SED)
747         sed -f $(REPLACE_VARS_SED) < $< > $@
748         chmod +x $@
749
750 doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
751         sed -f $(REPLACE_VARS_SED) < $< > $@
752
753 doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
754         sed -f $(REPLACE_VARS_SED) < $< > $@
755
756 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
757         lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
758         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
759
760 doc/%.png: doc/%.dot
761         @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
762         $(DOT) -Tpng -o $@ $<
763
764 man/footer.man: man/footer.rst
765         @test -n "$(PANDOC)" || \
766           { echo 'pandoc' not found during configure; exit 1; }
767         $(PANDOC) -f rst -t man -o $@ $<
768
769 man/footer.html: man/footer.rst
770         @test -n "$(PANDOC)" || \
771           { echo 'pandoc' not found during configure; exit 1; }
772         $(PANDOC) -f rst -t html -o $@ $<
773
774 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
775         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
776
777 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
778         @test -n "$(PANDOC)" || \
779           { echo 'pandoc' not found during configure; exit 1; }
780         set -o pipefail ; \
781         $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
782           sed -e 's/\\@/@/g' > $@
783         if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
784
785 man/%.html.in: man/%.gen man/footer.html
786         @test -n "$(PANDOC)" || \
787           { echo 'pandoc' not found during configure; exit 1; }
788         set -o pipefail ; \
789         $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
790           sed -e 's/\\@/@/g' > $@
791
792 man/%.1: man/%.1.in $(REPLACE_VARS_SED)
793         sed -f $(REPLACE_VARS_SED) < $< > $@
794
795 man/%.7: man/%.7.in $(REPLACE_VARS_SED)
796         sed -f $(REPLACE_VARS_SED) < $< > $@
797
798 man/%.8: man/%.8.in $(REPLACE_VARS_SED)
799         sed -f $(REPLACE_VARS_SED) < $< > $@
800
801 man/%.html: man/%.html.in $(REPLACE_VARS_SED)
802         sed -f $(REPLACE_VARS_SED) < $< > $@
803
804 epydoc.conf: epydoc.conf.in Makefile
805         sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
806
807 vcs-version:
808         if test -d .git; then \
809           git describe > $@; \
810         elif test ! -f $@ ; then \
811           echo "Cannot auto-generate $@ file"; exit 1; \
812         fi
813
814 .PHONY: regen-vcs-version
815 regen-vcs-version:
816         set -e; \
817         cd $(srcdir); \
818         if test -d .git; then \
819           rm -f vcs-version; \
820           $(MAKE) vcs-version; \
821         fi
822
823 htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
824         set -e; \
825         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
826         sed -e "s/%ver%/$$VCSVER/" < $< > $@
827
828 htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
829         lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS)
830         set -e; \
831         { cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
832
833 lib/_autoconf.py: Makefile vcs-version | lib/.dir
834         set -e; \
835         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
836         { echo '# This file is automatically generated, do not edit!'; \
837           echo '#'; \
838           echo ''; \
839           echo '"""Build-time configuration for Ganeti.'; \
840           echo '';\
841           echo 'This file is autogenerated by the build process.'; \
842           echo 'For any changes you need to re-run ./configure (and'; \
843           echo 'not edit by hand).'; \
844           echo ''; \
845           echo '"""'; \
846           echo ''; \
847           echo '# pylint: disable-msg=C0301,C0324'; \
848           echo '# because this is autogenerated, we do not want'; \
849           echo '# style warnings' ; \
850           echo ''; \
851           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
852           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
853           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
854           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
855           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
856           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
857           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
858           echo "SYSCONFDIR = '$(sysconfdir)'"; \
859           echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
860           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
861           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
862           echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
863           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
864           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
865           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
866           echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
867           echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
868           echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
869           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
870           echo "KVM_PATH = '$(KVM_PATH)'"; \
871           echo "SOCAT_PATH = '$(SOCAT)'"; \
872           echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
873           echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
874           echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
875           echo "TOOLSDIR = '$(toolsdir)'"; \
876           echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
877           echo "PKGLIBDIR = '$(pkglibdir)'"; \
878           echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
879           echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
880           echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
881           echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
882           echo "MASTERD_USER = '$(MASTERD_USER)'"; \
883           echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
884           echo "RAPI_USER = '$(RAPI_USER)'"; \
885           echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
886           echo "CONFD_USER = '$(CONFD_USER)'"; \
887           echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
888           echo "NODED_USER = '$(NODED_USER)'"; \
889           echo "NODED_GROUP = '$(NODED_GROUP)'"; \
890           echo "VCS_VERSION = '$$VCSVER'"; \
891           echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
892           if [ "$(HTOOLS)" ]; then \
893             echo "HTOOLS = True"; \
894           else \
895             echo "HTOOLS = False"; \
896           fi; \
897         } > $@
898
899 $(REPLACE_VARS_SED): Makefile
900         set -e; \
901         { echo 's#@PREFIX@#$(prefix)#g'; \
902           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
903           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
904           echo 's#@BINDIR@#$(bindir)#g'; \
905           echo 's#@SBINDIR@#$(sbindir)#g'; \
906           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
907           echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
908           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
909           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
910           echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
911           echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
912           echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
913           echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
914           echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
915           echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
916           echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
917           echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
918           echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
919           echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
920           echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
921           echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
922           echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
923           echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
924         } > $@
925
926 # Using deferred evaluation
927 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
928 daemons/ganeti-watcher: MODULE = ganeti.watcher
929 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
930 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
931
932 $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
933         test -n "$(MODULE)" || { echo Missing module; exit 1; }
934         set -e; \
935         { echo '#!/usr/bin/python'; \
936           echo '# This file is automatically generated, do not edit!'; \
937           echo "# Edit $(MODULE) instead."; \
938           echo; \
939           echo '"""Bootstrap script for L{$(MODULE)}"""'; \
940           echo; \
941           echo '# pylint: disable-msg=C0103'; \
942           echo '# C0103: Invalid name'; \
943           echo; \
944           echo 'import sys'; \
945           echo 'import $(MODULE) as main'; \
946           echo; \
947           echo '# Temporarily alias commands until bash completion'; \
948           echo '# generator is changed'; \
949           echo 'if hasattr(main, "commands"):'; \
950                 echo '  commands = main.commands # pylint: disable-msg=E1101'; \
951           echo; \
952           echo 'if __name__ == "__main__":'; \
953           echo '  sys.exit(main.Main())'; \
954         } > $@
955         chmod u+x $@
956
957 # We need to create symlinks because "make distcheck" will not install Python
958 # files when building.
959 stamp-srclinks: Makefile | $(all_dirfiles)
960         set -e; \
961         for i in $(srclink_files); do \
962                 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
963                         $(LN_S) $(abs_top_srcdir)/$$i $$i; \
964                 fi; \
965         done
966         touch $@
967
968 .PHONY: ganeti
969 ganeti:
970         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
971
972 .PHONY: check-dirs
973 check-dirs: $(BUILT_SOURCES)
974         @set -e; \
975         find . -type d \( \( -name . \) -o \( \
976                 -name .git -o \
977                 -name autom4te.cache \
978                 \) -prune -o -print \) | { \
979                 error=; \
980                 while read dir; do \
981                         case "$$dir" in \
982                                 $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
983                                 *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
984                         esac; \
985                 done; \
986                 for dir in $(DIRS); do \
987                         if ! test -d "$$dir"; then \
988                                 echo "Directory $$dir listed in DIRS does not exist" >&2; \
989                                 error=1; \
990                         fi \
991                 done; \
992                 if test -n "$$error"; then exit 1; else exit 0; fi; \
993         }
994
995 check-local: check-dirs
996         $(CHECK_PYTHON_CODE) $(check_python_code)
997         $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
998         $(CHECK_NEWS) < $(top_srcdir)/NEWS
999         expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1000         if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1001                 echo "Incorrect version in README, expected $$expver"; \
1002                 exit 1; \
1003         fi; \
1004         if test "`sed -ne '4 p' $(top_srcdir)/doc/iallocator.rst`" != \
1005                                         "Documents Ganeti version $$expver"; then \
1006                 echo "Incorrect version in iallocator.rst, expected $$expver"; \
1007                 exit 1; \
1008         fi
1009
1010 .PHONY: hs-check
1011 hs-check: htools/test
1012         @rm -f test.tix
1013         ./htools/test
1014
1015 .PHONY: lint
1016 lint: $(BUILT_SOURCES)
1017         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1018         $(PYLINT) $(LINT_OPTS) $(lint_python_code)
1019         cd $(top_srcdir)/qa && \
1020           PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1021           --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1022
1023 .PHONY: hlint
1024 hlint: $(HS_BUILT_SRCS)
1025         if tty -s; then C="-c"; else C=""; fi; \
1026         hlint --report=doc/hs-lint.html $$C htools
1027
1028 # a dist hook rule for updating the vcs-version file; this is
1029 # hardcoded due to where it needs to build the file...
1030 dist-hook:
1031         $(MAKE) regen-vcs-version && \
1032         rm -f $(top_distdir)/vcs-version && \
1033         cp -p $(srcdir)/vcs-version $(top_distdir)
1034
1035 # a distcheck hook rule for catching revision control directories
1036 distcheck-hook:
1037         if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1038                 echo "Found revision control files in final archive." 1>&2; \
1039                 exit 1; \
1040         fi
1041         if find $(top_distdir) -name '*.py[co]' | grep .; then \
1042                 echo "Found Python byte code in final archive." 1>&2; \
1043                 exit 1; \
1044         fi
1045         if find $(top_distdir) -name '*~' | grep .; then \
1046                 echo "Found backup files in final archive." 1>&2; \
1047                 exit 1; \
1048         fi
1049 # Empty files or directories should not be distributed. They can cause
1050 # unnecessary warnings for packagers. Directories used by automake during
1051 # distcheck must be excluded.
1052         if find $(top_distdir) -empty -and -not \( \
1053                         -path $(top_distdir)/_build -or \
1054                         -path $(top_distdir)/_inst \) | grep .; then \
1055                 echo "Found empty files or directories in final archive." 1>&2; \
1056                 exit 1; \
1057         fi
1058         if test -n "$(BUILD_RELEASE)" && \
1059            grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1060                 echo "Found unreleased version in NEWS." >&2; \
1061                 exit 1; \
1062         fi
1063
1064 # When building a release, stricter checks should be used
1065 distcheck-release dist-release: export BUILD_RELEASE = 1
1066 distcheck-release: distcheck
1067
1068 dist-release: dist
1069         set -e; \
1070         for i in $(DIST_ARCHIVES); do \
1071                 echo -n "Checking $$i ... "; \
1072                 autotools/check-tar < $$i; \
1073                 echo OK; \
1074         done
1075
1076 install-exec-local:
1077         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1078           "$(DESTDIR)${localstatedir}/log/ganeti" \
1079           "$(DESTDIR)${localstatedir}/run/ganeti"
1080
1081 # To avoid conflicts between directory names and other targets, a file inside
1082 # the directory is used to ensure its existence.
1083 %.dir:
1084         @mkdir_p@ $* && touch $@
1085
1086 .PHONY: apidoc
1087 if WANT_HTOOLSAPIDOC
1088 apidoc: py-apidoc hs-apidoc
1089 else
1090 apidoc: py-apidoc
1091 endif
1092
1093 .PHONY: py-apidoc
1094 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1095         $(RUN_IN_TEMPDIR) epydoc -v \
1096                 --conf $(CURDIR)/epydoc.conf \
1097                 --output $(CURDIR)/$(APIDOC_PY_DIR)
1098
1099 .PHONY: hs-apidoc
1100 hs-apidoc: $(HS_BUILT_SRCS)
1101         @test -n "$(HSCOLOUR)" || \
1102             { echo 'HsColour' not found during configure; exit 1; }
1103         @test -n "$(HADDOCK)" || \
1104             { echo 'haddock' not found during configure; exit 1; }
1105         rm -rf $(APIDOC_HS_DIR)/*
1106         @mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools
1107         $(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1108         ln -s ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1109         set -e ; \
1110         cd htools; \
1111         if [ "$(HTOOLS_NOCURL)" ]; \
1112         then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1113         else OPTGHC=""; \
1114         fi; \
1115         RELSRCS="$(HS_LIB_SRCS:htools/%=%)  $(HS_BUILT_SRCS:htools/%=%)"; \
1116         for file in $$RELSRCS; do \
1117                 hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1118                 $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1119         done ; \
1120         $(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1121                 -t ganeti-htools -p haddock-prologue \
1122                 --source-module="%{MODULE/.//}.html" \
1123                 --source-entity="%{MODULE/.//}.html#%{NAME}" \
1124                 $$OPTGHC \
1125                 $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1126
1127 .PHONY: TAGS
1128 TAGS: $(BUILT_SOURCES)
1129         rm -f TAGS
1130         find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1131           -path './daemons/ganeti-*' -o -path './tools/*' -o \
1132           -path './qa/*.py' | \
1133           etags -l python -
1134
1135 .PHONY: coverage
1136 if WANT_HTOOLS
1137 coverage: py-coverage hs-coverage
1138 else
1139 coverage: py-coverage
1140 endif
1141
1142 .PHONY: py-coverage
1143 py-coverage: $(BUILT_SOURCES) $(python_tests)
1144         set -e; \
1145         COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1146         TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1147         HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1148         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1149         $(python_tests)
1150
1151 .PHONY: hs-coverage
1152 hs-coverage: $(haskell_tests)
1153         cd htools && rm -f *.tix *.mix && ./test
1154         @mkdir_p@ $(COVERAGE_HS_DIR)
1155         hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1156         hpc report htools/test $(HPCEXCL)
1157         ln -sf hpc_index.html $(COVERAGE_HS_DIR)/index.html
1158
1159 # Special "kind-of-QA" target for htools, needs special setup (all
1160 # tools compiled with -fhpc)
1161 .PHONY: live-test
1162 live-test: all
1163         set -e ; \
1164         cd htools; \
1165         rm -f .hpc; ln -s ../.hpc .hpc; \
1166         rm -f *.tix *.mix; \
1167         ./live-test.sh; \
1168         hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1169           --output=live-test.tix ; \
1170         @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1171         hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1172                 --srcdir=.. $(HPCEXCL) ; \
1173         hpc report --srcdir=.. live-test $(HPCEXCL)
1174
1175 commit-check: distcheck lint apidoc
1176
1177 -include ./Makefile.local
1178
1179 # vim: set noet :