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