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